Developer forum

Forum » Development » To sort a live price

To sort a live price

Tomas Gomez
Reply

Hi,

We have a problem with the product list filtering and sorting. The product page needs a price sorting, and the prices are fetched live from the ERP. That is, prices aren't stored into the DW database. All prices are 0 for DW, so all products have 0 price when we build the indexes of the repository.

We tried to implement a Dynamicweb.Ecommerce.Notifications.Ecommerce.ProductList.BeforePaging notification, to sort the prices before being rendered. It works ok when all the products of a category are shown. But when selecting a facet, the page is still showing all the products, not just the filtered products. So there is a "misadjustment" between the sorting and the facets.

How may we implement the price sorting when the price is not in the database?

Regards,
Tomas

Replies

 
Adrian Ursu
Adrian Ursu
Reply

Hi guys,

I am also interested in this topic.

Looking forward to finding out if there is a solution for it.

Thank you,
Adrian

 
Nuno Aguiar
Nuno Aguiar
Reply
This post has been marked as an answer

Hi Tomas,

 

How would you envision that to be accomplished? The facets use indexed data as source, and so does the search (based on price per your example). If you want to use Live Pricing that may not be able to work. For example:

  • Let's say you have 10.000 products
  • You are showing 12 products per page
  • But in fact you need to get all prices from the ERP to be able to sort by price
    • One can argue you don't need all 10.000 products at once, but the logic to determine the set of needed products could vary from project to project (ecomGroup + ?)
    • Nonetheless you still need to get a large number of products (the first time at least) to be able to know the prices and then sort them
  • Then it still needs to do the proper sorting and paging - and if the sorting was net per price, we may have caused a huge load time for nothing
    • Meaning that for best performance we'd need to add even more logic to determine when getting all prices would be important

 

Over the years we've abandoned this approach with customers and let them sort only by MSRP/List Price, since that's an indexed value. We can then show them "Your Price" as the Live Price, and they've been receptive of this.

 

Let me know what you think, as this would also be a desirable feature to have.

 

Best Regards,

Nuno Aguiar

Votes for this answer: 1
 
Tomas Gomez
Reply

Thanks Nuno,

I agree with your analysis, eventually we will need all the prices from the ERP to be able to sort by price.

Another option we thought about would be to modify the ProductIndexBuilder to get the prices from the ERP instead of the database. This way, the prices would be updated everything the index is rebuilt. It is not a perfect solution, as live prices may change at any moment without a proper synchro with the index, but it would be an approach to be able to sort by price while filtering by facets.

It is a desirable feature, however it is a not an easy problem to solve....

Regards,
Tom

 

 
Nuno Aguiar
Nuno Aguiar
Reply

Hi Tomas,

 

For your idea to work, they'd have to be a session/user specific index instance, because if 10 users are on the website at the same time, there would have to be each individual's index for it to work. This may be a very large change and may also take up a lot of disk space, not to mention it also depends on how long it takes to generate the index. It's not easy at all.

 

It would be interesting for sure, and certainly a point in our favour if we could do it. In this part we're competing against 3rd party shiny search tools that do a lot and have a lot of bells and wishels, we need more features to compete and/or be a differentiator.

 

Best Regards,

Nuno Aguiar

 
Tomas Gomez
Reply

Hi Nuno,

I don't understand why there has to be a session/user specific index instance. In my solution, prices are the same for all the sessions/users, so I guess that only the default index instance is needed. Am I wrong?

Finally, we think the easiest alternative is to fetch the live prices into a "MyHiddenPrice" product field through a standard integration. It is a new hidden field because it is used only for the sorting. Afterwards, the products would be sorted by this hidden field. The only caveat would be that integration should be quite often to avoid synchro issues between the stored and the live price.

What do think about this last idea? Do you think there would be other caveats or better alternatives?

Regards,
Tomas

 
Nuno Aguiar
Nuno Aguiar
Reply

Hi Tomas,

 

If your prices are always the same, why not use Batch with a small frequency instead? You don't need Live Pricing. That way you don't have any issues.

 

Live Pricing exists when prices can be different for you and me and we are both on the site at the same time, that's why we could not share an index (which is why we don't sort by price in projects with customer specific pricing).

 

Does that make sense, or am I missing something?

 

Nuno

 
Tomas Gomez
Reply

Hi Nuno,

The prices are the same for all users, however every price may change very often. This way, our client required us live prices to avoid synchro issues in the orders/payments.

Under this requeriment, we think best alternative for sorting is to create a custom field just for the sorting. The sorting will not be perfectly synchronized, but it will be a nice aproximation.

Regards,
Tomas

 

You must be logged in to post in the forum