1

I am trying to add products with custom options in cart via query string but it does not worked.

//my redirecting on click here
<?php echo "http://localhost/magento_bnsb_guide/index.php/checkout/cart/add/product/".$_product->getId()."?qty=2&options[3]=1"; ?>')">

i copied this url from source.


http://localhost/magento_bnsb_guide/index.php/checkout/cart/add/product/7?qty=2&options[3]=1

2

If you are using Magento version greater 1.7.x.x you need to add form key with URL

http://localhost/magento_bnsb_guide/index.php/checkout/cart/add/product/7/form_key/wUCWIqJMKYAh1lg9?qty=2&options[3]=1
1

You're missing the uenc or security code to go with that. Try using

$product = Mage::getModel('catalog/product')->load($this->getProduct());
echo Mage::helper('checkout/cart')->getAddUrl($product);
  • how to attach query string with it – rahul chaurasia Sep 9 '15 at 12:13
  • How would you add a simple product (size option of configurable product)? - same as selecting a T-shirt in size SMALL on the product page ... but then for getAddUrl? thx – snh_nl Nov 9 '18 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.