Jump to content

How to add a product to the cart from a static page?


Recommended Posts

Hi all,

I'm reading on some posts that it is not possible to add a product to the Prestashop cart with a simple get request (a link containing the id of the product).

 

Is it possible to add a product to a cart with a form using the POST method from a static page?

 

thank you

 

claudio

Link to comment
Share on other sites

It is possible using a simple get request.  You can turn that into a POST request if you like as well.

 

http://localhost/index.php?controller=cart&add=1&ajax=false&id_product=1&ipa=1&token=sd09f8sa09df8a0sd980a9sd809a

 

The problem you will likely have is the token parameter, which is required by default, and will be different for each customer.

 

 

Where is the token of a user?

If the token is different for each customer I suppose it doesn't works for anonymous users.

 

Probably I should do a front controller and to leave the idea of using a static html block.

 

cld

Link to comment
Share on other sites

Where is the token of a user?

If the token is different for each customer I suppose it doesn't works for anonymous users.

 

Probably I should do a front controller and to leave the idea of using a static html block.

 

cld

 

I've solved with a front controller done using this tutorial: https://www.packtpub.com/books/content/using-front-controllers-create-new-page

 

The problem with get and post methods is that I don't know how to generate the token needed.

 

cld

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