Merge of cartitems in accelerator - double your cart items

Hi Volks!

I have a question around the accelerator, and the logic around merge of carts. This behavious is currently implemented in accelerator and visible on Litium demo site http://demo-b2c.litium.com/ and the result of the implementation is that cart items increase when logging in and out.

user 1 = erikj :pwd xxx

  • Not logged in - Add to cart prod X
  • Log in User 1. Prod X in cart visible (ok)
  • Add prod y to cart. Total in cart = x+y (ok)
  • log out. Cart symbol indicate 2 items top right
  • add Z to cart (Cart symbol indicate 3 items top right)
  • log in as User1
    NOW 5 items in cart (2X + 2Y + Z)
    image

I think the behaviour is a bit strange here. I understand that product Z should be added to the cart, but the result that X and Y was merged, when it was there, sounds for me a little strange.

Is this a specific feature, then I’m interested in the use case I potentially have missed when it is useful?

Or - is it a known disfeature we can configure away or add som code to make better?

Or - is it a more heavy operation that require to rebuild cart merge function that is the solution?

Thanks

Erik

Litium version: [Version number]

Session state of the User 1 will of course have the x and y items in the basket and it adds its items to what current anonymous user has in the basket.

This is a built in feature.

Thanks Steve for your help and contribution…

However, yes, I see it is a built in feature, but I can not see really the usecase when it is applicable, based on the negative consequence I try to explain in the top-post. (Hope you catched the point that items were doubled in the cart)

Well, catch the point, and some new custom handling of the cartobject is needed…

The normal use case is that one adds items to the cart and when ready to purchase then logging in and then an empty basket will have new items inside it but if you already had few items in your session then of course they will be added also. Now option is to clear the basket when loggin in and that will not be a good approach either since customer loses its chosen items.

Are you using “Save shopping cart information for signed in users only” (setting in control panel > Sales > Shopping cart ) ?
We are adding the users “saved cart” into the existing cart, at login. This is a functional requirement.
I understand that if user keeps on login out and loggin in, his cart items would now increase as the items saved while he is logged in will get re-applied, and I agree that the behaviour is rather strange.
As at now, I am not exactly sure how the odd behaviour should be taken out. Perhaps emptying the cart when user logs out, but that again leads a change in the functionality. Not adding the existing cart also changes the existing way it behaves, for example what if user had different items. May be best would be to see whether it is the same items before adding, and not to add them if they are the same,
You can change this functionality from code, but I am not sure how simple the change is yet. Would you want to proceed on changing this behaviour still?

It would be nice to have an extension point here, as far as i know this cart merge is inside Litium and not possible to modify in the project.

@marten Yes It seems so, I got wrong information first that it is editable in Accelerator but it is not. Mybe some check on if item exist then don’t add it again?

Requirement will be different in many projects so an extensionpoint to override the logic would be more useful than adjusting the existing logic.

1 Like