Jump to content

ajaxCart.add in external website


Recommended Posts

Hello,

I want to use prestashop function to add item to cart from external website.

Do this i make POST request on prestashopp

 

add:1
ajax:true
controller:cart
id_product:10
qty:1
 
I think the token is missing, but how to create new cart from external website for customer witout create new client etc.. ?
 
Thank
Link to comment
Share on other sites

browsers does not allow to create asnychonous cross domain $_POST (ajaxcart.js uses asynchronous request)

so the only one way is to build a <form> that will POST variables from your post to your shop address.

if token is enabled - this can generate problems and you will not be able to add products to cart in that way (Token is necessary)

Link to comment
Share on other sites

I found to disable prestashop token, but item is not in cart the first time user submit form.
I have json return reponse but not cart update.

{"products":[],"discounts":[],"shippingCost":"0,00 \u20ac","shippingCostFloat":0,"wrappingCost":"0,00 \u20ac","nbTotalProducts":0,"total":"0,00 \u20ac","productTotal":"0,00 \u20ac","freeShipping":"0,00 \u20ac","freeShippingFloat":0,"free_ship":true,"isVirtualCart":false,"hasError":false,"crossSelling":""}
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...