Developer forum

Forum » Rapido » Sorting of prices by Prices module

Sorting of prices by Prices module

Mikkel Hornbech Nielsen
Reply

Hi Dynamicweb.

We are having some trouble on one of clients sites (lhi.dk) with sorting of product prices based on prices from the Prices module in DW.
From all of the other docs posts i can see at the moment it's not possible to sort on other product specific prices except from the Default Price listed on a product.
Our problem persist in that a default price isen't set on the products, so the sorting isen't working as intended.

Is there a smart workaround which won't involve custom coding a new module to handle the indexing of the specific product prices?
I assmue it isen't possible to use the SortBy parameter with a property from a loop like "Product.Prices"?

I hope you have some kind of suggestions.

Kind regards.
Mikkel Hornbech Nielsen
Frontend Graduate
No Zebra


Replies

 
Nicolai Pedersen
Reply

Hi Mikkel

I am sorry, but our suggestions are limited. There are severeal problems.

First problem is that 10 different users could have 10 different prices with 10 different discounts giving a possible 1000 different prices for just this one product. That is issue 1.

Second issue is that the prices can come from other systems like an ERP and be calculated on the fly and depend on various context information like time, quantity, amount of products in cart, cart totals etc. So it is impossible to tell what the price of a product is at index time - espescially taking the user into account since there can be 1000s.

If we were to sort by the user price when we query the index, and you search for all products in category X, or all products starting with the word "ProductY", you could potentially get 1000s of products - and in order to sort all of them by price, we would have to calculate all of them first and then sort - that means fetching 1000s of products data from database, 1000s of calls to ERP (or price calculations) and 1000s of discount calculations - just to show i.e. the first 30 products.

It is not doable.

So, the best option is to have a "default price", minimum price or sorting price or whatever that you put in the product price field or in a custom price sort field - and use that for sorting.

The only thing we can do that we do not do yet, is to calculate the product price with product discounts for anonymous users. That would help in some scenarios, but not this one.

If you have better ideas that would actually work in real life and in situations with more than just a few products per list, let us know and we will be happy to look into it...

BR Nicolai

 
Nicolai Pedersen
Reply

And we could make a highest and lowest price field on the index for price matrix of course - 2 fields for each currency...

 

You must be logged in to post in the forum