I have a simple product with an ID of 2 and a grouped product with an ID of 1. The simple product is associated to the grouped product.
I can add the simple product to the cart with this URL:
Mage::helper('checkout/cart')->getAddUrl($simpleProduct);
However, when I want to add the simple product to the cart as an associated product of the grouped product, so that it will be linked to the grouped product in the cart, I am coming up short.
Here is what I've tried:
Mage::helper('checkout/cart')->getAddUrl($groupedProduct, array('super_group[2]' => 99));
This returns a seemingly working URL, but accessing it does not add anything to the cart, with the error "Please select a quantity":
checkout/cart/add/uenc/aHR0cDovL211ZWhsZG9yZmVyLmxvY2FsL3Rvb2xzL3Rlc3QucGhw/form_key/eiCAR1v74QWXeU05/super_group[2]/99/
I have also tried manually adding a
"?qty=10"
parameter to this URL without any change.
This does not work either:
Mage::helper('checkout/cart')->getAddUrl($groupedProduct, array('super_group' => array(2 => 99)));
This seems to completely ignore the second parameter.
Any ideas how I can create an URL that adds the simple product to the cart with the association to the grouped product?