Jump to content

How-to create a link to automatically add to cart?


danvers

Recommended Posts

I've got a custom page, where I would like to add a link to automatically add to cart just 1 quantity of a product in my catalogue.

 

I've search the web, I've found this piece of code:

<script type="text/javascript">
ajaxCart.add(ID_PRODUCT , ID_ATTRIBUTE , AJOUTAPARTIRDELAFICHEPRODUIT , ELEMENT , QUANTITY , WISHLIST);
ajaxCart.refresh();
</script>

but, the thing is I don't know how to place it, and how to change the attribute.

So, can someone post an example of how it can be done?

 

I'm on PS 1.6

Thank you.

Link to comment
Share on other sites

 

 

and how to change the attribute.

 

create function

function myaddtocart(product_id,attribute){
ajaxCart.add(product_id , id_attribute , AJOUTAPARTIRDELAFICHEPRODUIT , ELEMENT , QUANTITY , WISHLIST);
ajaxCart.refresh();
}

then call this function in that way:

myaddtocart(5,15);

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...