Jump to content

[SOLVED] Ajax cart issue "ajax_id_product" by attribute ID


parklan

Recommended Posts

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

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

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 by parklan (see edit history)
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...