2012-09-17 9 views
0

Magento 버전 1.7로 웹샵을 개설했습니다. 다음으로 v2 Soap API를 사용하여 제품을 가져옵니다. 지금까지 한 가지를 제외하고 모든 것이 작동하는 것처럼 보입니다. 생성 된 제품의 모든 사용자 지정 특성은 비어 있습니다. 다른 모든 것은 잘 작동합니다 - 이름, sku, 가격, 설명 등등. 내 스크립트는 asp.net으로 실행되므로 PHP 코드가 없지만 PHP 코드가 다소 비슷해 보입니다.Magento 1.7 SOAP v2 API - 추가 속성을 사용하여 제품 만들기

dim create as new catalogProductCreateEntity 
create.name = "Test" 
create.price = "11.1100" 
create.description = "test description" 

dim additional(0) as associativeEntity 
dim attribute as new associativeEntity 
attribute.key = "manufacturer" 
attribute.key = "xyz" 
additional(0) = attribute 

create.additional_attributes = additional 

이 경우, 간단한 텍스트 필드의 값이 "XYZ"를 받아야한다 : 여기에 속성이 제품에 할당 내가 사용하는 코드 조각입니다. 저는 이전에 설정 한 다른 Magento 매장에서도 동일한 절차를 사용합니다. 정상적으로 작동합니다. 유일한 차이점은이 상점에서는 Magento 버전 1.5를 사용한다는 것입니다. 이것은 api의 버그 일 수 있습니까?

답변

0

는 "XYZ"는 associativeEntity의 .value에 갈 필요 :이 도움이

dim additional(0) as associativeEntity 
dim attribute as new associativeEntity 
attribute.key = "manufacturer" 
attribute.value = "xyz" 
additional(0) = attribute 

희망을.

내가 성공적으로 C#에서이 작업을 수행 한
0

, 아래의 코드

 private void getAdditionalAttributes() 
      { 
       string skuNumber="S00001"; 
       MagentoService mservice = new MagentoService(); 
       string sessionkey = ""; 
       try 
       { 
        sessionkey = mservice.login("apiuser", "apipassword"); 


       } 
       catch (Exception exp) 
       { 

        //Error 
       } 

       try 
       { 
        catalogProductRequestAttributes fetchattrib = new catalogProductRequestAttributes(); 
        // it will only populate the attributes that you ask for 
        fetchattrib.attributes = new string[] { "name", "description", "short_description" }; 
// Additional Attribute 
        fetchattrib.additional_attributes = new string[] { "ismemo","color" }; 

    catalogProductReturnEntity prod = MagentoConnectivity.magService.catalogProductInfo(sessionkey, skuNumber, "", fetchattrib, "sku"); 


        foreach (var item in prod.additional_attributes) 
        { 
         MessageBox.Show("=> Key: " + item.key + "\t Attribute Value=" + item.value + "\n"); 
        } 

       } 
       catch (Exception exp) 
       { 

        MessageBox.Show("=> Exception in getting Additional Attributes \n" + exp.Message + "\n"); 
        return; 


       } 
      } 
입니다
관련 문제