Question

I am running a promotion and would like to make it very easy for customers to add three items to their shopping carts.

The research I have done around URL querystrings no longer seems to work on Magento 1.6.2, due to a requirement of a form key value.

Is there any way for me to be able to add one of each of 3 simple products to a customers basket from a link in an email?

Not scamming etc, just want to make life easy for people interested in buying the special offer product(s).

Was it helpful?

Solution 2

So, the easy way to do this (Tested in Magento 1.6.2 only) is to simply get the ID from Magento admin of the product you want to link to, and then construct the URL as follows:

http://www.example.com/checkout/cart/add?product=12345&qty=1

www.example.com is your website, and the "/checkout" part will change if your Magento installation is not in the root of your domain. So, if your Magento store is installed into a subfolder called store, your link would be:

http://www.example.com/store/checkout/cart/add?product=12345&qty=1

product=12345 is the ID of the product to add to the cart.

qty=1 is the quantity to add to the cart.

This will work for simple products (products that do not have any options required before adding to cart).

I hope this helps someone.

OTHER TIPS

You should create your own module for this with the product sku/id as a parameter. Code might look something like this:

$id = '100'; // Get the id  with $this->getRequest()->getParam('id')
$qty = '2'; // Replace qty with your qty
$_product = Mage::getModel('catalog/product')->load($id);
$cart = Mage::getModel('checkout/cart');
$cart->init();
$cart->addProduct($_product, array('qty' => $qty));
$cart->save();
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);

After that you can do a redirect to the cart or to the homepage.

The link in your email will be something like http://domain.com/router/controller/action/id/product-id

Some more info here.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top