Hello, Guest |
| Register
Remember me Forgot password ?
Site Map Site Map Contact us Contact us
PrestaShop
  654 users online

Bug tracker



Pagination bug in new-products.php
Last modified : 06 Jan 2009 at 14:16

Severity: Minor
Version: V1.1 (1.1.0.5)
Installation type: Full (with sample data)
Theme: Default
Project: Front Office
Reporter: kink
Report #: 1155
Date created: 02 Jan 2009 at 14:06 (UTC+1)
Related to Report #:

Hosting service: Ovh
Server OS: Linux
Web server: Apache 1.3 or later
PHP version: PHP 5.0 or later
5.2.6
MySQL: 5.0
Client computer OS: Windows
Web browser(s) tested: Firefox 3
 
Details:
On new-products page. Pagination block don't show the good number of page.
If there is 3 new-products and 60 products in the database, 3 products are displayed (that good) but there is a link for each page (1, 2, 3, 4, ... 6) [with the default display 10 products by page].

To correct this bug, In the new-product.php page:
# line 8:
----- Original -----
$nbProducts = intval(Product::getNewProducts(intval($cookie->id_lang), NULL,NULL, true));
----------

----- must be: -----
$nbProducts = intval(Product::getNewProducts(intval($cookie->id_lang), intval($p) - 1, intval($n), false));
----------
 
Comments :

fixed for next release !

By Lucas Cherifi on 06 Jan 2009 at 14:16 (UTC+1)


new products should be sorted by last product added, not alphabetical way

By jolvil on 06 Jan 2009 at 15:33 (UTC+1)


It doesn’t work!!!

By lehangart on 26 Jan 2009 at 17:53 (UTC+1)


Ok, there is the new correction:

The original file was good:

# line 8:
----- Original and GOOD one -----
$nbProducts = intval(Product::getNewProducts(intval($cookie->id_lang), NULL,NULL, true));
----------

but in classes/Products.php, getNewProducts was not good |line 903

----- Original -----
if ($count)
{
$result = Db::getInstance()->getRow(’
SELECT COUNT(`id_product`) AS nb
FROM `’._DB_PREFIX_.’product`
WHERE `active` = 1’);
return intval($result[’nb’]);
}
----------

----- must be: -----
if ($count)
{
$result = Db::getInstance()->getRow(’
SELECT COUNT(`id_product`) AS nb
FROM `’._DB_PREFIX_.’product`
WHERE `active` = 1
AND DATEDIFF(`date_add`, DATE_SUB(NOW(), INTERVAL ‘.(Validate::isUnsignedInt(Configuration::get(’PS_NB_DAYS_NEW_PRODUCT’)) ? Configuration::get(’PS_NB_DAYS_NEW_PRODUCT’) : 20).’ DAY)) > 0’);
return intval($result[’nb’]);
}

Because original count return the number of products on database instead of the number of new products.

Thank’s for your report lehangart!

By kink on 30 Jan 2009 at 18:01 (UTC+1)


be carrefull whith the ’ when you copy these lines

By kink on 30 Jan 2009 at 18:22 (UTC+1)


voir http://www.prestashop.com/forums/viewthread/11394/installation_configuration_et_mise_a_jour/retour_sur_le_bug_de_pagination/

By kink on 30 Jan 2009 at 18:25 (UTC+1)


Pagination bug in prices-drop.php
Details:
On prices-drop.php page. Pagination block don’t show the good number of page.
If there is 3 products-drop and 60 products in the database, 3 products are displayed (that good) but there is a link for each page (1, 2, 3, 4, ... 6)

By Русторг.биз on 23 Nov 2009 at 15:07 (UTC+1)


view link http://www.1.rustorg.biz/prices-drop.php

By Русторг.биз on 23 Nov 2009 at 15:09 (UTC+1)


For /prices-drop.php I propose this :

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’]);
}

by :

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’]);
}

By pppplus on 15 Dec 2009 at 00:49 (UTC+1)


Help! The mentioned option for the pagination error doesn’t work for me. :( I use version: 1.1.0.5 and can’t really compare with the file in version 1.2.5 as it doesn’t look like it at all. :(

By Mr.E. on 18 Dec 2009 at 15:57 (UTC+1)


Notify me of follow-up comments?

<< Previous | Next >>