Jump to content

prestashop 1.7 show all products in category page


esterflore1@yhoo.it
 Share

Recommended Posts

hello

this is possible but it can affect performance, especially if you have a lot of products associated with viewed category.

 

 

you can increase value under "shop parameters > product" section in back office.

there is a section "pagination". just change "products per page" value

n1ExZb7.png

Share this post


Link to post
Share on other sites

  • 5 months later...

Hi, regarding this topic: There was a frontend feature in 1.6 to let the customer chose how many products per page they wanted to show.... this is no longer available in 1.7 :( - Can this be somehow coded manually? I'd really be happy to have this feature back, and our customers too.....

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 3 weeks later...

Hey all,

 

I just re-added this feature to my 1.7 shop. It's actually not that difficult to do. Here's how I did it. I assume the default classic theme is used, so modify accordingly.

 

1. Open the file themes/{theme}/templates/_partials/pagination.tpl

2. There are two divs with class col-md-4 and col-md-6. In my case, I changed the first one from col-md-4 to col-md-3

3. Create a div between those two with class col-md-3 (or some other size, depending on your choice/design)

4. In that div, add a label and a select with choices. What I did, was I copied a styled select box from the theme I used and this is what I got:

<label style="float:left;margin-right: 15px" class="form-control-label hidden-sm-down sort-label">{l s='Products per page:'}</label>
<div style="float:left;" class="sort-select dropdown js-dropdown">
    <a class="custom-select select-title" rel="nofollow" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
        {$results_per_page}
    </a>
    <div class="dropdown-menu">
        <a rel="nofollow" href="?{$ordering}resultsPerPage=25" class="dropdown-item js-search-link">
            25
        </a>
        <a rel="nofollow" href="?{$ordering}resultsPerPage=50" class="dropdown-item js-search-link">
            50
        </a>
        <a rel="nofollow" href="?{$ordering}resultsPerPage=75" class="dropdown-item js-search-link">
            75
        </a>
        <a rel="nofollow" href="?{$ordering}resultsPerPage=100" class="dropdown-item js-search-link">
            100
        </a>
    </div>
</div>

5. You will notice {$ordering} and {$results_per_page} variables. Add this code to the top of the template to handle them:

    {if !empty($smarty.get.order)}
        {capture assign='ordering'}order={$smarty.get.order}&{/capture}
    {else}
        {assign var='ordering' value=''}
    {/if}

    {if !empty($smarty.get.resultsPerPage)}
        {assign var='results_per_page' value=$smarty.get.resultsPerPage}
    {else}
        {assign var='results_per_page' value=25}
    {/if}

6. Either modify (not recommended) or override classes/controller/ProductListingFrontController.php.

7. Modify the line in the getProductSearchVariables() method which looks like this:

if ($resultsPerPage <= 0 || $resultsPerPage > 36) {
    $resultsPerPage = Configuration::get('PS_PRODUCTS_PER_PAGE');
}

to this:

if ($resultsPerPage <= 0 || $resultsPerPage > 100) {
    $resultsPerPage = Configuration::get('PS_PRODUCTS_PER_PAGE');
}

The only change is the maximum number (from 36 to 100). In my case it's 100, if in your case 36 is enough, then no modification is needed.

8. That's it!

Edited by Tsynique (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

  • 3 years later...

Hello !
Thanks for this tutorial
How I can do formulaire.7.6.4 ?
This code is not working :(
The value {capture assign='ordering'}order={$smarty.get.order}&{/capture} is not working


Many thanks

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

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