jparkerbishop Posted January 4, 2011 Share Posted January 4, 2011 Hello all,I would like to change the number of products selected to display from the bottom drop down box on each product page. i.e. 16, 32 , 64, 100 Any help would be greatly appreciated! Many Thanks Link to comment Share on other sites More sharing options...
rocky Posted January 5, 2011 Share Posted January 5, 2011 Edit line 3 of pagination.php to change the dropdown values: $nArray = intval(Configuration::get('PS_PRODUCTS_PER_PAGE')) != 10 ? array(intval(Configuration::get('PS_PRODUCTS_PER_PAGE')), 10, 20, 50) : array(10, 20, 50); This code checks whether the products per page set on the Preferences > Products tab is 10. If it is, it displays 10, 20 and 50, otherwise it displays the products per page set on the Preferences > Products tab, then 10, 20 and 50. 1 Link to comment Share on other sites More sharing options...
jparkerbishop Posted January 5, 2011 Author Share Posted January 5, 2011 Hello Rocky,I've had a go changing that code around, but it doesn't seem to be working. I've got 20 products set to display in the Back Office, and I want it to go up 20, 40, 100. Many thanks Link to comment Share on other sites More sharing options...
jparkerbishop Posted January 5, 2011 Author Share Posted January 5, 2011 $nArray = intval(Configuration::get('PS_PRODUCTS_PER_PAGE')) != 10 ? array(intval(Configuration::get('PS_PRODUCTS_PER_PAGE')), 10, 48, 92) : array(10, 48, 92);That's the code I have changed, but it still has had no effect on the drop down menu? Could you please take a look and advise. I have also tried changing the remaining '10' but this had no effect either. Link to comment Share on other sites More sharing options...
rocky Posted January 7, 2011 Share Posted January 7, 2011 How many products are there on the page you are viewing? Only the options less than the current number of products will be displayed, so unless there are 49 or more products you will only see 10 as the option for products per page. Link to comment Share on other sites More sharing options...
cast Posted January 14, 2011 Share Posted January 14, 2011 Hi Rocky, I have set Preferences > products to 9 because my grid is 3 column, and then I want to change to 9, 18, 36.. I've changed a code to this:$nArray = intval(Configuration::get('PS_PRODUCTS_PER_PAGE')) != 9 ? array(intval(Configuration::get('PS_PRODUCTS_PER_PAGE')), 9, 18, 36) : array(9, 18, 36);also, I have 14 products displayed in one category.. but it's still give me option of 9 and 10 items only.. like something wrong with the code? Link to comment Share on other sites More sharing options...
cast Posted January 14, 2011 Share Posted January 14, 2011 ok, it works.. i just forgot to upload the file to server.. hahathanks for the eplanation, rocky! Link to comment Share on other sites More sharing options...
MAMAY Posted April 2, 2011 Share Posted April 2, 2011 Dont work in 1.4, any help? Link to comment Share on other sites More sharing options...
rocky Posted April 2, 2011 Share Posted April 2, 2011 The code has been moved to the pagination function in classes/FrontController.php. You should create override/classes/FrontController.php to override the pagination function. Link to comment Share on other sites More sharing options...
a3784386 Posted April 4, 2011 Share Posted April 4, 2011 I need to copy classes/FrontController.php to override/classes/FrontController.php and then edit override/classes/FrontController.php ??And what about override/classes/_FrontController.php?Edit:This is my file:override/classes/FrontController.php <?php class FrontController extends FrontControllerCore { public function pagination($nbProducts = 12) { if (!self::$initialized) $this->init(); $nArray = (int)(Configuration::get('PS_PRODUCTS_PER_PAGE')) != 12 ? array((int)(Configuration::get('PS_PRODUCTS_PER_PAGE')), 12, 24, 36, 48, 60) : array(12, 24, 36, 48, 60); asort($nArray); $this->n = abs((int)(Tools::getValue('n', ((isset(self::$cookie->nb_item_per_page) AND self::$cookie->nb_item_per_page >= 12) ? self::$cookie->nb_item_per_page : (int)(Configuration::get('PS_PRODUCTS_PER_PAGE')))))); $this->p = abs((int)(Tools::getValue('p', 1))); $range = 2; /* how many pages around page selected */ if ($this->p < 0) $this->p = 0; if (isset(self::$cookie->nb_item_per_page) AND $this->n != self::$cookie->nb_item_per_page AND in_array($this->n, $nArray)) self::$cookie->nb_item_per_page = $this->n; if ($this->p > ($nbProducts / $this->n)) $this->p = ceil($nbProducts / $this->n); $pages_nb = ceil($nbProducts / (int)($this->n)); $start = (int)($this->p - $range); if ($start < 1) $start = 1; $stop = (int)($this->p + $range); if ($stop > $pages_nb) $stop = (int)($pages_nb); self::$smarty->assign('nb_products', $nbProducts); $pagination_infos = array( 'pages_nb' => (int)($pages_nb), 'p' => (int)($this->p), 'n' => (int)($this->n), 'nArray' => $nArray, 'range' => (int)($range), 'start' => (int)($start), 'stop' => (int)($stop) ); self::$smarty->assign($pagination_infos); } } Its ok?ps. My English is very weak but i understand very well ;] Link to comment Share on other sites More sharing options...
rocky Posted April 4, 2011 Share Posted April 4, 2011 Yes, that's right. Leave _FrontController.php alone. It's used for debugging only. Link to comment Share on other sites More sharing options...
fbloom Posted February 28, 2012 Share Posted February 28, 2012 Hi, i tried to change frontcontroller in overrides, like explained, but without success, it works but just when i enter the category, if i go to second page throught pagination. It displays me in dropdown these values 12,10,20,50. Any idea why ? I m using Prestashop version 1.4.6.2. Thanks in advance Link to comment Share on other sites More sharing options...
Bibi40k Posted May 9, 2012 Share Posted May 9, 2012 hi, how do i apply the change right from the dropdown with "onchange" function instead OK button ? Link to comment Share on other sites More sharing options...
CartExpert.net Posted May 9, 2012 Share Posted May 9, 2012 Hi, remove the OK button, in the <select> put onchange="$("#pagination.form").submit()" Link to comment Share on other sites More sharing options...
itrends Posted October 24, 2012 Share Posted October 24, 2012 (edited) Edit line 3 of pagination.php to change the dropdown values: $nArray = intval(Configuration::get('PS_PRODUCTS_PER_PAGE')) != 10 ? array(intval(Configuration::get('PS_PRODUCTS_PER_PAGE')), 10, 20, 50) : array(10, 20, 50); This code checks whether the products per page set on the Preferences > Products tab is 10. If it is, it displays 10, 20 and 50, otherwise it displays the products per page set on the Preferences > Products tab, then 10, 20 and 50. thanks it worked perfect in PrestaShop™ 1.4.7.3 Edited October 24, 2012 by itrends (see edit history) Link to comment Share on other sites More sharing options...
mentalspot Posted March 19, 2013 Share Posted March 19, 2013 Hello, does the code work with 1.5.2 ? Link to comment Share on other sites More sharing options...
Innar.Hunt Posted November 12, 2013 Share Posted November 12, 2013 Hi folks, How do add an option "All" to pagination? Using PS 1.5.4.1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now