Jump to content
mpouliot34

Change the product view item cout back office

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

 

:)

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

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