I am working with configurable product, I have created custom view for displaying configurable product. I am getting error (Please specify the product's option(s)) while adding configurable product to cart. This error occurs only with configurable product.
I am using this code for add to cart
$params = array(
'product' => $product->getId(),
'super_attribute' => array (
133 => '3',
143 => '19',
142 => '18',
141 => '16',
140 => '14',
139 => '12',
138 => '10',
137 => '22',
136 => '9',
135 => '6',
144 => '21',
),
'qty' => 2,
);
$cart = Mage::getSingleton('checkout/cart');
$cart->addProduct($product, $params);
$cart->save();
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
in above code
'super_attribute' => array (
133 => '3',
143 => '19',
142 => '18',
141 => '16',
140 => '14',
139 => '12',
138 => '10',
137 => '22',
136 => '9',
135 => '6',
144 => '21',
)
Array contains attributes value which I have selected for product. I don`t know why this is happening.
After a lot of try I found the error, I was missing two parameter
uenc
andform_key
in$params
array. it should be like this