Author Topic: Sorting by price is wrong  (Read 355 times)

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 274
    • Audio Store
Sorting by price is wrong
« on: May 13, 2019, 19:01:36 pm »
VirtueMart 3.4.5 10045

Sorting by price is wrong if there are 2 or more user groups.
When sorting for some products, it takes the price of one group, and for others the price of the other group.

Example:
Product_1: Price Available for All: 174 / Gold level: 160
Product_2: Price Available for All: 179 / Gold level: 165
Product_3: Price Available for All: 193 / Gold level: 170

Sort by price ASC: Product_1; Product_3 ; Product_2 (Price: 174 ; 193 ; 179)

If the user is in a Gold level group, sorting is again like this.
If the Gold level group is removed, the sorting is correct.

Tested with Protostar.

Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 274
    • Audio Store
Re: Sorting by price is wrong
« Reply #1 on: May 13, 2019, 20:11:19 pm »
If it can help in finding the problem:

I noticed that if I make the following changes to the Product_3:

In Available for All group data:
Change the group Available for All to Gold level
Change the price from 193 to 170 (The normal price for the Gold group)

And respectively in the Gold level group:
Change the group Gold level to Available for All
Change the price from 170 to 193 (The normal price for the Available for All group)

Save changes and sorting works correctly.
Max, do you have an idea? This problem made me crazy.
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 274
    • Audio Store
Re: Sorting by price is wrong
« Reply #2 on: May 15, 2019, 20:16:05 pm »
I come to the conclusion that the topic of sorting by price is a taboo. I have written about this bug before, but absolutely no one is involved.
I want to pay special attention to the fact that it is not about the prices of the products according to the groups that are OK, but only for sorting by price and if you have prices for more than one user group.

The fact is that the VirtueMart does not take prices for the respective user group when sorting by price.
At the moment, if you lower the cost of a product for a "Available for All" group, then for the "Gold User" group, products are sorted by "Available for All" group. Which results in incorrect product ordering by price.

Even more:
I noticed that some products are not sorted correctly when they have a reduced price in the "Available for All" group.
Why? Because, for a vague reason, the price of the "Gold User" group is obtained by price sorting.

How did I fix it? On the product page I exchanged:
Group "Available for all" -> dropdown menu -> becomes a "Gold User".
Group "Gold User" -> dropdown menu -> becomes a "Gold User".
I accordingly changed the prices.

And then the sorting is correct. Which means that Virtuemart does not check the current user's group at price sorting, because such a change should not affect at all.
So far so good. But should any product be checked after upload? To test at a reduced price to see if it is sorted correctly? And if it is not, do the above described manipulation.
But if you have more user groups .... then I have no idea.
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2929
  • VirtueMart Version: 3.6.0
Re: Sorting by price is wrong
« Reply #3 on: May 15, 2019, 21:35:49 pm »
Quote
I come to the conclusion that the topic of sorting by price is a taboo.

Nothing is taboo - it is just that this topic might not be at the top of a list of stuff being looked at.

Once the final prices are "known" for display, sort by final-price - the shoppergroup is irrelevant

regards
A

Joomla 3.9.8
php 7.1

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 274
    • Audio Store
Re: Sorting by price is wrong
« Reply #4 on: May 16, 2019, 07:32:39 am »
Yes, and it would be great if the sorting was done at the "known" prices. But not.

Why is not anyone testing?
Reduce the price of a product to 1 euro. For "Available for all" group only.
Sort at a price.
If the product is sorted correctly, surely if you sign in with another account that is included in the "Gold User" group, it will again be the first one, although its price is for example 1000 Euros.
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2929
  • VirtueMart Version: 3.6.0
Re: Sorting by price is wrong
« Reply #5 on: May 16, 2019, 10:47:38 am »
Quote
Why is not anyone testing?

They are - I believe that this is due to items with patterns but I will look later on

If the people testing have available time to validate your particular user case, it will be noted.



regards
A

Joomla 3.9.8
php 7.1