Adding product to basket using HTTP GET call

Hi guys!



I’m new to CS-Cart and just got everything installed and starting to play with it. I would like to create some very simple store flow, that will allow me to easily add a product to the basket, and once the user adds the product to the basket he is also taken to the page showing all the products in his basket and the user can proceed to checkout right away from there.



I managed to get all of this mods implemented and now playing some more with the tpls design.



One small thing that I failed to find - how can I build a simple URL with GET call to pass the product ID I wish to add?



Currently, the only way I managed to find to add products to the basket is by using a POST call via form with some hidden params, something like this:


```php







```

I tried finding a simpler way to add a single product to the basket with a simple GET call, but with no luck.

Any help will be greatly appreciated! Many thanks for the help!

-Amit-

Your url would look like:

?dispatch=checkout.add…

to add the product to the cart (note the 2 dots ‘…’) but then you will need another redirect of:

?dispatch=checkout.cart

to actually take the user to the cart.



Assuming you are doing this from somewhere outside the cart. Otherwise you should just use:

{include file=“buttons/checkout.tpl”}

Many thanks tbirnseth for your assistance with this! :slight_smile:



Unfortunately I didn’t manage to get this working by calling the two files you mentioned above. I tried performing the first call with PHP curl and then redirecting the user to the second page with the PHP header, but apparently the first call didn’t had any effect I’m afraid.



However, the good news are that I managed to get this working quickly with the solution you posted here:

[url]http://forum.cs-cart.com/showthread.php?t=20192[/url]



(Your reply at post #5)



I’m now sending the user from our main site (which is external to the store) using a link like this:



…/…/store/index.php?dispatch=checkout.remote_add.109



And then user is directly displayed with his current basket page, listing all products the user currently have in his basket.



In the thread above, you posted this solution as the right solution to direct users to the store from external sites. Do you see any problem using this in the same way I’m using it right now? That is - using it from within the same web-site to direct the user to the store with one single link?



Is there a better way to achieve this result, or this is a proper solution for this need?



Many thanks for the time and help! :slight_smile: