Hi whenever i am trying to add cart . I am getting following error.
Error:
public Entry Entry { get; set; }
public Func<Entry, bool> FilterAction { get; set; } protected void Page_Load(object sender, EventArgs e) { // getcart(); }
protected void btnBuy_Click(object sender, EventArgs e) { CartHelper test = new CartHelper(Cart.DefaultName);
if (Entry != null) { Entry entry = Entry;
if (FilterAction != null) { entry = Entry.Entries.Entry.FirstOrDefault(FilterAction); test.AddEntry(entry); }
}
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] Mediachase.Commerce.Website.Helpers.CartHelper.CreateLineItem(Entry entry, Decimal quantity, String warehouseCode) +853 Mediachase.Commerce.Website.Helpers.CartHelper.AddEntry(Entry entry, Decimal quantity, Boolean fixedQuantity, String warehouseCode, CartHelper[] helpersToRemove) +718 Mediachase.Commerce.Website.Helpers.CartHelper.AddEntry(Entry entry, Decimal quantity, Boolean fixedQuantity, CartHelper[] helpersToRemove) +79 Mediachase.Commerce.Website.Helpers.CartHelper.AddEntry(Entry entry) +143 DemoTest.Sample.Units.ProductDetail.SharedModule.AddToCart.btnBuy_Click(Object sender, EventArgs e) in C:\EPiServer\DemoVisualStudioCTP17\wwwroot\Sample\Units\ProductDetail\SharedModule\AddToCart.ascx.cs:43 System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +116 System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +101 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9642610 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724I am geeting Entry properly. but I am not able to find the attribute which i am missing. can anyone suggest me ? Which thing i am missing over here ?Thanks in advance.regards,Paragi
Try asking this in the EPiServer Commerce forum.
Also it appears you're working with the CTP17 version which should be discussed in the TAP forums instead of the open forums.
Hi whenever i am trying to add cart . I am getting following error.
Error:
Object reference not set to an instance of an object.
public Entry Entry { get; set; }
public Func<Entry, bool> FilterAction { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
// getcart();
}
protected void btnBuy_Click(object sender, EventArgs e)
{
CartHelper test = new CartHelper(Cart.DefaultName);
if (Entry != null)
{
Entry entry = Entry;
if (FilterAction != null)
{
entry = Entry.Entries.Entry.FirstOrDefault(FilterAction);
test.AddEntry(entry);
}
}
}
Stack Trace: