Vulnerability in EPiServer.Forms
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.
Entry newEntry = CatalogContext.Current.GetCatalogEntry(code);
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...
LineItem lineItem = _cartHelper.Cart.OrderForms.LineItems.First(lineI => lineI.Code == code);
var priceOfLineItem = lineItem.PlacedPrice; -> this equal 0
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
Make sure you add the price valid for the current time and current market.
Checked. That's not the problem.
Try to create an order in Commerce Manager and add that variation to your order. Is the price correct?
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.LineItems[helper.Cart.OrderForms.LineItems.Count - 1];
var price = GetPrice();
item.PlacedPrice = price.Amount;
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>();
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);