Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Hi,
Make sure you add the price valid for the current time and current market.
/Q
Hi,
Try to create an order in Commerce Manager and add that variation to your order. Is the price correct?
/Q
I'm having the same issue. Through Commerce Manager wasn't able to add that variation because couldn't find it.
Solved it like this:
Entry entry = _variation.LoadEntry(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull); var helper = new CartHelper(Cart.DefaultName); helper.AddEntry(entry, amount, false); LineItem item = helper.Cart.OrderForms[0].LineItems[helper.Cart.OrderForms[0].LineItems.Count - 1]; var price = GetPrice(); item.PlacedPrice = price.Amount; helper.Cart.AcceptChanges();
Where GetPrice() method just returns the appropriate "entry.PriceValues" value.
public static Price GetDefautPriceMoney(this VariationContent variation, IMarket market = null) { ReadOnlyPricingLoader pricingLoader = ServiceLocator.Current.GetInstance<ReadOnlyPricingLoader>(); ItemCollection<Price> prices; prices = variation.GetPrices(); if (prices != null) { if(market != null) return prices.FirstOrDefault(x => x.MarketId.Equals(market.MarketId) && x.UnitPrice.Currency == market.DefaultCurrency && x.CustomerPricing.PriceTypeId == CustomerPricing.PriceType.AllCustomers); return prices.FirstOrDefault(x => x.CustomerPricing.PriceTypeId == CustomerPricing.PriceType.AllCustomers); } return null; }
Regards
/K
I have a problem when I try to add an Entry to my cart. In my ShoppingCart controller I have a method that takes the code attribute of a variant and use it to add it to the cart as an Entry.
This lines of code insert the entry in my cart, but not with all the attributes.
When I try to access the line item, it has an PlacedPrice equal to 0. Also when I run the CartValidate workflow, the Cart.Total is 0. If I set the PlacedPrice to a number it works...
I have to specify that I set up the price in the Commerce Manager, when I added the variant.
I'm pretty much new to the Episerver world, so take me easy:D I'm using Episerver 7.5
Thank you.