Travis Posted April 17, 2009 Share Posted April 17, 2009 For some reason I have 6 pages of specials and when I click page 6 there is nothing. There are really only 2 pages of specials. Is this because the details of previous specials? i.e. special from and to dates, now passed are still in some products. If that is so why base page numbers on specials which no longer exist? (PrestaShop version 1.1 final) Link to comment Share on other sites More sharing options...
Travis Posted April 18, 2009 Author Share Posted April 18, 2009 Any help please. I think its confusing to customers to think there are 6 pages of specials when there are really 2. Maybe a few lines of code which fix the problem, anyone? Link to comment Share on other sites More sharing options...
LanG Posted February 17, 2010 Share Posted February 17, 2010 static public function getPricesDrop($id_lang, $pageNumber = 0, $nbProducts = 10, $count = false, $orderBy = NULL, $orderWay = NULL, $beginning = false, $ending = false) { global $link, $cookie; if (!Validate::isBool($count)) die(Tools::displayError()); if ($pageNumber < 0) $pageNumber = 0; if ($nbProducts < 1) $nbProducts = 10; if (empty($orderBy) || $orderBy == 'position') $orderBy = 'myprice'; if (empty($orderWay)) $orderWay = 'DESC'; if ($orderBy == 'id_product' OR $orderBy == 'price' OR $orderBy == 'date_add') $orderByPrefix = 'p'; elseif ($orderBy == 'name') $orderByPrefix = 'pl'; if (!Validate::isOrderBy($orderBy) OR !Validate::isOrderWay($orderWay)) die (Tools::displayError()); 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 (`reduction_price` > 0 OR `reduction_percent` > 0) and 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']); } $currentDate = date('Y-m-d'); $sql = ' SELECT p.*, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`, i.`id_image`, il.`legend`, t.`rate`, (p.`reduction_price` + (p.`reduction_percent` * p.`price`)) AS myprice, m.`name` AS manufacturer_name FROM `'._DB_PREFIX_.'product` p LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.intval($id_lang).') LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1) LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.intval($id_lang).') LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = p.`id_tax`) LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`) WHERE (`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.`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).')').' ) ORDER BY '.(isset($orderByPrefix) ? pSQL($orderByPrefix).'.' : '').'`'.pSQL($orderBy).'`'.' '.pSQL($orderWay).' LIMIT '.intval($pageNumber * $nbProducts).', '.intval($nbProducts); $result = Db::getInstance()->ExecuteS($sql); if($orderBy == 'price') { Tools::orderbyPrice($result,$orderWay); } if (!$result) return false; return Product::getProductsProperties($id_lang, $result); } /classes/Product.phpsearch function getPricesDrop and insert my 'new' function, vice the found.Excuse me for my english, i'm from russia.Good luck! Link to comment Share on other sites More sharing options...
cammo Posted February 18, 2010 Share Posted February 18, 2010 Yes, I've noticed this bug also. Link to comment Share on other sites More sharing options...
sm3004 Posted April 27, 2010 Share Posted April 27, 2010 Does this fix work on PrestaShop 1.2.5?? Link to comment Share on other sites More sharing options...
rocky Posted April 27, 2010 Share Posted April 27, 2010 Yes, it should work. Link to comment Share on other sites More sharing options...
Recommended Posts