Magento API: Associate simple products to configurable or grouped product

By default, Magento API does not allow to assign products to any configurable or grouped product. Here is an extension that will allow you to do so by simply specifying the simple products skus to associate when creating configurable or grouped product.

Extension installation

Extension is available on GitHub: https://github.com/jreinke/magento-improve-api

You have 2 ways to install it:

  1. Manual installation : download package here, unzip in Magento root folder, then clean cache.
  2. Installation with modgit:

    modgit -e README.md clone bubble-api https://github.com/jreinke/magento-improve-api.git

    See a full example of how to use modgit here.

Usage

To associate simple products automatically and regardless of the API version of Magento you are using (v1, v2, v2 + WSI-Compliance), simply add a key associated_skus to product data array of configurable or grouped product to create/update.

Example with configurable product API v1: Show

Example with configurable product and API v2: Show

Example with configurable product and API v2 + WSI-Compliance: Show

Other improvements

The extension makes other improvements that will be described in another post. These are listed below:

  • Ability to specify category names rather than ids;
  • Ability to specify the name of the attribute set rather than the id;
  • Ability to specify options labels rather than the ids;
  • Ability to specify the website code rather than the id.

99 Responses to “Magento API: Associate simple products to configurable or grouped product”

  1. ealexis says:

    When you say “By default, Magento API does not allow to assign products to any configurable or grouped product”, thats is not exactly true, with V1 api you can do something like :

    foreach ($product->associated_skus as $associated_sku) {
    $proxy->call($sessionId, ‘product_link.assign’, array(‘grouped’, $groupedProduct>sku, $associated_sku));
    }

    Anyways, magento is poorly documented

  2. ealexis says:

    I tried to implement your code for configurable product but it doesn’t seems to works. I am on Magento ver. 1.5.1.0

  3. ealexis says:

    True ^^ Well, i followed the steps for the manual installation and use the code in “product API v1″.
    I made sure the SKU’s in ‘associated_skus’ matches with the ones from the singled product i added before.

    The products adds correctly but the link between the Configurable product and the Simple products is not made. I don’t have any soap exception to see what happens

  4. Gabriel says:

    Hey man!
    Great post!
    It is what I was looking for :)

    But I have 1 question:
    I have some configurable products that are using two attributes (color and memory card).
    Using your module I’ve created the product (like red+ 2GB, blue+4GB), but I’ve failed when trying to set up the correct price for each attribute value.

    For example:
    For the color: ‘red’ , the price increases $5.00
    For the memory card ’2GB’, $15.00.

    There is any way to do it using your module ?

    Thanks

  5. erraprod says:

    Hi,
    finally i updated my magento build to latest (1.7.0.0) and now it works !Simple products are correctly associated with configurable and grouped products via “associated_skus” column, thanks for your code snippet man !

  6. ErraProd says:

    Yes, it’s not because of Magento 1.7, i made some tests back on my 1.5.1.0 and it’s working.
    In fact i imported my simple products the wrong way (without the “dropdown list” type attribute set, in “global scope” and with “Use To Create Configurable Product” to yes).
    So the products were associated internally but not shown because they were badly configured !

  7. Great work!

    I just created the configurable products out of my ERP system written in Java over WS-I v2 SOAP API.

  8. cimi says:

    Does it work for existing configurable products? Or, do I have to assign all simple products at the creation of the configurable product?

    I created configurable product before, and now I have a new color of it and I want to add this new color to it.

  9. Carlos says:

    Hi, I try to use your code for API 1.0, but the link between the configurable and simple produtct was not made. I use your code in a simple instalattion of magento. Can you help me?

  10. Marcos Curcio Gomes says:

    Hello my friend. Your extension saved my life, and my job too. I used with c# and WebService. I’m just having one problem: I want to insert the price changes on c#. I think could be something like this:

    product.price_changes = new associativeEntity[2];
    product.price_changes[0] = new associativeEntity();
    product.price_changes[0].key = “Preta”;
    product.price_changes[0].value = “120″;
    product.price_changes[1] = new associativeEntity(); product.price_changes[1].key = “Azul”;
    product.price_changes[1].value = “114″;

    When I save the configurable product, a exception appears:”Cannot use object of type stdClass as array”

    Could someone tell me how to do the price changes???
    Thanks

  11. Marcos Curcio Gomes says:

    I think may be a problem caused by the type of price_changes inside the wsdl.xml file . I need something like a complexObjectArray. I already tried to change the configuration of to complexFilterArray but the same error is ocurring.
    I just need to set the value of the price_changes inside my program in c#.
    Thanks.

  12. Ken says:

    I have a bit of confusion.

    I’m looking for a free/opensource solution to define the “super” attributes of a configurable product via xmlrpc api. Does this patch allow for that?

    I see what appears to be super attributes “color” & “size” in the price changes array. Is this the mechanism? I do not require/want price differentiation based upon super attributes.

    Any guidance would be appreciated.
    Thanks.
    -Ken

  13. Jude says:

    I’m trying to test your API here (in v1) but it doesn’t work…

    The configurable product and simple products are correctly created but any simple product is associated to the configurable product.
    I use Magento 1.5.0.1 and also the extension “Simple configurable product”.
    I really need to create configurable products via webservices ; how can I do ?

    In the BDD, the fields has_options and required_options in the table catalog_product_entity are at 0 ; perhaps there’s a problem here ?
    Can you help me ?

    • Johann Reinke says:

      Sorry I can’t help without more info, I don’t know how you call the webservices and which params you send. Maybe you have a conflict with the other module you are talking about.

  14. Dano Blanchard says:

    Johann,

    I know this is developed for CE 1.6+… What do you think the chances are that this will work in EE(1.12)? We are running into the same issue in EE where we can push the simple products but cannot not associate them to configurable products (we can associate to grouped products as mentioned)… but that’s not what we need for color/swatch selectable product displays.

    • Johann Reinke says:

      It should work fine in EE 1.12 but let me know if something is wrong with it.

      • Johann,

        I am more than happy to report (you should see the smiles) that your API extension works just fine on Enterprise Edition v1.12. Thank you so much for this piece of work. IMO you fixed a major hole in the Magento API that Magento wasn’t taking any responsibility for. Mage staff told me this issue wasn’t even in their road-map.

        Only one odd behavior we can’t figure out… Products go in perfectly and appear 100% correct in admin… (visibility, in-stock, enabled, inventory, etc.) however, the item/s show as unavailable/out of stock on the front-end. All we have to do is open the Config product in Admin (do nothing) and save it. Then the item displays in stock on the front end. Any ideas?

        Cheers!
        Dano

        • Jerome says:

          Hi Dano,

          I am having the same problem. Products are correct in admin, but not visible in the front.

          Have you figured out what the solution is?

          • Chron-O-John says:

            Hi,

            just wanted to say that I’m investigating this right now and I’m quite positive that I’ll find a solution quite soon. By comparing the Database before and after saving in the Admin Panel, and trying out every change one by one, I found out, that the DB-Field for the configurabe Product needs to be added in catalog_product_index_price and the Stock status for the configurable also needs to be created (cataloginventory_stock_status) although I don’t manage stocks.

            Now I just need to automate this somehow – maybe by updating the Plugin…

  15. Jim says:

    Johann,

    Amazing tutorial!
    I have one issue though.

    I have a configurable product that has 2 configurable attributes available. When I create a product using the Admin I choose one of both.

    Now, when I create a product with the API, It’s as if both attributes were selected.

    Is there any way to specify on which attribute my configurable product is based?

  16. Marcos says:

    Jim, I have the same problem.Could you make contact with me on marcos@tedsys.com.br if you got something? Thanks

  17. Stefano says:

    Wonderful… thank you for you work!!!
    (the extension works well with Magento ver. 1.7.0.2)

  18. Anu says:

    I have to create a grouped using magentoApi. And also I need to associate simple products to this grouped product. Using ‘associated_skus’ => array(‘SKU-001′, ‘SKU-002′) i am able to create grouped product with associated simple product.

    Instead of this sku is it possible to use custom product attribute? for example i have an product attribute “Itemcode”. Is it possible to use this attribute to add simple product…
    please guide me

    Regards
    Anu

  19. Jon says:

    Any thoughts on adding the “associated_skus” attribute to the catalogProductInfo API, so we can query which SKUs are associated for a configurable product?

  20. Renan says:

    Hello Johann, im Renan from Brazil. You are doing an amazing thing sharing your knowledge with us. Thank you very much!!!

    I did install using github, but inside visual studio when i update the service reference the catalogProductCreateEntity doesn’t have the associated_skus property inside the webservice definition(http://myurl/magento/index.php/api/v2_soap?wsdl=1), so it isn’t possible for my code to run. Can you help me find the solution?

    another doubt is about the cache you say. Is it that cache inside magento? or other cache? Can you please specify what cache is?

    Thank you very much!

    Renan

  21. Dimitris says:

    Hello, this gone work in 1.7 also?
    has anyone test it?

  22. Muhammad Raza says:

    Thanks Alot Sir…
    its really helping for me….
    i was struggling from last week to do this….by using your code i have done it……… God Bless you…. Stay blessed

  23. Dimitris says:

    thns Muhammad.
    i am facing a strange issue in my case.. i can add the configurable product, but cannot add assos=ciated products.

    Even i am in magento admin, and editing the configurable product, i canot search and add form already simple products.
    BUT if i create a new one, then its working

    • Michael says:

      Hi Johann, hi Dimitris,

      I tried to use your code. I can create an simple product with the right attributes, but I can’t associate the simple product to the configurable product. Maybe you can help me.

      I try to use this code:

      $productData = array(
      ‘associated_skus’ => array(’1000102001′), // Simple products to associate
      ‘price_changes’ => array(
      array(
      ‘usb_memory’ => array(
      56 => ’0′
      ),
      ‘usb_colour’ => array(
      63 => ’0′
      ),
      ),
      ),
      );
      // Creation of configurable product
      $result = $proxy->catalogProductUpdate($sessionId, 4120, $productData);

      I get the response “true”.
      But in the configurable product I see no associated product and can’t search for it.
      4120 is the product id for the configurable product.

      Thanks and regards,
      Michael

  24. Daver says:

    Hi Johann,
    I am using your free extension for adding configurable products through SOAP and it is mostly working well. Thank you for writing this!

    I am having a problem with setting prices for different colors. There are no errors when I run the SOAP script, but when I look at the configurable product afterwards, the price remains the same when selecting different colors. Perhaps I am not setting it correctly in the script. I am using the version from Nov 6, 2012 on enterprise 1.12.

    Magento is configured to use ‘color’ as the only attribute matching simple products to configurable.

    My script looks something like this:

    $associated_skus = array();
    $price_changes = array();
    $price_changes['color'] = array();
    $usual_price = ’10.00′;
    $product1 = array(….) // name, price, color, etc..
    $product2 = array(….) // name, price, color, etc..
    $simple_product_list = array($product1, $product2);

    foreach($simple_product_list as $product) {

    $productData = array(
    ‘name’ => $product['name'],
    ….
    ‘price’ => $product['price'],
    ‘color’ => $product['color']
    )
    $proxy->call($sessionId, ‘product.create’, array(‘simple’, ‘Default’, $product['sku'], $productData));
    array_push($associated_skus,$product['sku']);
    $price_changes['color'][$product['color']] = (float)$product['price'] – (float)$usual_price;

    }

    $productData = array(
    ‘name’ => ‘Configurable product’,
    ….
    ‘price’ => $usual_price,
    ‘associated_skus’ => $associated_skus,
    ‘price_changes’ => $price_changes
    )
    $proxy->call($sessionId, ‘product.create’, array(‘configurable’, ‘Default’, ‘SKU-TEST’, $productData));

    This approach successfully adds the simple and configurable products, associates them, and the color selection works correctly. But the prices of the different colors remain the same when I select different colors.

    The admin panel for the configurable product, in the section “Super products attribute configuration”, color is shown as the selectable attribute but there are no price differences listed.

    Am I setting the ‘price_changes’ attribute correctly?

    • Daver says:

      I found the answer to my own question. It appears that in the line:

      $price_changes['color'][$product['color']] = (float)$product['price'] – (float)$usual_price;

      $product['color'] has to be the language-dependent label color (for example “Red/Black”) and NOT the magento ID for the color (for example “243″).

      This is now working in one store in one language. But if I create a store in a different language and want to use translated words for the colors, it seems that would break this??

      It would be better if I could use the Magento ID numbers for the $product['color']. That way, the same products and price changes will work with different languages. Is my understanding correct?

      So I have a feature request: Could you add an option to use the Magento ID numbers for the color instead of the color label/name?

  25. Piernitas says:

    Hello,

    I must say, that is a great module and definitely a life-saver. How Magento willingly ignores such a basic requirement is beyond me. So thanks are in order.

    Your module seems to work exactly as advertised but I’m curious about how it handles multi-select attributes. I have, so far not been successful in specifying multi-select options when creating a product. I’ve tried associating an array to the attribute key and I’ve even tried comma-separated values but it’s all been without success.

    ex (using V1):

    ‘activities’ => array(‘activity1′,’activity2′);
    OR
    ‘activities’ => ‘activity1,activity2′;

    I am, of course, using the option labels and not the IDs because I can’t retrieve the option IDs through the standard API (another Magento miracle) and since your module seems to add the ability to use labels for options, I am assuming that the same goes for multi-select options. But I can’t make it work and I haven’t seen an example of this.

    I am looking through the code as we speak to try to figure this out but any help would be appreciated and would probably benefit others as I’d hate to think that I am the only one who needs to create configurable products having multi-select attributes through the API

    Cheers,

    • Piernitas says:

      Ok, I had a look at the code and I noticed that the getOptionKeyByLabel function in Helper/Catalog/product.php used by api.php doesn’t handle arrays, only values. So if anyone is interested, I modified it on my copy and tested it. I can confirm that it works. Here is the modified function:

      public function getOptionKeyByLabel($attributeCode, $label)
      {
      $attribute = Mage::getModel(‘catalog/product’)->getResource()
      ->getAttribute($attributeCode);
      if ($attribute && $attribute->getId() && $attribute->usesSource()) {
      if(is_array($label)){ // Added by Piernitas
      $options = array(); // Added by Piernitas
      foreach ($attribute->getSource()->getAllOptions(true, true) as $option) { // Added by Piernitas
      if (in_array($option['label'],$label)) { // Added by Piernitas
      $options[] = $option['value']; // Added by Piernitas
      } // Added by Piernitas
      } // Added by Piernitas
      return $options; // Added by Piernitas
      }else{ // Added by Piernitas
      foreach ($attribute->getSource()->getAllOptions(true, true) as $option) {
      if ($label == $option['label']) {
      return $option['value'];
      }
      }
      } // Added by Piernitas
      }

      return $label;
      }

  26. Vic85 says:

    Hi,

    How can i manually download this mod? It says “here aren’t any uploads for this repository”? Please let me know.

  27. Denzel says:

    I have got this working thank you for sharing it with us. A question If I may…

    I have created 3 extra attributes Colour,Size & Finish.

    When I create the simple products and the configurable product I have entered a value for each attribute – e.g.

    Product 1 -> Blue -> Large -> Gloss

    etc, etc

    This works fine the configurable product will show front end and I can make my choices via the drop downs.

    My issue is now, not all configurable products I have will have a finish. They will for example have a colour & size: e.g.

    Product 2 Red -> Large

    The simple products will not become accosiated with the configurable product unless I specifiy a “finish” for the simple products. Am I going wrong somewhere? Can someone point me in the right direction to fix this?

    Thanks

  28. Trung says:

    Hi,
    Can we associate the image of exist simple product to configurable product with this API ?

    Thanks

  29. Bruno says:

    Hello.
    That did not work for me.
    I use version 1.7.0.2 of Magento. So I copied the folder “app” extension to the root of magento, put the windows to merge folders. Updated the cache (but it was already disabled).
    Then I copied the example “API V1″, I set my three parameters (address of the wsdl file, user api, api password) and then immediately put it to run. Not accused any errors, BUT … simple products were not associated with the configurable product!
    I entered the configurable product edition and did not list any items associated with it.

    What can it be? How to know the version of my API? How to know if the extension is working properly?

    Thank you,
    Bruno Videira.

  30. Andrew Heron says:

    My friend, you have done a wonderful thing here! 2 minutes to install, 30 seconds to modify my script, seems to work perfectly. You have saved me a LOT of time.

  31. Hager Aly says:

    thanks for your great effort. i’m new to magento and i want to use magento improve api with magento GO store

  32. Jem says:

    Thank you man, save my life…

  33. Vimal says:

    Hello,

    Following url is great from get help for creating simple and configure product using magento api :

    http://www.webslike.com/Thread-How-To-Create-Simple-And-Configure-Product-Using-Magento-API

  34. I’m using the Magento API to port products between 2 Magento systems and the bugbear has always been the configurable products. After installing this API, it works beautifully (although I will have to make 2 passes – all the simples first and then the configs)

    The only real problem was that the API call that GETs the product details from the OLD system DOESN’T tell you the associated products!

    So here’s the solution if you want to do the same thing :
    Edit the file in the OLD system : \app\core\Mage\Catalog\Model\Product\Api.php (if you are going to continue to use this then put this file in ‘local’)

    Find the method ‘info’. After the code that sets up the $result array and before the ‘foreach’ loop, insert this block of code :

    $childProducts = Mage::getModel(‘catalog/product_type_configurable’)->getUsedProducts(null,$product);
    if($childProducts) {
    $associated = array();
    foreach($childProducts as $child)
    $associated[] = $child->getSku();
    $result['associated_skus'] = $associated;
    }

    Now when you call the API you will get the SKUS in the sub-array ‘associated_skus’. You can then simply use the extended API as directed. All the data is already in the correct format.

    Barny

    • Wouter says:

      I use the API v2. So I added your snippet to the Info method in “Catalog/Model/Product/Api/V2.php”. After removing cache from the site and updating the api service the associated_skus property is not showing.

      Can you guide me in the right direction in how this is possible or what I need to do more to achieve it?

  35. Vimal says:

    Hello,

    Here is the good example for get simple product id at the configure product detail page at the time of selction of dropdown in magento.

    http://www.webslike.com/Thread-How-to-get-simple-product-id-on-configuarable-product-detail-page-in-Magento

  36. owen says:

    Hi, how do i disable price calculator for the dropdown bar (ie- +£4.50) i dont want a + price calculator or a % adder,seems to be one thing after another with magento,i started from scratch along side our web developer and we help each other out and have cracked a lot of it apart from this last hurdle (or is it!!!!!)Magento ver. 1.7.0.0 please help before i go doolally!!!

  37. Bruno Viana says:

    Man, that’s AWESOME! Congrats! :D

  38. Jason says:

    I noticed your example for the API v2 is using the v1 method for creating the configurable product (see the last line in the example). Is this required for your extension to work, or just a copy and paste typo?

  39. Tom says:

    I just wanted to say thank you for sharing. It works right out of the box :-) . Keep it up and nice articles by the way. Merci!

  40. Vimal says:

    Hello,

    For Add Product Options Value Using Magento API and Excel Sheet great help at folllowing url :

    http://www.webslike.com/Thread-How-To-Add-Product-Options-Value-Using-Magento-API-and-Excel-Sheet

  41. Sebe says:

    Hey,
    at first nice work.

    I’ve got a question, does the “price_changes” work? I get always “Cannot use object of type stdClass as array”

  42. Roberto says:

    Hello I have this problem:
    There are no errors when I run the SOAP script, simple and configurable product are created and associated with correct attributes. But in product page of front-end, the drop down list aren’t present. I can’t make the choice.

    If in back-end I open configurable product and save (without any changes) the dropdown list become visible on frontend.

    Any ideas?

  43. Fernando Braz says:

    I create simple product and configurable product, but the simple no associate with the configurable in the admin panel.
    Error:
    Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object has no ‘key’

    My code:
    https://docs.google.com/file/d/0B1ZZzYnUl2GZX0hiMUY2Ym91VVE/edit?usp=sharing

  44. Hi, i am new to megento api integration.
    I downloaded the app folder and overwrite in root of my megento host.
    Next i am reading Usage section of article.
    There you have 3 different types of code.
    I have following questions regarding it.
    1. Where do i put that code ?
    2. where can i find api_key & api_user?
    3. how do i test once i done all steps you written ?
    Please help.
    Thanks

  45. Andy says:

    V2 does not work for me. I went in to the code and threw an exception with serialized data and got back the default items such as name fine. However associated_skus was not there even though i have set it in my update clause. I changed over to V1 for this operation and it worked fine.

    I am running v1.7.0.2.

  46. How can i assign simple products to existing configurable product without creating new configurable product ?
    In your V2 code, at the end you have
    $proxy->call($sessionId, ‘product.create’, array(‘configurable’, ‘Default’, ‘SKU-TEST’, $productData));
    Isn’t this for V1 ??? will it work for V2 call ????
    It should be i think :
    $proxy->catalogProductCreate($sessionId, ‘configurable’, ‘Default’, ‘SKU-260′, $productData);

  47. Samuele says:

    Fantastic!
    This script is perfect

  48. Akiles says:

    Hi, I’ve been using this extension to version 1.7.0.2 and it works perfectly, we have now updated to version 1.8 and has stopped working, you’ll update the extension to work in this version?
    thanks

  49. Bruno Viana says:

    Hi, I’m having problem when I call ‘product.update’ method. It just dont update the relationship with simple products. Here the example code:

    $productData = array(
    ‘associated_skus’ => array(‘SKU-TEST2′, ‘SKU-TEST1′),
    );

    // Creation of configurable product
    $client->call($session, ‘product.update’, array(‘SKU-TEST-CONF’, $productData));

    Is that correct?

    • Bruno Viana says:

      Sorry, I have not explained the problem correctly.

      The problem is that when I create the product and join him a few simple products and then when I try to do an update it does not associate correctly.

      Example, if I create the configurable product and say that it is associated with product-1, product-2 and product-2 and then if I do an update saying that he will join the product-4, product-5 and product -6 it removes all associations and keeps only the product-4.

      • Alan says:

        I have exactly the same issue, I have an exising configurable with say 2 simples sizes Small and Medium. I then add a new simple size Large and update the configurable with the sku’s for all 3, but the Configurable association only shows the Large, if I run it again and update the Configurable with all 3 sku’s again it then flips them back to just showing Small and Medium. I am using Magento 1.8.1.0 and Soap V2.
        I can get round it by deleting all the simples and re-creating all 3 then it’s fine and subsequent updates are fine, but this is slow.
        I would be grateful if any one can help.

  50. Bruno Viana says:

    Well, think I found a solution. I opened the file app/code/community/Bubble/Api/Helper/Catalog/Product.php on line 26 and changed this:

    $usedProductIds = array_diff($newProductIds, $oldProductIds);

    to this:

    $usedProductIds = array_merge($newProductIds, $oldProductIds);

    :D

  51. mak says:

    I am trying to use this api. But I have never worked with api. How to use this with magento.
    Where should I write the code given under Example with configurable product API v1:

    please suggest.

  52. Longet says:

    Hi is it working on a magento 1.4.1.1. I installed it without any issues, but got an access denied on the admin module.

    Any idea ?

    regards

  53. vadhel says:

    Hello,

    Have latest version for magento 1.8 ?

    thx

  54. kem says:

    Hi
    Will this be compatible with Magento 1.8?

    Thanks
    Kem

  55. Urby says:

    Hi there,

    I would also like to know if this is compatible with Magento 1.8.0.1 as our client is looking to update their site to the latest Magento version.

    Many thanks,
    Andy

  56. Alan says:

    Are you able to update existing configurable’s with new simples
    eg a configurable product which has sizes as simple products and a new size becomes available

  57. Hi Johann

    I’ve been using your API extension for about a year now and I’ve been very happy with it.

    Today I received an error from one of my customers. He tried to create a configurable product with a couple of simple products associated with it. The product property was size of shoes and he tried to create 44, 46, 48 as sizes, but the values 044, 046, 048 was already created in the product properties for size, so insted of 48 as size, the simple product was created as 048.

    I looked through your code and found the method getOptionKeyByLabel in Product.php. You compare the labels using this code:

    foreach ($attribute->getSource()->getAllOptions(true, true) as $option) {

    if ($label == $option['label']) {
    return $option['value'];
    }

    I changed this to the following:

    if (strcmp($label, $option['label']) == 0) {
    return $option['value'];
    }

    This string compares the values instead and that fixed my problem.

    This post was just to inform you of the bug and to say how happy I am with this extension.

    Best regards,
    Jens Juul Nielsen

  58. John Taylor says:

    Hi,

    Will this extension work with the REST API ?

    When I try to create the configurable product I get an error:
    [code] => 405
    [message] => Creation of products with type 'configurable' is not implemented

    I'm sending the following data, which I've had to modify slightly from the SOAP examples.

    $productData = array(
    'sku' => 'SKU-003',
    'type_id' => 'configurable',
    'attribute_set_id' => 4,
    'name' => 'Configurable product',
    'description' => 'Description of configurable product',
    'short_description' => 'Short description of configurable product',
    'website_ids' => array('base'), // Id or code of website
    'status' => 1, // 1 = Enabled, 2 = Disabled
    'visibility' => 4, // 1 = Not visible, 2 = Catalog, 3 = Search, 4 = Catalog/Search
    'tax_class_id' => 2, // Default VAT
    'stock_data' => array(
    'use_config_manage_stock' => 0,
    'manage_stock' => 0, // We do not manage stock, for example
    ),
    'price' => 9.90,
    'associated_skus' => array('SKU-001', 'SKU-002'), // Simple products to associate
    'price_changes' => array(
    'color' => array(
    'Red' => '2',
    'Blue' => '-10%',
    ),
    'size' => array(
    'Large' => '+1',
    'Medium' => '-3',
    ),
    ),
    );

    Thanks
    JohnT

  59. Keith Crooks says:

    Hi

    This has been very useful.

    A quick question though – does this work for updating a product as well as creating?

    For example, if I create a configurable product with 4 associated simple products, if I want to create and associate a new simple product to this configurable product, can I do an update on the original configurable product to associate the new simple product?

    Thanks

    Keith

    • Keith Crooks says:

      For anybody is wondering, I’ve worked out that it does work for updates as we as product creation.

      However, if you try to add a simple product to an existing configurable product that already has simple products assigned, the associations to the original simple products get replaced by the new product(s).

      This seems to be caused by the Bubble_Api_Helper_Catalog_Product::associateProducts method (app/code/community/Bubble/Api/Helper/Catalog/Product.php) which gets the IDs for all associated_skus and then removes the IDs of any products that are already associated.

      I have commented out lines 21-26 and set $usedProductIds = $newProductIds and it now works as I would expect it to.

      Thanks

  60. Daniel says:

    Hi

    this extension looks so nice!

    Unfortunately i have the same problem as given by Andy in post no. 45.

    I am connected to the Magento API using C# – therefore i need to use API v2 with WSI-compliance.

    Was really grinds my gears is that the newly added fields (associated_skus, configurable_attributes and price_changes) are not transmitted to Magento.

    When sniffing the network traffic using Fiddler i see that they are sent by C#. But when i throw any SOAP Fault in your API like..

    $this->_fault(‘data_invalid’,var_export($productData,true));

    ..i see all my data except the three new fields.

    It would make me really happy if someone could help me fixing this.

    Thanks
    Daniel

    • Daniel says:

      I fixed it myself.

      Seems like the wsi.xml file was not interpreted correctly by the soap server. The wsdl-file to parse with C# was generated properly, but somewhere somehow the soap server drops some fields when parsing the request.

      I added the new fields in the magento core wsi.xml-file and cleanded the cache.

      I know that this is not the nicest solution, but it works for me. If someone had the same problem, i would like to hear from you.

      To contact me personaly simply contact our company (click on my Name, go to the contact form, and name my name).

      Thanks
      Daniel

      PS: I hope i could help someone out there ;)

  61. Chris says:

    Thanks for this extension – exactly what I was looking for and it’s amazing that magento haven’t included this already. I’ve got it working on Magento 1.8.
    A couple of things that caught me out:
    1. It wouldn’t work to start with because my application was caching the wsdl – so I had to set it to not cache (basic error).
    2. The configurable_attributes only takes attribute ids not codes.
    3. Don’t forget to check the /var/log/syslog.log for any obvious problems. File permissions were causing me some problems to start with.

  62. Vivek says:

    I want to create grouped product in a grid view.

    Please check this link http://www.tacklewarehouse.com/Buckeye_J-Will_Flipping_Jig/descpage-BJWJ.html#multiview

    Please check the options for the grouped product.

    Please help me how can i do this.

    Thanks

  63. Yeray says:

    You saved my life!

    Works perfectly fine in my Magento 1.8.1

    Thanks a lot. Really good work.

  64. pEDRO says:

    Works fine on 1.8.1 just few changes on examples.

    Thanks a lot.

  65. Umesh says:

    Hi , current I am not able to get the configurable product associated product info in soap V2 response of api catalogProductInfo . It just returns basic attributes , how can i retrieve this is response of catalogProductInfo .
    Can this extension help ?
    Please note I am using Java for soap implementation

  66. Thanks JOHANN REINKE,
    I have successfully, implemented it in our website, its working fine.
    It help me a lot ,

Leave a Reply

* Required fields

Categories