I'm trying to create a custom Zoo element based on the Quick2Cart element, but I'm realizing that there's a reason I'm not a programmer.
The quick2cart guys have helped a little bit by giving me this snippet:
function getitemid($product_id,$client)
{
$db = JFactory::getDBO();
$query = "SELECT `item_id` FROM `#__kart_items` where `product_id`=".(int)$product_id. " AND parent='$client'";
$db->setQuery($query);
$result = $db->loadResult();
return $result;
}
But I can't quite figure out how to write the element so it renders. All I really want is for the element to check to see if the item is for sale (meaning, it's set up in Quick2cart and is considered a product). If so, I want to display a little "Buy it!" badge that links to the zoo item.
The current Quick2Cart Zoo element has lots of extra stuff in it so I can't simply duplicate it or I'd end up with issues in the edit screen of the zoo item. I don't really want any interface at all for the element. All I really want is an "if it's a product, show this" kind of thing.