-
Notifications
You must be signed in to change notification settings - Fork 8
Page mode not remembered correctly when using ajax filtering #17
Comments
Hello, Thanks for reporting, I am not sure what you mean by switching to page mode, to clarify, do you mean that the p parameter is not correct when switching between pages of a category product list view? Namely when on page 1 then go to page 3 and the pager urls are incorrect? If this is the case then I noticed this as well and have a fix for it, we will problably roll this out in this week. If not what do you mean by "switch the product page mode"? With kind regards |
With switching the page mode I mean switching from grid to list or vice versa, I added this in the ticket to clarify. |
The problem here is that the history cache key does not include the state of the page (page mode, selected sorting, sort order, and sometimes also the page (page 1 for example)). So currently when requesting a page which is already in the cache, it will show the state of the page when it was saved to the cache and not necessarily the current state. So if the page was cached in grid view, it will always show the grid view when requesting that page again. So what i think needs to be done is adding the state to the history cache key. Another problem that will arise when the history cache key is updated with the current state, is that the state in the Magento session is not updated. For example when page 4 is in the cache with 2 different states, one being page mode grid and the other being page mode list. When switching between these pages, no Ajax call will be done (which is logical because they are cached). But the problem here is that when going to page 5, the Magento session contains the display mode of the last Ajax request and uses this display mode to render page 5. So it could happen that you are on page 4 with the grid view, and then end up with the list view on page 5. To fix this i think the Ajax request should always provide the current state (as query paramater) as well which results in updating the session with the correct mode. So basically the state should be managed in Javascript and passed to Magento in each request (and also in the cache key). However, this makes the caching of the request a little complicated and may introduce other bugs in the future. Another option here would be to remove the caching entirely and always execute the request. |
Hello, We noticed that this issue only occurs when extending the linkSelector parameter in the filter_ajax.js (with for instance the page mode selector), and that by default page mode switching and page selection with ajax does not seem to be supported in the module. So basically this is not a bug but a feature request. Sorry for the misunderstanding. |
Issue Brief
On product list pages with ajax filtering enabled, the page mode (grid and list) is not always remembered correctly.
Environment
Steps to reproduce
Actual result
Expected result
The text was updated successfully, but these errors were encountered: