Jump to content

Manufacturer Bug - Possible


Recommended Posts

When I upgraded, I had a list of manufactureres that had no PRODUCTS yet. When I click on the name of the manufacturer I get this error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-10,10' at line 16


       SELECT p.*, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`
       FROM `ps_product` p
       LEFT JOIN `ps_product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = 1)
       LEFT JOIN `ps_image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
       LEFT JOIN `ps_image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = 1)
       LEFT JOIN `ps_tax` t ON t.`id_tax` = p.`id_tax`
       LEFT JOIN `ps_tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = 1)
       LEFT JOIN `ps_manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
       LEFT JOIN `ps_category_product` cp ON (cp.`id_product` = p.`id_product`)
       INNER JOIN `ps_category_group` ctg ON (ctg.`id_category` = cp.`id_category`)

       WHERE p.`id_manufacturer` = 6 AND p.`active` = 1
       AND ( ctg.`id_group` = 1)
       GROUP BY p.`id_product`
       ORDER BY `name` DESC 
       LIMIT -10,10



If a manufacturer has a PRODUCT then it works fine, only if I click one that doesn't have any products do you see this error display. Anyone else able to create this problem by just adding a manufacturer with no products then click it.

Link to comment
Share on other sites

Hi

I can't reproduce the problem with 1.2.1.0 but you can try that:

IN /supplier.php (suppliers and manufacturers use the same management file supplier.php)

SEARCH Line 36

            'products' => $object->getProducts($id, intval($cookie->id_lang), intval($p), intval($n), $orderBy, $orderWay),



REPLACE BY

            'products' => ($nbProducts>0?$object->getProducts($id, intval($cookie->id_lang), intval($p), intval($n), $orderBy, $orderWay):false),

Link to comment
Share on other sites

That corrected the problem, (THANKS). If it helps I had upgraded from one of the 1.2.BETA versions to the 1.2.1 version, so maybe using the updater and the sql database had some issue??

Knowing that it fixed it might help explain it too!! I had another site, I just did a fresh install of the 1.2.1 version but then uploaded the backup sql file for the MANUFACTURERS list so I wouldn't have to retype the whole list, could that help explain the issue???

Again, thanks for a prompt fix.

Note: As for the earlier post about why post a manufacturer without a product, I don't think its that unreasonable for someone to set up all their Manufacturers before starting to add products !!!

Link to comment
Share on other sites

Well done, I came across that when I set up the manufacturers and then got the sql error.

I have noticed that prestashop is very quirky with sql errors, when I uploaded a csv file today a product ID was mistaken for a sql command and stopped the upload.

Link to comment
Share on other sites

×
×
  • Create New...