如何使用Magento中的catalogProductCreate方法创建新产品

时间:2017-07-28 09:44:44

标签: magento

如何使用Magento中的catalogProductCreate方法创建新产品?当我从wsdl类调用此方法时,如何传递此方法中使用的参数?

1 个答案:

答案 0 :(得分:0)

以下Documentation link

的示例代码
$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

// If some stuff requires api authentification,
// then get a session token
$session = $client->login('apiUser', 'apiKey');

// get attribute set
$attributeSets = $client->catalogProductAttributeSetList($session);
$attributeSet = current($attributeSets);

$result = $client->catalogProductCreate($session, 'simple', $attributeSet->set_id, 'product_sku', array(
    'categories' => array(2),
    'websites' => array(1),
    'name' => 'Product name',
    'description' => 'Product description',
    'short_description' => 'Product short description',
    'weight' => '10',
    'status' => '1',
    'url_key' => 'product-url-key',
    'url_path' => 'product-url-path',
    'visibility' => '4',
    'price' => '100',
    'tax_class_id' => 1,
    'meta_title' => 'Product meta title',
    'meta_keyword' => 'Product meta keyword',
    'meta_description' => 'Product meta description'
));