2011-04-27 19 views
2

我目前正在使用Magento ver。 1.5.0.1。谁能告诉我如何使用soapv2创建一个子类别。如何在Magento上创建子类别APi

这里我的代码格式

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) 

是这个问题的任何解决方案。

谢谢。

+1

http://stackoverflow.com/questions/4604389/magento-create-category-with-soap-v2可能相关。 – B00MER 2011-05-23 21:56:54

回答

0
category_data = { "name" => "LIGHTING", "is_active" => 1, "include_in_menu" => 1 } 
0

这是如何使用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(); 
    } 

?>

这里3在catalogCategoryCreate功能父类ID创建类别。

相关问题