Post by Nooblet » Mon Jan 17, 2011 3:59 pm

Hey Guys,

I know there is a lot of information on this topic but i was wondering whether it was possible to make a modification so that all of the add to cart buttons do an Ajax add. Not just those on the products page. This would include the little plus buttons for all products.

Thanks for any help you can give

Newbie

Posts

Joined
Mon Jan 17, 2011 6:48 am

Post by kedgetech » Tue Jan 18, 2011 5:21 am

There is a commercial contribution that allows you to do that. May be you can give this a try and see if this fits.
http://www.opencart.com/index.php?route ... ion_id=619

User avatar
Active Member

Posts

Joined
Mon Mar 22, 2010 5:20 pm
Location - USA, Australia, India

Post by Xsecrets » Tue Jan 18, 2011 5:27 am

it is possible, but if you do it opens up the possibility for people to scam your cart. That is why they were not made ajax in the first place.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by marc_cole » Tue Jan 18, 2011 6:03 am

Xsecrets wrote:if you do it opens up the possibility for people to scam your cart.
How so?

OpenCart v1.4.9.4
VQMod | Categories Home | Cleaner By Default - 2 Column | Speak Good English


Active Member

Posts

Joined
Tue Dec 14, 2010 11:26 am
Location - Seattle, WA

Post by Chones » Tue Jan 18, 2011 6:10 am

I think the problem is that a user can be in the checkout section, and add more products via AJAX from the sidebars such as Specials etc. without leaving the checkout page - price won't update but products ordered will update.

http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk


User avatar
Active Member

Posts

Joined
Wed Mar 24, 2010 9:07 pm
Location - London

Post by kedgetech » Tue Jan 18, 2011 6:18 am

@Chones - We have released a "Free Gift" module that uses some ajax functionality when user adds the product that has free gift via ajax system adds the free gift product with discount and we tested that price is represented right.

I might be wrong but if there is something that we need to fix in our module (if any) would be helpful.

Demo : http://www.opencartaustralia.com/module/freegift/
Try click on the "MacBook Air" from home page.

User avatar
Active Member

Posts

Joined
Mon Mar 22, 2010 5:20 pm
Location - USA, Australia, India

Post by Chones » Tue Jan 18, 2011 6:28 am

I think you're okay - the problem only exists if you can add to cart via AJAX from the sidebar modules while in Checkout, and you're not using AJAX for the sidebar modules.

However, when I add to cart from the sidebar I don't get a free gift. If I was a customer I'd want my free gift if I'm buying legitimately! ;) You may want to do something about that.

http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk


User avatar
Active Member

Posts

Joined
Wed Mar 24, 2010 9:07 pm
Location - London

Post by kedgetech » Tue Jan 18, 2011 6:34 am

I guess ideally the template builder can point the user to product page or use api to implement the functionality in the other modules.

I would like to test that scenario you mentioned with ajax. Thanks. :)

User avatar
Active Member

Posts

Joined
Mon Mar 22, 2010 5:20 pm
Location - USA, Australia, India

Post by kedgetech » Tue Jan 18, 2011 6:38 am

If i have not already hijacked the post looks like there might be issues in using ajax all over which need to be tested. Approach with caution would be a context.

Hope that helps.

User avatar
Active Member

Posts

Joined
Mon Mar 22, 2010 5:20 pm
Location - USA, Australia, India

Post by Nooblet » Tue Jan 18, 2011 7:33 am

Ok thanks guys. The comercial plugin looks good, but it does allow you to add products to the cart during the checkout screen so maybe i can disable that module when it is on the checkout screen to avoid problems?

Newbie

Posts

Joined
Mon Jan 17, 2011 6:48 am

Post by Xsecrets » Tue Jan 18, 2011 7:41 am

The problem with making all the add to cart buttons ajax is specifically with the ones in the modules that are always displaying on the side. If you are on the confirmation page you can add things to the cart, then click submit. They will not get added into the value sent to the payment processor, however they will be in the order when it's completed on return. So people can essentially add anything that is in a sidebox to their order for free.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by Chones » Tue Jan 18, 2011 7:43 am

It's a good idea to disable the modules on the checkout pages if you want to do this.

Also, it's been shown to increase conversion rates if you don't distract your customer with more products once they are in the checkout process - so removing sidebars from the checkout pages is a good idea all round.

http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk


User avatar
Active Member

Posts

Joined
Wed Mar 24, 2010 9:07 pm
Location - London

Post by marc_cole » Tue Jan 18, 2011 9:02 am

Xsecrets wrote:So people can essentially add anything that is in a sidebox to their order for free.
If that's true, it sounds like a PHP problem rather than an AJAX problem. How can client side code bypass the PHP code and add something to the cart for free? Isn't there something built-in to the code that would prevent that from happening?

OpenCart v1.4.9.4
VQMod | Categories Home | Cleaner By Default - 2 Column | Speak Good English


Active Member

Posts

Joined
Tue Dec 14, 2010 11:26 am
Location - Seattle, WA

Post by Xsecrets » Tue Jan 18, 2011 11:01 am

marc_cole wrote:
Xsecrets wrote:So people can essentially add anything that is in a sidebox to their order for free.
If that's true, it sounds like a PHP problem rather than an AJAX problem. How can client side code bypass the PHP code and add something to the cart for free? Isn't there something built-in to the code that would prevent that from happening?
no because the AJAX wasn't designed to be used on the confirmation page because there weren't even add to cart buttons on any of the sideboxes at the time, and when they got added they were simply made to not be AJAX to keep from having to go back and rework the way all that code was designed.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US
Who is online

Users browsing this forum: No registered users and 6 guests