ASPX templates
Version 5.x > ASPX templates > ECommerce Shopping Cart View modes: 
User avatar
Member
Member
chris.zinCode - 11/22/2010 12:08:31 PM
   
ECommerce Shopping Cart
First off, thanks for a great product to work with.

I am having trouble getting the shopping cart to show all of the recently added items. Now, I am actually expecting this to occur since I am loading the data into the ShoppingCartSKU somewhat manually.

Our products (SKUs) are not priced the same for each user. I created I guess what would be called a precart screen (usercontrol). On that control the user makes some final choices as far as products and then I add them to the ShoppingCartSKU table.

My other issue is that the user can put the same product in the cart multiple times with different prices. I was having trouble when the shopping cart was grouping together alike SKUs (which makes sense in a normal product world), but our products change price. I can explain in email if necessary, but I do not wish to divulge specific business information here. So, to keep it from grouping together. I load the parent product in using the following code.

Some code is omitted....

ShoppingCartInfo myCart = CMS.Ecommerce.ECommerceContext.CurrentShoppingCart;

myShoppingCartItem = myCart.AddShoppingCartItem(Convert.ToInt32(skuItem.ToString()), 1, myOptions);
myShoppingCartItem.SetValue("CartItemPrice", dblPrice);

myParentGuid = myShoppingCartItem.CartItemGUID;

I then added a method to my own BL, DL assemblies to insert the related SKUs in the ShoppingCartSKU table with the CartItemParentGuid.

This works perfectly (meaning I don't get the grouped skus). The data in table is correct, but when I redirect to the shopping cart. Only the parent cart item shows for that recently added set of skus.

Now, I close and reopen browser it shows. I have tried calling the following in the Reload method of ShoppingCartConent.ascx.cs:

ShoppingCartInfoProvider.EvaluateShoppingCartContent(ShoppingCartInfoObj);

I have tried clearing the session variable for shopping cart. I tried called the static CreateShoppingCartConten() method and assigning to the ShoppingCartContent datatable (that just clears the current shopping cart, but not the data in table thank goodness).

Nonetheless, my question is:

Is there a way to force the ShoppingCartContentTable to reload with the data from ShoppingCartSKU?

Thanks,

Chris Martin

User avatar
Member
Member
chris.zinCode - 11/23/2010 7:21:06 PM
   
RE:ECommerce Shopping Cart
Well, I thought I had tried everything. I reviewed the Shopping Cart Retrieval diagram Figure D in the http://www.kentico.com/docs/ecommerceguide/index.html Ecommerce Guilde and I realized that I did not remove the cookie as well. So, removing the CMSShoppingCart session variable and the cookie with the same name worked well. Thanks!

User avatar
Certified Developer 10
Certified Developer 10
SteveBiznet - 7/21/2011 6:47:08 PM
   
RE:ECommerce Shopping Cart
(I know this is old, but just in case someone else finds this thread with a similar problem)

I had a similar issue (same SKU, different custom data configured in a custom web part) that required the same SKU to be added to the cart multiple times. Here's the work around I used.


int tempPlanSKUID = [ID of a blank product that is only used for addition]

//This will ensure that a new cart item is added to the cart
ShoppingCartItemInfo product = cart.AddShoppingCartItem(tempPlanSKUID, 1, null);

... set up the product (options, custom data, etc)

//Set the product SKU back to the actual SKU ID that should be used
product.SKUID = pSKUID;

// Update shopping cart item in database
ShoppingCartItemInfoProvider.SetShoppingCartItemInfo(product);



I don't know if quantity updates will work or not (we don't allow that in our scenario) but product deletion seem to go by the CartItemGuid once you actually get it in the cart.