【问题标题】:How to create sub category on Magento APi如何在 Magento APi 上创建子类别
【发布时间】:2011-04-27 07:04:43
【问题描述】:

我目前正在使用 Magento 版本。 1.5.0.1。谁能告诉我如何使用soapv2创建子类别。

这是我的代码格式

category_data = { "name" => "LIGHTING", "is_active" => 1 }
soap.call('catalogCategoryCreate',session,4,category_data,1, "include_in_menu")

我在运行这段代码时遇到了一些错误。

: Attribute "include_in_menu" is required. (SOAP::FaultError)

这是解决这个问题的任何方法吗?

谢谢。

【问题讨论】:

标签: soap magento soap4r


【解决方案1】:
category_data = { "name" => "LIGHTING", "is_active" => 1, "include_in_menu" => 1 }

【讨论】:

    【解决方案2】:

    这是使用 SOAP V2 创建类别的方法

    <?php
        $host = "192.168.0.10/~aliasgar/magentoext/index.php"; //our online shop url
        $client = new SoapClient("http://".$host."/api/v2_soap/?wsdl"); //soap handle
        $apiuser= "aliasgar"; //webservice user login
        $apikey = "aliasgar"; //webservice user pass
        try { 
    
        $sess_id= $client->login($apiuser, $apikey); //we do login
    
        $result = $client->catalogCategoryCreate($sess_id, 3, array(
            'name' => 'Test Category',
            'is_active' => 1,
            'available_sort_by' => array('position'),
             'default_sort_by' => 'position',
            'include_in_menu' => '1',
        ));
    
        var_dump ($result);
        }
        catch (Exception $e) { //while an error has occured
            echo "==> Error: ".$e->getMessage(); //we print this
               exit();
        }
    

    ?>

    这里catalogCategoryCreate函数中的3是父类id。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-30
      • 2015-02-14
      • 1970-01-01
      • 2023-03-11
      • 2017-05-26
      • 1970-01-01
      相关资源
      最近更新 更多