Magento – Adding products to cart via url

cartcheckoutmagento-1.9onestepcheckout

I'm planning to do a website that opens directly on the cart page, in the cart it needs to have some products already selected and it should be ready to go to the checkout page.

What I need to do is to add, every time the user goes to the page, some products.

The thing is I've already done it one time, but it was 3/4 months ago and now I can't remember anything about it. The only thing I remember is that I've changed in dashboard->catalog->url rewrite management and there I've put the rule to redirect the homepage on this link

http://WEBSITE/index.php/checkout/cart/add?product=1&related_product=2

And on the test website it works well, I have the cart section with product 1 and 2 visible

Now I'm trying to do this step on the "official" website but every time I try to access the website I have the cart section and it tells me "No products in your cart"

So I'm thinking that I need to put the form_key somewhere but I can't find anything about it

for both the website I have Magento 1.9

Best Answer

Please try with this.

<a href="http://example.com/index.php/checkout/cart/add/product/1/form_key/<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>/">My cart</a>
Related Topic