Jump to content

Recommended Posts

What you're pointing at allows anyone to change any one option for the end user. My client's requirement is for the end user to be able to select from "5, 10, 25, 50, all". Anyone have any thoughts on this?

Share this post


Link to post
Share on other sites

You want to post me a link?

I want to overwrite this line in pagination.php, but I don't want to hack the core. I also want to provide a "view all" option.

$nArray = intval(Configuration::get('PS_PRODUCTS_PER_PAGE')) != 10 ? array(intval(Configuration::get('PS_PRODUCTS_PER_PAGE')), 9, 18, 27) : array(9, 18, 27);

Share this post


Link to post
Share on other sites
  • 6 months later...

PrestaShop's function require you to specify a number of products. Without modifying core PrestaShop code, the best you could do is add an option for 1000000 products and give it the label "All". Just choose a number that is no less than the maximum number of products you have in any category. Add the following code on line 60 of pagination.tpl in your theme's directory (before the {/foreach}):

{l s='All'}

  • Like 1

Share this post


Link to post
Share on other sites

Hi Rocky,

Thanks for the help!

Your solution makes perfect sense and it's a great little "hack" as one does have to modify core code.

Your suggestion tells me to add it at line 60 but there is no /foreach. My line 60 = {foreach from=$requestNb item=requestValue key=requestKey}

Thus, I am just struggling to place it exactly so that it works... The best I can do is:


<form action="{if !is_array($requestNb)}{$requestNb}{else}{$requestNb.requestUrl}{/if}" method="get" class="pagination">


               {if isset($query) AND $query}<input type="hidden" name="search_query" value="{$query|escape:'htmlall':'UTF-8'}" />{/if}
               {if isset($tag) AND $tag AND !is_array($tag)}<input type="hidden" name="tag" value="{$tag|escape:'htmlall':'UTF-8'}" />{/if}
               <input type="submit" class="button_mini" value="{l s='OK'}" />
{l s='items:'}

               {foreach from=$nArray item=nValue}
{$nValue|escape:'htmlall':'UTF-8'}
{l s='All'}
               {/foreach}

               {if is_array($requestNb)}
                   {foreach from=$requestNb item=requestValue key=requestKey}
                       {if $requestKey != 'requestUrl'}
                           <input type="hidden" name="{$requestKey|escape:'htmlall':'UTF-8'}" value="{$requestValue|escape:'htmlall':'UTF-8'}" />
                       {/if}
                   {/foreach}
               {/if}

       </form>




Which inserts "All" after every product amount in the drop down... Please see attached image as example.

23543_sOWfpXk2A0vGC0idaHA8_t

Share this post


Link to post
Share on other sites

Woot!

I put it in the right place and voila, Success!

Rocky does it again!
Thanks a bunch for this incredibly simple yet valuable hack.

Regards.

Share this post


Link to post
Share on other sites
  • 2 months later...

Is it possible to use:

$n == 1000



in product-list.tpl directly, so it will load specified number of products automatically?
Reason for this: i use 2 types of product-list.tpl's. And i still want to keep settings as set in BO for my original product-list.tpl

Tnx.

Share this post


Link to post
Share on other sites
  • 2 weeks later...

So you want all the category links to display the all products option? You can do that by changing line 2 of modules/blockcategories/category-tree-branch.tpl from:

<a href="{$node.link|escape:html:'UTF-8'}" {if $node.id == $currentCategoryId}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}



to:

<a href="{$node.link|escape:html:'UTF-8'}?n=1000000" {if $node.id == $currentCategoryId}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}



This code will only work if you have friendly URLs turned on. If you have it off, you'll need to change ?n=1000000 to &n=1000000. Also, change the value of n to whatever value you chose for the "All" option.

Share this post


Link to post
Share on other sites

Hi thanks for that but its more of a single link that will be place at the top of a category page that a user can click to then show all if required. how would I change what you have given me to something like that?

Share this post


Link to post
Share on other sites

@willrose84:

It's a bit of a dirty way of doing it but it works...

Add the following code to your themes pagination.tpl:

[removed]
[removed] ("View All")
[removed]



That should do the trick! (you'll need to change the & to ? if you have friendly urls enabled)

EDIT: Whoops, the forum strips the code, check here: http://pastebin.com/raw.php?i=HjmFEYGQ

I added mine before the last UL.

Share this post


Link to post
Share on other sites
  • 1 month later...

Hello, I'd like to remove the pagination dropdown values on the Front Office product lists completely for all categories, without touching the core.

I checked the pagination.php, the pagination.tpl and found some unorthodox ways to do it, but I'm sure there's is an easier way.

Is that possible ? If it is, please provide me with a link to an already existing thread on the forums, as I couldn't find one except this one, or please give me some help. I'm a beginner. :red:

Share this post


Link to post
Share on other sites

Thanks Rocky, it's almost what I'd like to do. But, I'd like to keep the previous and next buttons, and the page numbers.

It's just the drop down menu in the lower right corner of each category page that I would like to remove or at least, remove any other options than having 8 products on the page because I use a fixed webdesign.

Share this post


Link to post
Share on other sites
  • 1 month later...
That's because you put the code on the wrong line. Move it down a line (after the {/foreach}).


thanks as usual, rocky. that did the trick to me. great to have the 'all' feature.

while mentioned all, this is for all: is there a possibility to get rid of the dropdown here and have the dropdown rather in a line, e.g. "3 | 9 | 12 | all products per page" in a row next to each other and you can click the numbers?

phil

Share this post


Link to post
Share on other sites
See my post here that converts the product sort options into links. You can do a similiar thing in pagination.tpl with the options there.


oh, thanks. though I am afraid that this exceeds my transfer capabilities to apply this to the drop down ;). May try this once I have a local installation, so far all is online and live. I know, bad. But still haven't figured out how to actually install PS with e.g. WAMP... but that is a topic for another forum.

phil

Share this post


Link to post
Share on other sites
  • 4 weeks later...

Hi,

I have the code below...

addSortDetails($request, 'position', $orderwayposition)|escape:'htmlall':'UTF-8'}">{l s='--'}
addSortDetails($request, 'price', 'asc')|escape:'htmlall':'UTF-8'}">{l s='Price: Lowest First/'}
addSortDetails($request, 'price', 'desc')|escape:'htmlall':'UTF-8'}">{l s=' Highest First -'}
addSortDetails($request, 'name', 'asc')|escape:'htmlall':'UTF-8'}">{l s='Name: A to Z /'}
addSortDetails($request, 'name', 'desc')|escape:'htmlall':'UTF-8'}">{l s=' Z to A, '}
addSortDetails($request, 'all')|escape:'htmlall':'UTF-8'}">{l s=' Z to A, '} 



Is there any way to add on a "View All" button? just on the line below this^^...

Then even if I want to go back to the dropdown the "View All" button still stays!

Cheers guys!

Share this post


Link to post
Share on other sites
  • 11 months later...

Hi,

 

Does anyone of you know the code to add the "show all products" function to the pagination in Prestashop 1.4.5.1? I'm asking because I can't see the code snippet that Rocky provided a while ago (see post #9) , there's only white space, no code ...

 

Thanks for your help guys!

Tom

Share this post


Link to post
Share on other sites
  • 2 years later...

Hey guys,

 

I know it´s an old post but I search for this since some days...

I can delete all of the code in the pagination.tpl in my themes folder but nothing happens.

The "x articles per pages" should be away or the whole side should be destroyed right?

Any change on all paginagion.tpl files I can find affect nothing.

So what fil is it in Prestashop 1.5.5.0 to change for this "problem"?

Share this post


Link to post
Share on other sites

Ok I´ve found where to put the code from post #9.

It´s the "nbr-product-page.tpl".

But I still can´t find where to set the 10 and 20 to 18 and 27... (I have 3 columns)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More