Jump to content

Issue with pagination in custom module


Recommended Posts

Hi all,

Maybe someone has an idea what I am missing.

I developed a custom module that on one page shows a list of products (like category listings etc. do). I also made use of  the pagination template from core and it basically works well. Except for one thing: When I switch between the pagination-pages, the view does not get updated.

In the browser and Dev-Tools, I can see the URL changing to the correct address (having the page=N parameter set correctly) and I can see the Ajax call being made and returning the values of the correct targeted page. But the view itself, while it seems to be re-rendered, still displays the previous page. This includes any content, the products listed and the pagination bar.

Do I need to add some Javascript or no-cache header to make the view update? When I manually click on the browsers refresh button, the page gets updated and displays the correct products and page.

Thanks for any hint,
Stefan

Tech-Info: 

  • PrestaShop-Version 8.0.4
  • PHP 8.2.22
  • MariaDB 10
  • Debian 10
Link to comment
Share on other sites

Sorry, but I don't understand. I am using the Prestashop core pagination mechanism (by extending ProductListingFrontController) and Ajax works fine. Only after fetching the new results, the page does not seem to be updated.

What JS/CSS do I need?

Thanks,
Stefan

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

Ok, so I solved my issue. The problem was that the pagination mechanism (AJAX) as provided by the ProductListingFrontController class requires specific partial templates and/or tags with pre-defined (hard coded) id attributes. Took me a while to figure it out, but now it works.

I'll publish the module later this year on Github, so it might be easier for others to use pagination as given by core.

Cheers,
Stefan

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...