parklan Posted October 21, 2013 Share Posted October 21, 2013 Hello, I am implementing the add to cart Ajax function with the attribute. for the add to cart <a class="exclusive button ajax_add_to_cart_button"..... rel="ajax_id_product_2_7 /> I know the Ajax will recognize 2 as the product ID and 7 with the attribute ID But i tried in the product.tpl but seems it is not working.. It keep add the default attribute of the product ID into the cart Anybody has the solution on this issue? Thanks a lot ! Link to comment Share on other sites More sharing options...
NemoPS Posted October 21, 2013 Share Posted October 21, 2013 It works differently on the product page, as it fetches attributes etc from the buy block form THerefore, it won't work on that page for the single product, unless you erase the other call (which is on a submit button) Also, I'd like to point out that if you want to use html5, you should replace rel with id, both in the ajax cart and template files, to be standard-compliant Link to comment Share on other sites More sharing options...
parklan Posted October 21, 2013 Author Share Posted October 21, 2013 (edited) Thanks for your fast reply! In the current status, i have fetch all the attribute from getAttributeCombinaisons() You can see the table thought this link: http://goo.gl/BFFEAB I have get the attribute and the product ID already, It works fine without ajax for the addcart url link with get attributes However class "ajax_add_to_cart" is included, it only added the default attribute into the cart in ajax. So is it possible to add the specific combination into cart via ajax? Thanks!!! Edited October 21, 2013 by parklan (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted October 21, 2013 Share Posted October 21, 2013 Oh, I see what you mean now! Can you try logging the combination id to the console once you fire the ajaxCart.add() method? so you can see why it's not working Link to comment Share on other sites More sharing options...
parklan Posted October 21, 2013 Author Share Posted October 21, 2013 Yes, you are right, the main problem is in the ajax-cart.js the default one for the add to cart button is ajaxCart.add(idProduct, null, false, this); now i get the correct attribute and change to ajaxCart.add(idProduct, idCombination, false, this); Then it works super fine!!! Thanks a lot for your help! Link to comment Share on other sites More sharing options...
NemoPS Posted October 21, 2013 Share Posted October 21, 2013 Amazing! Can I mark the thread as solved then? Link to comment Share on other sites More sharing options...
parklan Posted October 21, 2013 Author Share Posted October 21, 2013 Sure, Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now