2

Trying to add configurable product in magento cart using magento soap api V1 but not able to add the products. can anyone please let me know the way how to do it. Any help would be appreciated.

4
  • can you put your code.
    – Amit Bera
    Commented Aug 28, 2014 at 7:24
  • This is how i am doing it - $arrProducts = array( 'product_id' => "120", 'sku' => 'ink', 'qty' => '1', 'options' => array( 'key' => 525, 'value' => 99 ), 'bundle_option' => null, 'bundle_option_qty' => null, 'links' => null ); $resultCartProductAdd = $proxy->call($sessionId, "cart_product.add", array($shoppingCartId, $arrProducts));
    – vibhu
    Commented Aug 28, 2014 at 7:26
  • are you doing on configurable product ya bundle?
    – Amit Bera
    Commented Aug 28, 2014 at 7:29
  • need to add all type of products via soap including - configurable, bundle and grouped. just trying to start with configurable products.
    – vibhu
    Commented Aug 28, 2014 at 7:33

1 Answer 1

4

For add to cart of configurable product,you need to super attribute value. in my below if only one super attribute so in super_attribute i have set one value

$quoteId = $client->call( $session, 'cart.create',array( 'default' ));
$arrProducts = array(
    array(
        "product_id" =>"21",
        "qty" => 2,
                "super_attribute" => array(         
                    92 => 162

                 )
    )

);



$resultCartProductAdd = $client->call(
    $sessionId,
    "cart_product.add",
    array(
        $quoteId,
        $arrProducts
    )
);

here 92 is attribute id and 162 it option id if you have more then one variance for then

"super_attribute" => array(         
                    first_attribute_id => first_chose_option_value
                     seocnd_attribute_id => seocnd_chose_option_value.
                     .....



                 )
6
  • works like charm :) :) You saved my day. Can you please give me an example of product array for bundled and grouped too?
    – vibhu
    Commented Aug 28, 2014 at 8:10
  • accepted. Any idea about grouped and bundled?
    – vibhu
    Commented Aug 28, 2014 at 8:19
  • sure.give u idea sortly
    – Amit Bera
    Commented Aug 28, 2014 at 8:23
  • Is this working for associating simple to configurable products?
    – Adam Fili
    Commented Sep 12, 2014 at 8:00
  • i use this code but it return me this message : please specify product options
    – mahdi
    Commented Nov 17, 2014 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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