I am adding configurable product in cart programmatically.
$parentId = $post['parrent_product'];
$values = '';
foreach ($post['simple_product_id'] as $id) {
$values .= $id . ',';
}
$params = array(
'product' => $parentId,
'super_attribute' => array(
132 => $values, //132 - super_attribute_code, $values - its a string with simple products(options) ids
),
'qty' => $post['qty'],
);
$cart = Mage::getSingleton('checkout/cart');
$product = new Mage_Catalog_Model_Product();
$product->load($parentId);
$cart->addProduct($product, $params);
$cart->save();
I need to add configurable product with 2 options in cart. For example conf product is "pizza" and 2 options: cheese and tomato. Currently my code adding what i need but the price of options not calculating in cart.