AnGe7 Posted August 2, 2023 Share Posted August 2, 2023 Hello, Just to explain how to add new dropdown to display X products per page : 1. Open `classes/controller/ProductListingFrontController.php` Line 379, you will see : $searchVariables = array( 'result' => $result, 'label' => $this->getListingLabel(), 'products' => $products, 'sort_orders' => $sort_orders, 'sort_selected' => $sort_selected, Add this code after sort_selected line. 'results_per_page' => [Configuration::get('PS_PRODUCTS_PER_PAGE'), 48, 72], 'results_per_page_selected' => $resultsPerPage, (just replace 48 & 72 by your differents options) 2. Open your themes/XXXXX/templates/catalog/_partials/sort-orders.tpl At the end of this file add : <span class="col-sm-3 col-md-3 hidden-sm-down sort-by">{l s='Results per page:' d='Shop.Theme.Global'}</span> <div class="{if !empty($listing.rendered_facets)}col-sm-9 col-xs-8 col-sp-12 {else}col-sm-12 col-xs-12{/if} col-md-9 dropdown"> <button class="btn-unstyle select-title" rel="nofollow" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> {if isset($listing.results_per_page_selected)}{$listing.results_per_page_selected}{else}{l s='Select' d='Shop.Theme.Actions'}{/if} <i class="material-icons float-xs-right"></i> </button> <div class="dropdown-menu"> {foreach from=$listing.results_per_page item=results_to_display} <a rel="nofollow" href="?{$ordering}resultsPerPage={$results_to_display}" class="select-list {['current' => $listing.results_per_page_selected, 'js-search-link' => true]|classnames}"> {$results_to_display} </a> {/foreach} </div> </div> Done (Please adapt the HTML style to your template) 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