Jump to content

Manufacturer module error


Recommended Posts

Hi, when I click to see the list of manufacturers with the amount of product from each manufacturer, the list shows ALL the 64 products under one single manufacturer despite the fact that they belong to different ones. And all the other manufacturers show 0 product. Then when you click the button "See products" next to that manufacturer, it only shows you 8 products which is correct as that manufacturer only has 8 products.

 

How can I get this corrected, so that the right amount of products is shown next to each manufacturer? 

 

I am attaching a screencapture. Thanks.

post-982030-0-91173500-1435073976_thumb.jpg

Link to comment
Share on other sites

Yes, thank you for your help. That handled the problem.

 

I just had to open class/Manufacturer.php, delete $results = ...... );  from line 191 to line 205 and write the code below instead.

 

$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
                    SELECT  p.`id_manufacturer`, COUNT(DISTINCT p.`id_product`) as nb_products
                    FROM `'._DB_PREFIX_.'product` p USE INDEX (product_manufacturer)
                    '.Shop::addSqlAssociation('product', 'p').'
                    LEFT JOIN `'._DB_PREFIX_.'manufacturer` as m ON (m.`id_manufacturer`= p.`id_manufacturer`)
                    WHERE p.`id_manufacturer` != 0 AND product_shop.`visibility` NOT IN ("none")
                    '.($active ? ' AND product_shop.`active` = 1 ' : '').'
                    '.($all_group ? '' : ' AND EXISTS (
                        SELECT 1
                        FROM `'._DB_PREFIX_.'category_group` cg
                        LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
                        WHERE p.`id_product` = cp.`id_product` AND cg.`id_group` '.$sql_groups.'
                    )').'
                    GROUP BY p.`id_manufacturer`'
                );

 

You should get this corrected in future versions of prestashop or with the updates.

 

Regards.

Link to comment
Share on other sites

×
×
  • Create New...