hi got the smae error. Use the code on the wishlist page to add items to basket
Entry e1 = CatalogContext.Current.GetCatalogEntry(txtprodid.Text);
Entry entrytouse = CatalogContext.Current.GetCatalogEntry(e1.CatalogEntryId, new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull));
if (entrytouse != null)
{
bool alreadyExists = false;
CartHelper helper = new CartHelper(Cart.DefaultName);
// Check if item exists
foreach (LineItem item in helper.LineItems)
{
if (item.CatalogEntryId.Equals(entrytouse.ID))
{
item.Quantity += Convert.ToInt16(txtQuantity.Text);
alreadyExists = true;
}
}
lock (_lock)
{
if (!alreadyExists)
helper.AddEntry(entrytouse, Convert.ToInt16(txtQuantity.Text), true);
else
helper.Cart.AcceptChanges();
}
}
Thanks - the issue in my case was a configuration line was missing from Web.Config that set up database connections to the catalog system.... Any commerce related issues, the first thing I suggest is thoroughly checking all of the configuration, httpModules etc
We had this exact same problem.
For other people that are having this issue, make sure you requested the Entry with price information. If entry.ItemAttributes.ListPrice is null then AddEntry will fail.
This code will not return price information:
CatalogContext.Current.GetCatalogEntry(code);
This code will return price information:
CatalogContext.Current.GetCatalogEntry(code, new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull));
I've followed the examples that exist in the demo site, i've ported it across to the site i'm currently working on and sucessfully installed Commerce, yet I get the following error whenever I try to add an item to the cart.
Any ideas what this could be? I'm completely stuck.
Source File: C:\projects\RICS\trunk\Rics.Web\Templates\Commerce\Pages\BasketConfirmation.aspx.cs Line: 69
Stack Trace: