2014-10-28 83 views
1

Magento 1.9 API SOAP v1SOAP v1中product_atribute.create的錯誤參數Magento

我真的需要幫助!我厭倦了試圖解決這個問題...

問題是當我嘗試撥打product_attribute.create

$arr = array('id_text',array(
     'frontend_input' => 'Voltage', 
     'default_value' => '1', 
     'is_configurable' => 0, 
     'used_in_product_listing' => 0, 
     'is_visible_on_front' => 0, 
     'is_comparable' => 0, 
     'is_used_for_promo_rules' => 0, 
     'is_required' => 0, 
     'scope' => 'store', 
     'is_unique' => 0, 
     'is_searchable' => 0, 
     'attribute_code' => '12345', 
     'is_visible_in_advanced_search' => 0, 
     'frontend_label' => array('store_id' => '1', 'label' => '220V') 
    )); 

    try { 
     $result = $soap->call($session, 'product_attribute.create', $arr); 
    } catch (SoapFault $e) { 
     echo '<p style="color:red;">'.$e -> getMessage().'</p>'; 
     return false; 
    } 

結果返回沒什麼並停止執行,或當我刪除I​​D(「id_text」)返回102 - 無效所需的參數

回答

1

你看到在API的product_attribute.create功能?它只需要一個參數。函數可以參考 - app \ code \ core \ Mage \ Catalog \ Model \ Product \ Attribute \ Api.php --- create()

你傳遞兩個參數,第一個是id_text,第二個是你的屬性數據陣列。 2個參數僅被product_attribute.update接受。在該API中,您必須將第一個參數作爲要更新的屬性的attribute_code。

您可以嘗試使用以下數組調用product_attribute.create API嗎?

$arr = array(
     'frontend_input' => 'Voltage', 
     'default_value' => '1', 
     'is_configurable' => 0, 
     'used_in_product_listing' => 0, 
     'is_visible_on_front' => 0, 
     'is_comparable' => 0, 
     'is_used_for_promo_rules' => 0, 
     'is_required' => 0, 
     'scope' => 'store', 
     'is_unique' => 0, 
     'is_searchable' => 0, 
     'attribute_code' => '12345', 
     'is_visible_in_advanced_search' => 0, 
     'frontend_label' => array('store_id' => '1', 'label' => '220V') 
    );