【问题标题】:Set Magento Attribute to Configurable Product with Soap API使用 Soap API 将 Magento 属性设置为可配置产品
【发布时间】:2011-04-08 09:50:11
【问题描述】:

我需要通过 Magento Soap API 创建一个新的可配置产品并向其添加相关产品。

我使用此代码创建 2 个产品(一个简单产品和一个配置产品。)然后我尝试将简单产品链接到配置产品...这不起作用.. 有一个教程可以做到这一点?? 有什么帮助吗?? 非常感谢。

// Magento login information 
    $mage_url = 'http://test.de/api/?wsdl'; 
    $mage_user = 'admin'; 
    $mage_api_key = 'admin'; 
    // Initialize the SOAP client 
    $soap = new SoapClient( $mage_url ); 
    // Login to Magento 
    $session = $soap->login( $mage_user, $mage_api_key );



    $attributeSets = $soap->call($session,'product_attribute_set.list');
    $set = current($attributeSets);

    $sku = 'iphone-12345';

    //configurable

    $newProductData = array(
        'name'              => 'iPhone',
        'websites'          => array(1),
        'short_description' => 'short description',
        'description'       => 'description',
        'price'             => 150,
        'status'            => '1',
        'categories'    => array(138),
    );



    $newProductRelated = array(

        'name'              => 'iPhone',
        'websites'          => array(1),
        'short_description' => 'short description',
        'description'       => 'description',
        'price'             => 150,
        'status'            => '1',
        'sku'               => '2551464'
            );



    $productId = $soap->call($session,'product.create',array('configurable', $set['set_id'], $sku ,$newProductData));
    $productId2 = $soap->call($session,'product.create',array('simple', $set['set_id'], $newProductRelated['sku'] ,$newProductRelated));




    $soap->call($session, 'product_link.assign', array('configurable', $sku, $newProductRelated['sku'], array('position'=>0, 'colore'=> 21, 'qty'=>6)));

再次感谢。

【问题讨论】:

    标签: api soap magento magento-1.4


    【解决方案1】:

    处理类似的问题并使用 CSV 导入来为从 API 导入的产品创建关系。这可能是一种通过生成的 CSV 一次性导入的可用方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-25
      • 2014-11-28
      • 1970-01-01
      • 2012-05-06
      • 1970-01-01
      • 2017-03-03
      • 1970-01-01
      相关资源
      最近更新 更多