Search code examples
joomlavirtuemart

Joomla Virtuemar 2.x


im traying to show in the products detail page, the list of the other products by the same Manufacturer. I mean, if you are in a Shoes from Adidas, the page shows up the another adidas products. So i have this code:

http://codepad.org/pO8XF0OI (Dont Know how to write code here)

Is actually working but only shows the products by the Category no by the Manufacturer.

What i'm doing wrong?


Solution

  • Try this,

    If you are using Vm2.x It will gives you full products under one manufacture.You can add or remove another tables based on your requirement.

                                $db = &JFactory::getDBO();
                                $sql = "SELECT N.product_name,M.virtuemart_product_id,MN.mf_name 
                                FROM jos_virtuemart_product_manufacturers AS M 
                                LEFT JOIN jos_virtuemart_products AS P ON M.virtuemart_product_id = P.virtuemart_product_id
                                LEFT JOIN jos_virtuemart_products_en_gb  AS N ON N.virtuemart_product_id = M.virtuemart_product_id
                                LEFT JOIN jos_virtuemart_manufacturers_en_gb AS MN ON MN.virtuemart_manufacturer_id = M.virtuemart_manufacturer_id
                                WHERE M.virtuemart_manufacturer_id = '$manufature_id'";
                                $db->setQuery($sql);
                                $db->query();
                                $res = $db->loadAssocList();
                                echo "<pre/>";
                                print_r($res);
    

    Hope this may help...