Hello,
You can take a look, how the standard shopping cart is displayed and create a webpart, which would behave similar. The code can be found under ~\CMSModules\Ecommerce\CMSPages\
ShoppingCartSKUPriceDetail.aspx.cs or~\CMSModules\Ecommerce\Controls\ShoppingCart\
ShoppingCartPreview.ascx. There is also a Mini Preview Shopping cart located in ~\CMSWebParts\Ecommerce\
ShoppingCartMiniPreviewWebPart.ascx.cs.
The products are added to the shopping cart via query strings. By default it isn't possible to change this behavior. You would have to change the~\CMSModules\Ecommerce\Controls\ProductOptions\
ShoppingCartItemSelector.ascx.cs
and add the product through the API. You can find an example bellow.
// Get current shopping cart
ShoppingCartInfo cart = CMSContext.CurrentShoppingCart;
if (cart == null)
{
// If current shopping cart hasn't been created yet -> create new empty one
cart = ShoppingCartInfoProvider.CreateShoppingCartInfo(CMSContext.CurrentSite.SiteID);
// Associate new shopping cart with the current session
CMSContext.CurrentShoppingCart = cart;
}
int skuId = 10;
int quantity = 1;
// Ensure shopping cart is saved to DB
if (cart.ShoppingCartID == 0)
{
ShoppingCartInfoProvider.SetShoppingCartInfo(cart);
}
// Add product to shopping cart - you can call this method to add multiple products as you need
cart.AddSKUUnitsToShoppingCart(skuId, quantity);
// Save shopping cat products
ShoppingCartInfoProvider.SetShoppingCartItems(cart.ShoppingCartID, cart.CartItems);
Best Regards,
Boris Pocatko