nathanielleee Posted April 29, 2014 Share Posted April 29, 2014 On the product categories page. Prestashop 1.6 default theme has a button "show all" so that customers dont have to scroll through 25 pages. The problem is, when someone clicks this it just resets to the same page that it was on it doesnt not show all. Ive run this test on firefox, IE, and Safari. Is there a fix for this? Link to comment Share on other sites More sharing options...
vekia Posted April 29, 2014 Share Posted April 29, 2014 "show all" it's not a default prestashop feature you developed it? or ... ? or what? Link to comment Share on other sites More sharing options...
venereo Posted April 30, 2014 Share Posted April 30, 2014 I can confirm that, it is not working Link to comment Share on other sites More sharing options...
vekia Posted April 30, 2014 Share Posted April 30, 2014 hello can you share url to your website, please? i will inspect it. Link to comment Share on other sites More sharing options...
venereo Posted April 30, 2014 Share Posted April 30, 2014 (edited) default theme, pagination.tpl: <form method="get" action="http://troikos.pt/25-last-kings" class="showall"> <div> <button class="btn btn-default button exclusive-medium" type="submit"> <span>Show all</span> </button> <input type="hidden" value="25" name="id_category"> <input value="28" class="hidden" id="nb_item" name="n"> </div> </form> after submit: http://troikos.pt/25-last-kings?id_category=25&n=28 but still only 12 products showing Edited April 30, 2014 by venereo (see edit history) Link to comment Share on other sites More sharing options...
venereo Posted April 30, 2014 Share Posted April 30, 2014 (edited) It seems it's still using the value from the cookie and not respecting the n parameter passed.... maybe here? classes/controller/FrontController.php: // Retrieve the current number of products per page (either the default, the GET parameter or the one in the cookie) $this->n = $default_products_per_page; if ((int)Tools::getValue('n') > 0 && in_array((int)Tools::getValue('n'), $nArray)) $this->n = (int)Tools::getValue('n'); elseif (isset($this->context->cookie->nb_item_per_page) && in_array($this->context->cookie->nb_item_per_page, $nArray)) $this->n = (int)$this->context->cookie->nb_item_per_page; edit: $nArray = array($default_products_per_page, $default_products_per_page * 2, $default_products_per_page * 5); $this->n being in $nArray is pure luck, so changing if ((int)Tools::getValue('n') > 0 && in_array((int)Tools::getValue('n'), $nArray)) to if ((int)Tools::getValue('n') > 0 || in_array((int)Tools::getValue('n'), $nArray)) fixes the problem, but i'm not sure if it's the perfect solution. Edited April 30, 2014 by venereo (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted April 30, 2014 Share Posted April 30, 2014 it's impossible to check website because it's under maintenance mode Link to comment Share on other sites More sharing options...
venereo Posted April 30, 2014 Share Posted April 30, 2014 (edited) it's impossible to check website because it's under maintenance mode check my above posts, the buggy line is this one from FrontController.php: if ((int)Tools::getValue('n') > 0 && in_array((int)Tools::getValue('n'), $nArray)) https://github.com/PrestaShop/PrestaShop/blob/1.6/classes/controller/FrontController.php#L893 edit: at github it's already fixed Edited April 30, 2014 by venereo (see edit history) Link to comment Share on other sites More sharing options...
cat1999 Posted May 1, 2014 Share Posted May 1, 2014 edit: at github it's already fixed This fix only works if you are on the initial category page. If you navigate to page 2 for example and then select view all, it takes you to page 1 and does not showall :-( Any other fixes out there? Link to comment Share on other sites More sharing options...
nathanielleee Posted May 1, 2014 Author Share Posted May 1, 2014 my website is www.ApostolicClothing.com sorry. Link to comment Share on other sites More sharing options...
venereo Posted May 1, 2014 Share Posted May 1, 2014 (edited) This fix only works if you are on the initial category page. If you navigate to page 2 for example and then select view all, it takes you to page 1 and does not showall :-( Any other fixes out there? try my fix above http://www.prestashop.com/forums/topic/327112-show-all-feature-on-page-does-not-work/?do=findComment&comment=1656144 Edited May 1, 2014 by venereo (see edit history) Link to comment Share on other sites More sharing options...
nathanielleee Posted May 1, 2014 Author Share Posted May 1, 2014 when you say "the fix" what do you mean because i cant find that line in frontcontroller.php try my fix above http://www.prestashop.com/forums/topic/327112-show-all-feature-on-page-does-not-work/#entry16561 1 Link to comment Share on other sites More sharing options...
venereo Posted May 1, 2014 Share Posted May 1, 2014 This line: @https://github.com/PrestaShop/PrestaShop/blob/1.6/classes/controller/FrontController.php#L893 Link to comment Share on other sites More sharing options...
SandrGitar Posted May 27, 2014 Share Posted May 27, 2014 (edited) I tried both fixes and neither work. Any other suggestions? My site is www.gitar.be/shop... Thanks! EDIT: The code i have is: // Retrieve the current number of products per page (either the default, the GET parameter or the one in the cookie) $this->n = $default_products_per_page; if ((int)Tools::getValue('n') > 0 && in_array((int)Tools::getValue('n'), $nArray)) $this->n = (int)Tools::getValue('n'); elseif (isset($this->context->cookie->nb_item_per_page) && in_array($this->context->cookie->nb_item_per_page, $nArray)) $this->n = (int)$this->context->cookie->nb_item_per_page; I tried swapping it out but no change... Edited May 27, 2014 by SandrGitar (see edit history) Link to comment Share on other sites More sharing options...
ashadweb Posted June 25, 2014 Share Posted June 25, 2014 Wow Thanks It fixed mine Thanks alot, Any idea how to show lowest to highest default in the product list page? Ash check my above posts, the buggy line is this one from FrontController.php: if ((int)Tools::getValue('n') > 0 && in_array((int)Tools::getValue('n'), $nArray)) https://github.com/PrestaShop/PrestaShop/blob/1.6/classes/controller/FrontController.php#L893 edit: at github it's already fixed Link to comment Share on other sites More sharing options...
ashadweb Posted July 3, 2014 Share Posted July 3, 2014 I have a small problem, When I click show all for the first time it works. But after clicking a left filter it doesnt show all. It says Showing 1 - 27 of 27 items But it doesn't actually. Click - show all http://bit.ly/SIsKOH And then select Smart/3D - It only shows 20 not all 34. any ideas? Link to comment Share on other sites More sharing options...
cyremia Posted September 2, 2014 Share Posted September 2, 2014 If that happens to anyone else, this fix worked for me: https://github.com/PrestaShop/PrestaShop/commit/ddfba4cd7d5589e85986a6617a672697119fbc89 1 Link to comment Share on other sites More sharing options...
vekia Posted September 2, 2014 Share Posted September 2, 2014 thank you for this github commit i checked it and i can confirm fix works well :-) Link to comment Share on other sites More sharing options...
Alugart Posted September 9, 2014 Share Posted September 9, 2014 I tried to make all the changes which are proposed in the thread, at first glance - the problem seems fixed. But when I press show all button, return to homepage, and then return to the catalogue again, it says that as if 1-60 items are showing (and there is no show all button), but in fact it displays only 20. Basically it is the same problem that ashadweb has. Anyone has answers for this? Btw, I checked nathanielle website: www.ApostolicClothing.com And it seems he somehow found a way to completely solve this SHOW ALL button problem..... >.< Link to comment Share on other sites More sharing options...
Alugart Posted September 10, 2014 Share Posted September 10, 2014 I found a solution to above mentioned problem here: https://github.com/PrestaShop/PrestaShop/commit/f063d4ae3c423359615f5fa4ec903f5ef27f8b47 Works perfect! Link to comment Share on other sites More sharing options...
gruvin Posted September 23, 2014 Share Posted September 23, 2014 None of that worked for me. The last one even does Show All always, with no option. Here's my solution, which does work for me (commencing at was was line 893, before the GitHub changes noted above) ... // Retrieve the current number of products per page (either the default, the GET parameter or the one in the cookie) $this->n = $default_products_per_page; if ((int)Tools::getValue('n') > 0 || in_array((int)Tools::getValue('n'), $nArray)) $this->n = (int)Tools::getValue('n'); elseif (isset($this->context->cookie->nb_item_per_page) && in_array($this->context->cookie->nb_item_per_page, $nArray)) $this->n = (int)$this->context->cookie->nb_item_per_page; else { // Retrieve the page number (either the GET parameter or the first page) $this->p = (int)Tools::getValue('p', 1); // If the parameter is not correct then redirect (do not merge with the previous line, the redirect is required in order to avoid duplicate content) if (!is_numeric($this->p) || $this->p < 1) Tools::redirect(self::$link->getPaginationLink(false, false, $this->n, false, 1, false)); } (Sorry about the weird font and colors. I doesn't look horrid like this when I paste the code into the editor.) This code is a combination of the first solution offered above (which works only on page 1) plus an extra else { ... } wrapper around "Retrieve page number" code, to prevent that happening at all if n is present, since p= seems to override n= in all cases otherwise. This then, works from page 1 AND pages 2 ... last. Link to comment Share on other sites More sharing options...
Alvarosc Posted October 1, 2014 Share Posted October 1, 2014 (edited) I've tried all the solutions in the thread and none of them worked. Can anyone confirm me a solution that solve the problem? Thanks!! Regards Edited October 24, 2014 by Alvarosc (see edit history) Link to comment Share on other sites More sharing options...
rtvt Posted October 29, 2014 Share Posted October 29, 2014 (edited) Same problem. None of solutions works. When you click on page 2,3 ot other and then click SHOW ALL - it redirect you to 1 page. Also with layrered navigation block same problem, if you change any of filter - show all button not works. Please I need help. PS version 1.6.0.9 All modules updated. Edited October 29, 2014 by RoyVelvet (see edit history) Link to comment Share on other sites More sharing options...
rtvt Posted October 29, 2014 Share Posted October 29, 2014 Finally I found out solution for me. None of Frontcontroller or pagination.tpl modifications helps. Just don't touch it. Only this link helped me. https://raw.githubusercontent.com/PrestaShop/PrestaShop/1a55226db119527092aa1132903fd66834abac6d/themes/default-bootstrap/js/modules/blocklayered/blocklayered.js Just put it to yourshopsolder/themes/yourtheme/js/modules/blocklayered/blocklayered.js Also update blocklayered module if you have old version. Thats it! It solves problem with SHOW ALL button from 2,3, etc pages, also solves any problems with layered navigation block and pagination. Link to comment Share on other sites More sharing options...
Alvarosc Posted November 26, 2014 Share Posted November 26, 2014 Finally I found out solution for me. None of Frontcontroller or pagination.tpl modifications helps. Just don't touch it. Only this link helped me. https://raw.githubusercontent.com/PrestaShop/PrestaShop/1a55226db119527092aa1132903fd66834abac6d/themes/default-bootstrap/js/modules/blocklayered/blocklayered.js Just put it to yourshopsolder/themes/yourtheme/js/modules/blocklayered/blocklayered.js Also update blocklayered module if you have old version. Thats it! It solves problem with SHOW ALL button from 2,3, etc pages, also solves any problems with layered navigation block and pagination. Hi, thanks!! What are the changes? I don't want to overwrite the file, I prefer to add/modify the changes directly. Regards Link to comment Share on other sites More sharing options...
CarpalWatch.com Posted February 3, 2015 Share Posted February 3, 2015 It also does not work when you have more than 153 items in the category. Link to comment Share on other sites More sharing options...
Recommended Posts