“Add to cart” with AJAX – need ideas

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
10010110
Translator
Translator
Posts: 224
Joined: Tue Jan 22, 2008 9:57 am

“Add to cart” with AJAX – need ideas

Post by 10010110 »

So, I’m using calguy’s e-commerce modules for a simple way to purchase items. As far as I have found out from an old thread there is no way to add an item to the cart and then staying on the same page (e. g. the product detail page where the “add to cart” button was clicked), it will either redirect to the default page (home page) or another page one has specified. So, I thought a workaround would be to use AJAX, so as to just change the count of items in the cart (I have a small indicator at the top with a link to checkout) without reloading the page.

What I’m wondering is how this would actually be done. From my understanding, if I submit the form (“add to cart”) with AJAX, the response will be the complete reloaded page. Will I have to traverse through the whole DOM to get the new price or is there a simpler way I haven’t thought of yet? Basically my question would be: how to do an “add to cart” functionality using AJAX without reloading the page?
Post Reply

Return to “The Lounge”