Jump to content

Change the product view item cout back office


mpouliot34

Recommended Posts

Hello

 

PrestaShop version: 1.6.0.6

Current theme in use: default-bootstrap

 

I am wondering where I can change the default display value of products in the product list view.

I know I can change the item count at the bottom but whenever I log out and back in it does not show by default.

I would like to at lease see for example 200 items when I load the section.

 

On the same section I am also wondering if it is possible to NOT display items that are not in stock by default. 

 

Thanks

 

:)

Link to comment
Share on other sites

The number of products per page dropdown in the Back Office is populated using line 119 of classes/AdminTab.php:

    protected $_pagination = array(20, 50, 100, 300, 1000);

The second value in this array is chosen as the default.

 

You can change that by creating override/classes/AdminTab.php with the following:

<?php

class AdminTab extends AdminTabCore
{
    public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0, $limit = null, $id_lang_shop = false)
    {
        if (empty($limit)) {
            $limit = ((!isset($this->context->cookie->{$this->table.'_pagination'})) ? $this->_pagination[2] : $limit = $this->context->cookie->{$this->table.'_pagination'});
        }

        parent::getList($id_lang, $orderBy, $orderWay, $start, $limit, $id_lang_shop);
    }
}

This changes $this->_pagination[1] to $this->pagination[2], which causes the third item to be selected by default. Remember to go to Advanced Parameters > Performance and click the "Clear cache" button (or manually delete cache/class_index.php) so that PrestaShop can find the override.

 

Unfortunately, your second request is not so easy, since PrestaShop v1.6 only lets you filter by a specific value. Luckily, PrestaShop v1.7 lets you filter by a range, so it will be easy to do when you upgrade in the future.

Link to comment
Share on other sites

  • 1 year later...
  • 7 months later...
On 4/10/2018 at 12:41 AM, gray said:

Any ideas if the can be done in v1.7

FOR 1.7

The only way i found that work is by doing something like that:

2089381187_codechange.PNG.d56251690fbb9a223b0f48ebb24ff49e.PNG

I dont get it how it works but it makes the point :D
I use Firefox and thats the code inspector...
that object can be found at the box with selection of the default numbers 20, 50, 100, 300


 

screen4.PNG

screen3.PNG

screen2.PNG

Link to comment
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
×
×
  • Create New...