Logging in behavior needs improving

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 anos atrás
If a customer adds products to their cart, then adds a voucher, then decides to login the their account, they loose the voucher they entered and their cart gets merged with products they might have left in the cart months ago.

I suggest the following behaviour on login

If currentcart.product.count = 0, add products from previouscart

If currentcart.products.count > 0, keep the cart the same. Don't add products the customer may have forgotten about.

Anything else currently associated with _workContext.CurrentCustomer should also be transfered (e.g. voucher codes entered).

Any thoughts?

Darren
12 anos atrás
Perhaps instead of having a MigrateShoppingCart method we could have a MigrateCustomer method that merges the

_workContext.CurrentCustomer with the registered customer solving the problem with the voucher codes.

Then also have a condition

if (_workContext.CurrentCustomer.ShoppingCartItems.Count = 0)
_shoppingCartService.MigrateShoppingCart(_workContext.CurrentCustomer, customer);


Darren
12 anos atrás
wunpac wrote:

If currentcart.products.count > 0, keep the cart the same. Don't add products the customer may have forgotten about.


Hi Darren, the previous products should still be added to the cart because we want to remind the customer about products they were thinking of buying before in hopes that they will purchase them. I do agree that the coupon code should be remembered after logging in though.
12 anos atrás
breakskater wrote:

If currentcart.products.count > 0, keep the cart the same. Don't add products the customer may have forgotten about.


Hi Darren, the previous products should still be added to the cart because we want to remind the customer about products they were thinking of buying before in hopes that they will purchase them. I do agree that the coupon code should be remembered after logging in though.


I think reminding them of products they once (could be months/years ago) added to their cart could be handled differently. Changing their current cart in this way won't be predicted by the customer and therefore will be annoying.

Perhaps this is a solution. It adds voucher codes and takes a mergeWithPreviousCart param. It would make customisation easier. Or a setting could even be created to allow the store owner to choose.


 public virtual void MigrateShoppingCart(Customer fromCustomer, Customer toCustomer, bool mergeWithPreviousCart)
        {
            if (fromCustomer == null)
                throw new ArgumentNullException("fromCustomer");
            if (toCustomer == null)
                throw new ArgumentNullException("toCustomer");

            if (fromCustomer.Id == toCustomer.Id)
                return; //the same customer

            var fromCart = fromCustomer.ShoppingCartItems.ToList();
            var toCart = toCustomer.ShoppingCartItems.ToList();

            if (!mergeWithPreviousCart)
            {
                for (int i = 0; i < toCart.Count; i++)
                {
                    var sci = toCart[i];
                    DeleteShoppingCartItem(sci);
                }
            }
        
                for (int i = 0; i < fromCart.Count; i++)
                {
                    var sci = fromCart[i];
                    AddToCart(toCustomer, sci.ProductVariant, sci.ShoppingCartType,
                        sci.AttributesXml, sci.CustomerEnteredPrice, sci.Quantity, false);
                }
          

            for (int i = 0; i < fromCart.Count; i++)
            {
                var sci = fromCart[i];
                DeleteShoppingCartItem(sci);
            }

            //Transfer Voucher Code
            toCustomer.DiscountCouponCode = _workContext.CurrentCustomer.DiscountCouponCode;
            _customerService.UpdateCustomer(toCustomer);
        }


one further thought. How are current gift cards (codes entered) handled when you log in?

Darren
12 anos atrás
wunpac wrote:

I think reminding them of products they once (could be months/years ago) added to their cart could be handled differently. Changing their current cart in this way won't be predicted by the customer and therefore will be annoying.


It is a good point, especially if you already have the item in the previous cart it will update the quantity.

I believe prompting the customer (above the new cart) "Would you also like to add your previous items to the cart?" Showing a list of previously added items and allowing them to select which items and quantities to add to the cart would be less annoying. This should be a very rich and convenient feature to the customer; ideally, adding them should be instant and appear in the bottom new cart without requiring the page to reload.
12 anos atrás
wunpac wrote:

one further thought. How are current gift cards (codes entered) handled when you log in?


Previous coupon codes are also applied to the order (last I checked). I'm not sure about gift cards.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.