How to create configurable product using magento api?

主宰稳场 提交于 2019-12-20 09:45:08

问题


How can I create a configurable product using the Magento api?


回答1:


Your question of creating a configurable product using the API - the answer is: You can't. It doesn't support it (yet at least.)




回答2:


This is possible with the magento-improve-api plugin. If you need to control which attributes your configurable product is configurable across, you'll need one of the forks of that plugin in

  • goodscloud/magento-improve-api
  • jdurand/magento-improve-api
  • dexteradeus/magento-improve-api



回答3:


Here's a really good tutorial that walks you through patching the API, so you can use the API directly to create the configurable product, and assign simple products to it as well.

Good luck




回答4:


Copy/pasted from http://www.magentocommerce.com/wiki/doc/webservices-api/api/catalog_product#example_2._product_createviewupdatedelete

$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');

// default attribute set in my install is 4
$attribute_set_id = 4;

// configurable product to create
$product_sku = 123456789012;

$newProductData = array(
   'name'              => 'name of product',
   // websites - Array of website ids to which you want to assign a new product
  'websites'          => array(1), // array(1,2,3,...)
  'short_description' => 'short description',
  'description'       => 'description',
  'price'             => 12.05
);

$proxy->call($sessionId, 'product.create', array(
  'configurable', 
  $attribute_set_id, 
  $product_sku, 
  $newProductData
));

The hard part is assigning simple products to your configurables (not supported via the api). Here's a method for assigning simples to configurables directly



来源:https://stackoverflow.com/questions/5790377/how-to-create-configurable-product-using-magento-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!