Jump to content

Erreur Sql Sur "filtrer Par Catégorie" Ds Catalogue /produits


Recommended Posts

Bonjour.

 

Je rencontre une erreur SQL lorsque je souhaite effectuer un trie par catégorie dans le BO à la page catalogue produit : index.php?controller=AdminProducts

 

Prestashop 1.5.6

Theme Midnight

Version PHP  5.6

Mysql 5.5

 
L'erreur est la suivante 

  • Mauvaise requête SQL
    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 ' cup.`label` FROM `ps_product` a LEFT JOIN `ps_product_lang` b ON (b.`id_pro' at line 3

Je passe en mode debug je vois la requête concernée:
 

SELECT SQL_CALC_FOUND_ROWS
  a.`id_product`,b.name as name,`reference`,a.price as price,sa.active as active,cp.position as position
  , shop.name as shopname, a.id_shop_default, MAX(image_shop.id_image) id_image, cl.name `name_category`, sa.`price`, 0 AS price_final, sav.`quantity` as sav_quantity, sa.`active` , cp.`position`,  , cup.`label`
  FROM `ps_product` a
  LEFT JOIN `ps_product_lang` b ON (b.`id_product` = a.`id_product` AND b.`id_lang` = 1 AND b.`id_shop` = 1)
  
  LEFT JOIN `ps_image` i ON (i.`id_product` = a.`id_product`)
  LEFT JOIN `ps_stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0
   AND sav.id_shop = 1 )  JOIN `ps_product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = a.id_shop_default)
    LEFT JOIN `ps_category_lang` cl ON (sa.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = a.id_shop_default)
    LEFT JOIN `ps_shop` shop ON (shop.id_shop = a.id_shop_default) 
    LEFT JOIN `ps_image_shop` image_shop ON (image_shop.`id_image` = i.`id_image` AND image_shop.`cover` = 1 AND image_shop.id_shop = a.id_shop_default) INNER JOIN `ps_category_product` cp ON (cp.`id_product` = a.`id_product` AND cp.`id_category` = 8)  LEFT JOIN `ps_customoptions_product` cup ON (cup.`id_product` = a.`id_product`)  
  
  WHERE 1 
  GROUP BY sa.id_product 
  
  ORDER BY cp.`position` ASC LIMIT 0,50:

 
En revanche je ne parviens pas à trouver le fichier ou intervenir :

at line 613 in file classes/db/Db.php

607.  WebserviceRequest::getInstance()->setError(500, '[SQL Error] '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);
608.  }
609.  else if (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))
610.  {
611.  if ($sql)
612.  throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
613.  throw new PrestaShopDatabaseException($this->getMsgError());
614.  }
615.  }
616.
617.  /**

DbCore->displayError - [line 313 - classes/db/Db.php] - [1 Arguments]
DbCore->query - [line 488 - classes/db/Db.php] - [1 Arguments]
DbCore->executeS - [line 2301 - classes/controller/AdminController.php] - [1 Arguments]
AdminControllerCore->getList - [line 668 - controllers/admin/AdminProductsController.php] - [6 Arguments]
AdminProductsControllerCore->getList - [line 1608 - classes/controller/AdminController.php] - [1 Arguments]
AdminControllerCore->renderList - [line 4620 - controllers/admin/AdminProductsController.php] - [0 Argument]
AdminProductsControllerCore->renderList - [line 1502 - classes/controller/AdminController.php] - [0 Argument]
AdminControllerCore->initContent - [line 4604 - controllers/admin/AdminProductsController.php] - [0 Argument]
AdminProductsControllerCore->initContent - [line 167 - classes/controller/Controller.php] - [0 Argument]
ControllerCore->run - [line 348 - classes/Dispatcher.php] - [0 Argument]
DispatcherCore->dispatch - [line 53 - admin-adr/index.php] - [0 Argument]

 

 

Si quelqu'un à une idée ou une piste pertinente cela m’intéresse.

 

Cordialement

 

Ozm

Share this post


Link to post
Share on other sites

dans ta requête l'erreur viens de 

 

cp.`position`, , cup.`label`

 

à la fin de la 4eme ligne, il y a 2 virgules à la suite, il faut donc trouver dans quel fichier tu as cette requête pour la corriger.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More