Hi LiviuH,
The cart contains the line items and the line items are added to the cart by the out of the box CartHelper class. You can download the source code for the cart helper class from EPiServer World if you want to find out how it creates the line items or even change it.
The existing line items will not be changed when changing the CurrentMarket out of the box. You will need to implement this logic. Only entries that has been added after you changed the market will have the new market price.
Hope this helps!
/T
Hi,
The "recommended" way for market and cart is that each customer get one cart per market. That's mean, when user changes market, you can create a new cart for new market (or load the existing one).
When you set the current market, you'll need to call this for creating/getting new cart:
_cartHelper = new CartHelper(string name, Guid userId, IMarket market)
Regards,
/Q
Hi guys,
Yes, definitely the _cartHelper = new CartHelper(CurrentCart.Name) where
///
/// Gets the current cart.
///
public Cart CurrentCart
{
get
{
return OrderContext.Current.GetCart(Cart.DefaultName, SecurityContext.Current.CurrentUserId, CurrentMarket.MarketId);
}
}
is the solution. If this initialization is made in page load, than the CurrentMarket is updated and the items are retrieved correctly.
Thanks a lot for your feedback!
Cheers,
Liviu
Hi,
I have a CMS website with Commerce having a Header control that contains a repeater (a mini basket). On changing the CurrentMarket, the repeater sems not to update the basket items from the updated Market. The label with the name of the Market is updated correctly, but the items from cart remain from the previous Market.
I tried remove any possible cache from the control or the page, and bind the data collection in every mode possible in the Header user control but items still persist.
Is there any other cache added by Episerver that shoudld be removed in a special way, or am I missing some spects ?
Please help.
Many thanks in advance !!
/Liviu H.