Jump to content

Back office Pagination Prestashop 1.7.6.1


laurent0071
 Share

Recommended Posts

Hello,

The new pagination numbers on the back office of Prestashop 1.7.6.1 is very low.

We cannot display more than 100 products / categories on the back office

Before it was possible to display up to 1000 products / categories in the back office

Someone knows where can I change these numbers, I need to increase them.

I have already tried:

/classes/controller/AdminController.php

    /** @var array Number of results in list per page (used in select field) */
    protected $_pagination = array(20, 50, 100, 300, 1000);

    /** @var int Default number of results in list per page */
    protected $_default_pagination = 50;

 

It"s not helping, also you can see that the pagination of this line is not what is displayed in the back office.

 

Thanks

pagination.png

Share this post


Link to post
Share on other sites

  • 4 months later...
  • 6 months later...

In PS 1.7 that select field is in a TWIG template here: /src/PrestaShopBundle/Resources/views/Admin/Common/pagination.html.twig

You find the code of the select, then you add custom options after the "for" cycle, like this (I added 500 and 1000):

        <select name="paginator_select_page_limit" id="paginator_select_page_limit" psurl="{{ changeLimitUrl }}" class="pagination-link custom-select">
          {% if limit not in limit_choices %}
            <option value="{{ limit }}" selected="selected">{{ limit }}</option>
          {% endif %}
          {% for limit_choice in limit_choices %}
            <option value="{{ limit_choice }}" {% if limit==limit_choice %}selected="selected"{% endif %}>{{ limit_choice }}</option>
          {% endfor %}
          <option value="500">500</option>
          <option value="1000">1000</option>
        </select>

But this is a dirty hack of the Core file in Prestashop, eventually overridden by a future Prestashop update. The proper way to override TWIG templates is explained in this page: https://devdocs.prestashop.com/1.7/modules/concepts/templating/admin-views/

So, we need to make a module to override the admin views. You are lucky, I made a little module for this, and you can download it here. This is useful to override other admin templates too, you just have to copy the files with the right folder structure inside the "views" folder.

overrideviews.zip

  • Like 5
  • Thanks 1

Share this post


Link to post
Share on other sites

  • 4 months later...
  • 4 weeks later...
Am 29.7.2020 um 8:41 PM schrieb zod:

But this is a dirty hack of the Core file in Prestashop, eventually overridden by a future Prestashop update. The proper way to override TWIG templates is explained in this page: https://devdocs.prestashop.com/1.7/modules/concepts/templating/admin-views/

So, we need to make a module to override the admin views. You are lucky, I made a little module for this, and you can download it here. This is useful to override other admin templates too, you just have to copy the files with the right folder structure inside the "views" folder.

overrideviews.zip 10.16 kB · 33 downloads

Hi, is it compatible with Prestashop 1.7.7.1 and Prestashop 1.7.2.4?

Edited by Viaceslav (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

  • 2 weeks later...
  • 1 month later...

Hi everyone !

I think there is no need to change core files or override templates.

prestashop 1.7 provides for paginations by 300 and 1000 but they are constrained by your php configuration.

Take a look:

/src/Adapter/Product/AdminProductDataProvider.php 

image.png.813ebfafbff36813353e0742a358a41c.png

I think you have to check your php configuration and the memoru limit allocate to php.

hope this helps someone.

 

Edited by jef933 (see edit history)
  • Thanks 1

Share this post


Link to post
Share on other sites

vor 11 Stunden schrieb jef933:

Hi everyone !

I think there is no need to change core files or override templates.

prestashop 1.7 provides for paginations by 300 and 1000 but they are constrained by your php configuration.

Take a look:

/src/Adapter/Product/AdminProductDataProvider.php 

image.png.813ebfafbff36813353e0742a358a41c.png

I think you have to check your php configuration and the memoru limit allocate to php.

hope this helps someone.

 

Hi!

The first number in $memory is the php memory limit but what do the second and third numbers mean?

I mean * 1024 * 1024.

Share this post


Link to post
Share on other sites

19 minutes ago, Viaceslav said:

Hi!

The first number in $memory is the php memory limit but what do the second and third numbers mean?

I mean * 1024 * 1024.

Hi Viaceslav,

It's to convert Mb in octets. 

Look at

/classes/Tools.php

image.png.13d95afadc036f3b24aae84e53605c0a.png

 

image.png

 

 

Edited by jef933 (see edit history)

Share this post


Link to post
Share on other sites

  • 4 weeks later...
  • 11 months later...

Hello, I have try to change /classes/controller/AdminController.php with the code up but I have a 500 error in front office and in product page.
I have prestashop 1.7.7.3 and multistore.

I have activating the debug mode and I have this error:

Notice: Undefined property: Shop::$id_theme

 

please, someone can help me?

 

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