News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Virtuemart Pagination bug

Started by FusionNetwork, June 03, 2019, 12:12:24 PM

Previous topic - Next topic

FusionNetwork

Hi,

I think I have found a bug in virtuemart pagination and it is really annoying (clients are loosing money because the user simply can't navigate to some pages) especially when using some sort of cache solution (I am using LiteSpeed cache plugin and very happy with it). The wrong pages are cached and served as wrong. Here some would say "do not use page cache with Virtuemart!!!" Who is on a LiteSpeed server should try it. It is a server side cache solution and the performance is really good.

I've installed a fresh Joomla! and Virtuemart (for this purpose only) and made only two configurations.
- In Virtuemart config - Frontend default items per list view = 3 (to show up pagination)
- In Joomla! config activated "Use URL Rewriting"

Here is the link: http://vm.fusionnetwork.net

Joomla! 3.9.6.
Virtuemart 3.4.2. with sample data installed
There are no other extensions installed.
PHP 7.2.18

Created three links in main menu (for testing purpose) two of them pointing to Virtuemart Categories (Pagination and Attributes) and the first one is for root category showing all products.
Tested With Protostar and vmbeez3 but the error appears in any template since Virtuemart pagination has nothing to do with templates.

Now here is how to replicate the bug.

1. Go from the main menu to "Pagination". Here navigate to the second page (the link will be http://vm.fusionnetwork.net/pagination?start=3)
2. Now navigate from the main menu to any other category for example "Attributes" (link will be http://vm.fusionnetwork.net/attributes)
Now is the interesting part...
3. Hit the Back button of the browser or paste in address bar the first url you navigated (http://vm.fusionnetwork.net/pagination?start=3)
The link says that you are on second page (?start=3) but in reality you are on first page.
4. More on this ... Now the link is (http://vm.fusionnetwork.net/pagination?start=3) but you are actually on first page. Now go from the menu to "Pagination" (the category in which you are and clicking the link in the menu should get you on the first page of that category). This is another interesting error. The link will be http://vm.fusionnetwork.net/pagination but in reality you are on the 2nd page.

Point 4 can be reproduced on http://demo.virtuemart.net. The first 3 I think that to be reproduced it needs to be Menu links to Virtuemart categories (not Virtuemart categories module) and that categories to have pagination.

Hope you find a solution.

Thanks
Regards
Cosmin

jjk

#1
I think you overlooked that you have published 'Featured', 'Latest' and 'Top Ten' product modules on top of the regular category view. You selected to display 3 products per category page and as far as I can see, the pagination works correctly for that.

If you change from one category to a previously viewed category, VM goes back to the page where you left the previously viewed category, but doesn't show the "?start=x" in the url, because it's taken from the cache and the pagination is not recalculated. This is often not easily visible, if the template doesn't highlight the active pagination icon.

Concerning cache usage, please read this: https://docs.virtuemart.net/manual/general-concepts/223-caches.html
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

AH

Quoteespecially when using some sort of cache solution (I am using LiteSpeed cache plugin and very happy with it). The wrong pages are cached and served as wrong. Here some would say "do not use page cache with Virtuemart!!!"

And there is a good reason for such a saying - if you are getting issues with cache - then you should consider testing with it turned off - if the issue remains then you have a problem

If it disappears - then you can talk with the developers regarding caching options.
Regards
A

Joomla 4.4.5
php 8.1

Studio 42

I think that the pagination are get from session, it's not really a cache problem.
I use the same trick in some case when you are in  a product for eg. and go back in the category to reload all filters.
The solutiion is to check if the category is not same as last category and in this case, if "start" is not in the input then set it to 0 to prevent to use value from session.
If the VM Dev team do not want change the behavior, you can check yourself the value and set it using a Jooma system plugin for eg.

FusionNetwork

Hi jjk,

Quote from: jjk on June 03, 2019, 15:00:20 PM
I think you overlooked that you have published 'Featured', 'Latest' and 'Top Ten' product modules on top of the regular category view. You selected to display 3 products per category page and as far as I can see, the pagination works correctly for that.

I've unpublished 'Featured', 'Latest' and 'Top Ten' to be more clear. You are right. I've selected 3 products per page to show up pagination.

Now Enter "Pagination" from main menu, then go to page 7 (link http://vm.fusionnetwork.net/pagination?start=18) and then go from main menu to "Attributes" and now hit back browser button. The link is correct (http://vm.fusionnetwork.net/pagination?start=18) and it is showing ?start=18 but the page 1 is highlighted and the products are from page one... so this is not the previous page the user was.

Regards
Cosmin

FusionNetwork

Quote from: jjk on June 03, 2019, 15:00:20 PM
Concerning cache usage, please read this: https://docs.virtuemart.net/manual/general-concepts/223-caches.html

I've read the general concepts of cache but in this case it has nothing to do with this bug. Wrong cached pages indeed are a result of this bug but that doesn't mean that the cache solution is wrong. LiteSpeed Cache plugin has made improvements to support Virtuemart and it is a nice cache solution. Improvements in performance are great. ESI feature is great.

That being said. Let's try to listen, test and find solutions together. From my opinion (and not only mine) this pagination behavior is wrong.

If a user wants to go back he expects to go back on the page he was not on the previous category but on the first page. Lets say that a user is on the 112 page on category A and from there goes to category B and then realizes that he forgot to add to cart a product from previous page and hits back button. He is taken on that previous category but on the first page. My question is: He should remember the page he was on (112)? No! He should be taken on the previous page and the link and the content of a page should be the same regarding the path to that page.

Thanks,
Regards,
Cosmin

FusionNetwork

Quote from: AH on June 03, 2019, 15:23:46 PM
And there is a good reason for such a saying - if you are getting issues with cache - then you should consider testing with it turned off - if the issue remains then you have a problem

If it disappears - then you can talk with the developers regarding caching options.

The bug is present without LiteSpeed cache enabled. On that demo site it isn't installed.
I found this bug using LiteSpeed cache because pages where cached wrong because of this pagination behavior.
The discussion is not about caching. It is about pagination behavior which indeed leads to wrong cached pages.

Regards
Cosmin

AH

Thank you for the update - I will pass this post on to the devs to ensure at least they see it
Regards
A

Joomla 4.4.5
php 8.1

FusionNetwork

Thanks AH,

I hope devs will fix this bug/error.

Keep up good work!

Regards,
Cosmin

Studio 42

Quote from: FusionNetwork on June 03, 2019, 20:07:48 PM
Thanks AH,

I hope devs will fix this bug/error.

Keep up good work!

Regards,
Cosmin
I'm not sure if this is a bug.
Eg in Google maps when you go history back, you dont expect that all result get cleared and many other situation.
in your case, you say that it's a bug, but in my case, i wrote filters for some customer and they wanted that the filter stay on returning to same category.
Imagine now you have 20 filters with 100000 products and you have to set again all filters to find your specific needs. Is this a bug that the filters and page stay as before ?

AH

Studio 42

I will let the devs decide what they want to do with this behaviour
Regards
A

Joomla 4.4.5
php 8.1

FusionNetwork

#11
Quote from: Studio 42 on June 03, 2019, 21:06:43 PM
I'm not sure if this is a bug.
Eg in Google maps when you go history back, you dont expect that all result get cleared and many other situation.
in your case, you say that it's a bug, but in my case, i wrote filters for some customer and they wanted that the filter stay on returning to same category.
Imagine now you have 20 filters with 100000 products and you have to set again all filters to find your specific needs. Is this a bug that the filters and page stay as before ?

Hi  Studio 42,

About filters I am totally agree with you. If the filters remain checked or not when you browse to another category it is an option. This behavior is good or not in my opinion. I have shops in which the filters remain selected after navigating away from that category and I have other shops that do not "remember" the filter settings after going away from that category. In my opinion it depends on the client's preferences and also depends on what type of products the shop sells.
As I said, this is an option and filtering is not Virtuemart native feature so every developer makes it how he/she thinks is best.

About Virtuemart pagination, which is not a filtering option, is simple pagination yes I see it as a bug or a feature that has been wrong implemented.
Let's assume that are set 3 products per page. A user is on category A, page 2. From there goes to category B and after that decides to go back to Category A page 2 and hits back button. He wants to go back to the page 2 of category A. Right? Well Virtuemart after going back shows the link with ?start=3 that is correct but actually displays page 1 which is not correct. This is not the previous page. What if a user is on page 78, moves away from that category and decides to come back? He will be on first page instead 78.
And more of that which is also a bug from my opinion, we continue the user journey: now the user is on Category A, page 1 but link is for page 2. Right? Ok. Then why if the user clicks on the link in main menu for Category A (in which he is already) Virtuemart now shows the correct link (without ?start=xxx) but the page displayed is the page that user wanted to go back for, in our case page 2 (or 78). This can be seen on official Virtuemart demo site.

Quotethey wanted that the filter stay on returning to same category
This is the problem here. Vm does not "remember" correctly the previous page. It remembers the link but the page is always the first page of that category.

I'll make a movie with all this maybe tomorrow.

Regards
Cosmin

FusionNetwork

Hi all,

An update on this bug.

If "Search Engine Friendly URLs" in Joomla! global config is turned off, the pagination works as it should be.
So this is a bug since you cannot say that pagination is normal to behave in one way with sef urls on and in other way with sef urls off.

Hope the devs would fix this.

Thanks
Regards
Cosmin

FusionNetwork

Another update.

I've updated Virtuemart to version 3.4.5 10040.
The error is partially solved.
The only thing that remains is that if you go to category A page 3 and then navigate to another category (or any other page) and then come back to category A (from the main menu) the link is correct but the page is 3 (the last page you visited on that category). This behavior can be seed on official Virtuemart demo.

I have two questions:
1. It will be solved? Or it is not considered an error/bug? Although is the same thing. Same page with two links.
2. How safe is to run Virtuemart 3.4.5 10040 on live site?

Thanks
Regards
Cosmin

FusionNetwork

Hi All,

Virtuemart 3.6.0 is out and the bug is still there ...
Whatever anyone would say it is not a standard behavior if you go from a menu link to vm category A, browse to page 4 in that A category, then browse to another menu link to vm category B and then go to from menu link to the vm category A again and the actual page is displaying page 4 of the category A but the link does not display ?start=xxx. THIS IS NOT A STANDARD BEHAVIOR.
If it must be maintained in the session the last accessed page of the previous category then the link should be accordingly maintained....
Why if a user browses back to a previous category (via menu link) it must be maintained the page he was on to??? A link to a vm category should be always a link to the first page of that category! If the user hits the browser back button ... yes it makes sense, but if not... it does not make any sense.

Nice that nobody listens. :((

Regards
Cosmin