Hi,
Some customization will be needed. You could either try to find the same product in the shopping cart before adding another one into the cart, read its CustomData and merge them with the newly added item CustomData. The item will then just increase the item count and overwrite the data, but now with preserved previous data. You would just need to parse the CustomData to correctly update/merge them.
You have also a good point when you write about ShoppingCartItemParameters.
The
GetShoppingCartItemInternal method used inside the below code checks for the same SKUID, and if it's not a Bundled product, then it checks if the product has some options and if they match with the existing item in the cart.
Below is the part of the code of
ShoppingCartInfoProvider.SetShoppingCartItemInternal method:
...
// Try to find specified product with such product options in cart
ShoppingCartItemInfo product = GetShoppingCartItemInternal(cart, itemParams);
// Update product when it is not donation or product with text option or bundle item
if ((product != null) && (product.SKUObj != null)
&& (product.SKUObj.SKUProductType != SKUProductTypeEnum.Donation)
&& !ShoppingCartItemInfoProvider.IsProductWithTextOption(product))
{
UpdateShoppingCartItemInternal(product, itemParams);
}
// Add product
else
{
product = AddShoppingCartItemInternal(cart, itemParams);
}
...
A customization of the code can be made either in the comparison in
GetShoppingCartItemInternal method (here you would return null if there's a same product with different CustomData)
or in the
UpdateShoppingCartItemInternal or
AddShoppingCartItemInternal methods.
Some examples of customization of similar methods can be found e.g. in the 6.0 website project in ~\CMSModules\Ecommerce\Samples\CustomShoppingCartInfoProvider.cs
and explanations in the
Ecommerce new customization model in version 6.0 blogpost.
It would be better to discuss more details in the direct email conversation, so feel free to contact us at our support email address. We can communicate in Czech too :)
Regards,
Zdenek