Developer forum

Forum » Development » Changing prices of cart/order in DW8.2

Changing prices of cart/order in DW8.2

Rob Lohmann
Reply

We're busy developing a B2B webshop and i'm running into the following situation.
The customer uses an AX-coupling to provide us with products. All products are being delivered to us without any prices. The idea is that an customer logs in onto the webshop. Depending on the deptorgroup he is in, he sees prices specific for him/her. This way every user that logs in can have it's own prices.

What we want to do now is that on productgroup pages we're lazy loading the prices through an webservice call. The productgroups are shown first, and asynchronously all prices for the products in the current overview are being retrieved and replaced using javascript when the results arive from the webservice.

In the shoppingcart and productdetailpages we also want to get the actual prices for the currently logged in customer, only this time from code since performance is less relevant here. I've tried setting up a priceprovider for this. This partially works because at the moment all prices (productgroup pages, productdetail, shoppingcart in the header and the shoppingcart itsself) are requested through this priceprovider. In the backend the created cart first looks fine, also the grandtotal for the cart is correct. Also the details of the order look good because this overview is rendered through the same priceprovider.

All this said now the actual question;

- Is the price provider the right place to change the unitprice of a product whenever the visitor is in the shoppingcart?
- If the price provider is the right place, will these calculations be made correclty for the order?
- Does anyone have any good suggestions or any experience with these kind of situations?
 


Replies

 
Kevin Steffer
Reply
This post has been marked as an answer

You're on the right track.

But I'd suggest that you build a cache when lazy loading the prices and that the PriceProvider which gets called a lot of times when you have items in the cart is getting it's prices from the cache.

Votes for this answer: 1

 

You must be logged in to post in the forum