pppplus Posted December 14, 2009 Share Posted December 14, 2009 Sur la page prices-drop.php (promotions), la pagination prend en compte tous les produits, au lieu de ceux en promotion uniquement.Apparemment juste un petit oubli dans la requête qui compte les produitsRemplacer (ligne 1089 environ, fichier /Classes/Product.php) if ($count) { $sql = ‘ SELECT COUNT(DISTINCT p.`id_product`) AS nb FROM `’._DB_PREFIX_.’product` p WHERE p.`active` = 1 AND p.`id_product` IN ( SELECT cp.`id_product` FROM `’._DB_PREFIX_.’category_group` cg LEFT JOIN `’._DB_PREFIX_.’category_product` cp ON (cp.`id_category` = cg.`id_category`) WHERE cg.`id_group` ‘.(!$cookie->id_customer ? ‘= 1’ : ‘IN (SELECT id_group FROM ‘._DB_PREFIX_.’customer_group WHERE id_customer = ‘.intval($cookie->id_customer).’)’).’ )’; $result = Db::getInstance()->getRow($sql); return intval($result[’nb’]); } par if ($count) { $sql = ‘ SELECT COUNT(DISTINCT p.`id_product`) AS nb FROM `’._DB_PREFIX_.’product` p WHERE p.`active` = 1 AND (`reduction_price` > 0 OR `reduction_percent` > 0) ‘.((!$beginning AND !$ending) ? ‘AND (`reduction_from` = `reduction_to` OR (`reduction_from` <= \’’.pSQL($currentDate).’\’ AND `reduction_to` >= \’’.pSQL($currentDate).’\’))’ : ($beginning ? ‘AND `reduction_from` <= \’’.pSQL($beginning).’\’’ : ‘’).($ending ? ‘AND `reduction_to` >= \’’.pSQL($ending).’\’’ : ‘’)).’ AND p.`id_product` IN ( SELECT cp.`id_product` FROM `’._DB_PREFIX_.’category_group` cg LEFT JOIN `’._DB_PREFIX_.’category_product` cp ON (cp.`id_category` = cg.`id_category`) WHERE cg.`id_group` ‘.(!$cookie->id_customer ? ‘= 1’ : ‘IN (SELECT id_group FROM ‘._DB_PREFIX_.’customer_group WHERE id_customer = ‘.intval($cookie->id_customer).’)’).’ )’; $result = Db::getInstance()->getRow($sql); return intval($result[’nb’]); } Mis sur le bug tracker Link to comment Share on other sites More sharing options...
Daxey Posted December 17, 2009 Share Posted December 17, 2009 merci pour ta contribution ca m'aide bienjuste à préciser qu'il faut replacer $currentDate = date('Y-m-d'); qui est en dessous à la base, au dessus, cette fois-ci. Link to comment Share on other sites More sharing options...
pppplus Posted December 17, 2009 Author Share Posted December 17, 2009 de rien.Ah oui peut-être pour la date, je n'ai pas fait attention (les promos étant permanentes). J'irai vérifier cela Link to comment Share on other sites More sharing options...
Daxey Posted December 17, 2009 Share Posted December 17, 2009 Tu utilises la variable pour savoir si c'est la promo est valable aujourd'hui.Seulement, de base, elle est définie plus bas. Link to comment Share on other sites More sharing options...
cybersteph Posted December 18, 2009 Share Posted December 18, 2009 Cela fonctionne impeccable (en 1.2.5), pas besoin de la variable, elle y est déjà. Par contre attention si vous copiez-collez, les accents ne sont pas!merci Link to comment Share on other sites More sharing options...
richard03 Posted January 13, 2010 Share Posted January 13, 2010 merci pour cette contrib ça marche nikel chez moi aussi, enfin ça retire les pages fantôme ce qui est déjà plus que bien .par contre je n'ai qu'un produit par page pour 3 produits en promos j'ai 3 pages, est ce que vous avez une idée pour en afficher plusieurs par pages?d'avance merci Link to comment Share on other sites More sharing options...
richard03 Posted January 13, 2010 Share Posted January 13, 2010 dsl erreur de ma part j'etais configuré à 1 produit par page...donc forcément -.-.bref encore merci pppplus pour ta contrib Link to comment Share on other sites More sharing options...
pppplus Posted January 13, 2010 Author Share Posted January 13, 2010 mais de rien, le plaisir est pour moi Link to comment Share on other sites More sharing options...
Marc Posted January 14, 2010 Share Posted January 14, 2010 BonjourJ'ai testé et ca ne fonctionne pas chez moi , mais j'ai trouvé une solution grâce à toi ;-P if ($count) { $sql = ' SELECT COUNT(DISTINCT p.`id_product`) AS nb FROM `'._DB_PREFIX_.'product` p WHERE p.`active` = 1 AND (`reduction_price` > 0 OR `reduction_percent` > 0) AND p.`id_product` IN ( SELECT cp.`id_product` FROM `'._DB_PREFIX_.'category_group` cg LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`) WHERE cg.`id_group` '.(!$cookie->id_customer ? '= 1' : 'IN (SELECT id_group FROM '._DB_PREFIX_.'customer_group WHERE id_customer = '.intval($cookie->id_customer).')').' )'; $result = Db::getInstance()->getRow($sql); return intval($result['nb']); } De cette manère j'ai plus de souci Link to comment Share on other sites More sharing options...
pppplus Posted January 15, 2010 Author Share Posted January 15, 2010 peut-être une différence entre 1.2.3 et 1.2.5 Link to comment Share on other sites More sharing options...
lyrice Posted April 2, 2010 Share Posted April 2, 2010 Si vous avez une ancienne version : J'ai effectué cette correction qui fonctionne chez moiFichier Classes/Product.phpligne 996 environJ'ai remplacé ceci : if ($count) { $result = Db::getInstance()->getRow(' SELECT COUNT(`id_product`) AS nb FROM `'._DB_PREFIX_.'product` WHERE `reduction_price` > 0 OR `reduction_percent` > 0 AND `active` = 1'); return intval($result['nb']); } $currentDate = date('Y-m-d'); par ceci : if ($count) { $result = Db::getInstance()->getRow(' SELECT COUNT(`id_product`) AS nb FROM `'._DB_PREFIX_.'product` WHERE (`reduction_price` > 0 OR `reduction_percent` > 0) '.((!$beginning AND !$ending) ? 'AND (`reduction_from` = `reduction_to` OR (`reduction_from` <= \''.$currentDate.'\' AND `reduction_to` >= \''.$currentDate.'\'))' : ($beginning ? 'AND `reduction_from` <= \''.$beginning.'\'' : '').($ending ? 'AND `reduction_to` >= \''.$ending.'\'' : '')).' AND `active` = 1 '); return intval($result['nb']); } $currentDate = date('Y-m-d'); Et je n'ai plus le problème de pagination Link to comment Share on other sites More sharing options...
France Posted July 2, 2010 Share Posted July 2, 2010 Bonjour,J'ai effectivement fait un copier/coller pour corriger le bug et comme je travaille avec DW je vois bien que le code ne s'affiche pas comme il faut concernant la coloration syntaxique. Je remarque que dans ce code il y a des ` au lieu de ' et je pense qu'il faut les changer mais pas évident de savoir lesquels en plus de pas être certaine de mon affaire.Quelqu'un peut me dire lesquels changer ou bien donner le code avec les bons '?Merci de votre aide Link to comment Share on other sites More sharing options...
France Posted July 5, 2010 Share Posted July 5, 2010 BonjourPour ceux et celles qui ne sont pas de modifier les accents dans le code qui a été donné vous pouvez prendre celui que l'on retrouve dans ce topic.Ça marche nickel en faisant un copier/collerhttp://www.prestashop.com/forums/viewreply/225362/ Link to comment Share on other sites More sharing options...
nuveo Posted July 22, 2010 Share Posted July 22, 2010 En effet sa marche nickel merci. Link to comment Share on other sites More sharing options...
PF22 Posted February 15, 2011 Share Posted February 15, 2011 Question idiote...C laquelle de totue les modif qui fonctionne !C vraiment fonction de la version de Presta ?Merci d'avance. Link to comment Share on other sites More sharing options...
Recommended Posts