【问题标题】:Configurable product and its associated product creation using soap api documentation is not in magento api guide.any idea?使用soap api文档创建可配置产品及其相关产品不在magento api指南中。知道吗?
【发布时间】:2017-01-25 10:25:43
【问题描述】:

我正在尝试使用 magento soap api 创建一个可配置产品及其相关产品。产品创建成功,但与相关产品链接的可配置产品无法正常工作,伙计们知道吗?这是我的代码

<?php 
$client = new SoapClient('https://sample.com/api/v2_soap?wsdl=1');

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

// get attribute set
$attributeSets = $client->catalogProductAttributeSetList($session);
$attributeSet = current($attributeSets);
print_r($attributeSet);
$result = $client->catalogProductCreate($session, 'simple',72, 'product_sku0002', 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',
    'additional_attributes' => array(
        'single_data' => array(
            array(
                'key'   => 'color',
                'value' => 'Red', // Id or label of color, attribute that will be used to configure product
            )
        ),
    ),
));
var_dump ($result);
$result = $client->catalogProductCreate($session, 'configurable',72, 'Configurable_product_sku0001', array(
    'categories' => array(2),
    'websites' => array(1),
    'name' => 'Confihurable 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',
    'associated_skus' => array('product_sku0002'),
    'price_changes' => array(
        array(
            'color' => array(
                'Red' => '0'
            )
        ),
    ),
));
var_dump ($result);
?>

【问题讨论】:

  • 该代码是否在日志文件中显示 anny 错误。
  • 日志文件中没有错误。 @DhirenVasoya
  • 你能把你的代码放到try.....catch块中,调试有没有错误。
  • 我把它放在 try.......catch... 没有异常消息.. @DhirenVasoya
  • 可以从管理员重新索引magento。

标签: magento soap magento-1.9


【解决方案1】:
猜你喜欢
  • 2015-02-01
  • 1970-01-01
  • 2014-11-28
  • 1970-01-01
  • 2012-10-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-01
相关资源
最近更新 更多