Event Model for Shopping Cart? AJAX Cart Updates at Checkout

Posted by Community Admin on 05-Aug-2018 18:27

Event Model for Shopping Cart? AJAX Cart Updates at Checkout?

All Replies

Posted by Community Admin on 11-Feb-2012 00:00

I'm wondering if there is an event model for the shopping cart that I can plug in to. I read in another thread that is only cookie based right now. Maybe you can give me some code I can use to update the cookie when an item is added, so that I can make sure customers don't end up with 2 of the same item in the cart.

Also it is very lacking that the checkout control doesn't have an integrated ability to update the cart so that customers can, you know, update their order before they pay without having to start the payment process all the way over again. Is this something that is on the immediate horizon? If it is I can get by using some Cart event model to limit customers to one product for now, but if it is not that is pretty lame and I have to try to plan on working on a custom checkout control pretty soon which doesn't sound fun.

Posted by Community Admin on 12-Feb-2012 00:00

Hey Joseph,

Currently only a cookie is stored which carries the shoppingcart GUID so next time you browse to the site, you can resume your abandoned cart. Everything else is stored in the db. (take a look at this forum post which will explain the tables etc)

This means it's not a matter of 'updating' the cookie once an item has been added to the cart, naturally you're free to place your own extra cookies to do that.

The checkout control doesn't have the ability to update the cart because that's done with the shoppingcart widget. This widget shows you an overview of your products in the cart with update/remove capabilities. 

For reference you might want to check this post from SteveV regarding limiting checkouts for certain product types.

If I read you correct, you don't need to build an entire custom checkout control with all the necessary steps, just make sure the 'shoppingcart' doesn't allow more than 1 product by adding some extra validation rules.

Jochem.




Posted by Community Admin on 14-Feb-2012 00:00

Hi Jochem. Thanks for making me take a deeper look. I would have loved to have been able to override OrdersManager within a custom OrdersModule, but that didn't work for me like I'd hoped and I'll have to wait to figure out what may have gone wrong, or if it's even possible, until another day. What I did end up doing is  creating an intermediary page between the product description page and the checkout page with the sole job or removing everything but the most recently added item from the cart. Here is the code I used in my custom control. 

//This is a workaround to limit users to 1 course registration until SF checkout page improves
OrdersManager ordersManager = new OrdersManager();
CartDetail product = ordersManager.GetCartDetails().OrderByDescending(x => x.CreatedDate).FirstOrDefault();
foreach(CartDetail detail in ordersManager.GetCartDetails())
if(detail.Id != product.Id)
ordersManager.RemoveFromCart(detail.Id);
course.Quantity = 1;
ordersManager.SaveChanges();
Response.Redirect("~/check-out");


Posted by Community Admin on 14-Feb-2012 00:00

I still do want to make the point that the built in Check Out control is horribly incomplete. I've never purchased from a website where I have to enter my credit card information without being able to see specifically what it is I'm ordering at the same time. I know the Preview page is just one step after, and lists what is in the cart, but the user cannot even update their order once they get to that page. What would make sense is having the shopping cart control side by side with the checkout control, so that customers can very clearly see what they are ordering through each step of the process. Most importantly they should be able to update their cart and have the checkout control update seemlessly so that they don't have to re-enter their billing and credit card information if they decide they want 2 widgets instead of 1 just before submitting their payment. I'm really suprised no one has brought this up yet. This is a huge flaw IMHO.

Posted by Community Admin on 14-Feb-2012 00:00

@Joseph,

Thanks for the snippet, always useful! Maybe I'm being a blond here and looking at things way to simple but you can display a shoppingcart summary (see screenshot) next to the checkout no?

(I apologize for the default styling and the shoppingcart/checkout price difference its because I didn't bother to change price settings to show the widget)

---
Secondly with regards to your 'seemless update of the checkout' on the last step why is this a huge flaw? Once you go from shoppingcart page to checkout, your order is basically 'set'.

Step 4 in the checkout process is just the 'confirmation' page so the user can verify all the entered information is correct. Most ecommerce sites I know of, don't allow the 'seemingless' update on the confirmation you're talking about but refer you back to the shoppingcart page.

And if you're going back to the shoppingcart page and then re-start the checkout process, you don't need to re-enter the billing/shipping information for logged-in checkouts. Naturally out of security and risk of left-open browsers creditcard information has to be re-entered on every account. 

To me, the 'huge flaw' you're talking about is just a bit of front-end styling. Not having to re-enter creditcard information (which means storing it clientside) would exactly introduce that huge security flaw...

Jochem.

Posted by Community Admin on 14-Feb-2012 00:00

Fair enough Jochem, and thanks again for forcing me to look at it a different way. I could require customers view the shopping cart page before going on to checkout, and that does somehwat solve my issue. Still I do think it is a pretty big flaw that if I as a customer get to the screen in your screen shot and decide I no longer want Product B, I will now have to go through the steps of entering my Shipping/Billing/Payment info again after I remove Product B from the order.

Posted by Community Admin on 15-Feb-2012 00:00

@Joseph,

No I should apologize - instead of trying to help you move forward I'm steering you to an off ramp. A problem described in 5-10 lines justifies in no way me telling you (and your client) you're seeing it wrong.
I'm probably spending to much time on this section of the forum :) and have trained my thought-of-mind to follow the step-by-step (cart>order>checkout) approach.

If I'm reading your snippet correct, you're selling courses right? Assuming they're digital (shippingcost not being a factor) you could alter the shoppingcart summary widget and display that next to the checkout widget. If a customer wants to update its cart before confirmation, they can by add/remove in the cart-widget and force a refresh when hitting update...

This gives you the flexibility you're looking for and it will also allow you to easily upgrade Sitefinity because it's only a custom widget and not the entire order processing you've redesigned. (The SF team is still tinkering with it and adding to the payment provider model). 

Posted by Community Admin on 15-Feb-2012 00:00

Hi Jochem. No apologies necessary at all. I really appreciate the time you've taken to help me. If anyone owes an apology it is me to Sitefinity for knit picking on one little feature in a fantastic software package.

We are selling courses right now, that is correct, but in the future we will be selling other items. I did try what you outlined, with the shopping cart and checkout widget side by side, and it is that exact refresh and necessary re-entry of shipping/billing/payment info which I am saying I would like to see cleaned up. Integrating the shopping cart and checkout widgets into one widget would do the trick.

This thread is closed