Magento – Magento Add Configurable Product to shopping cart

addtocartcartconfigurable-productproduct-attributeshopping-cart

how can i add Configurable Product to shopping cart in magento ? i try this code to add simple product to shopping cart but it`s not work for configurable product

    $result = $proxy->shoppingCartProductAdd($sessionID, $cartID, array(array(
    'product_id' => $productID,
    'sku' => $sku,
    'qty' => $qty,
    'options' =>array(0 =>array('key' => $option1id ,'value' => $option1value),1 =>array('key'     => $option2id ,'value' => $option2value)),
    'bundle_option' => null,
    'bundle_option_qty' => null,
    'links' => null
    )));

how can i do this for configurable products ? thanks

edit :
i change my code :

        $product = array(
    "product_id" =>"1300",
    "qty" => 2,
    "super_attribute" => array(         
        152 => 28

    )
);
 $result = $proxy->shoppingCartProductAdd($sessionID, $cartID, array($product));

but it`s return me this message :

please specify product options

152 is attribute id and 28 is option value id

Best Answer

I would recommend simple configurable products

It works with magento 1.9.0.1. You can determine whether the simple or the configurable product is being added to the cart.