2014-05-18 46 views
2

幾個小時後,我一直在嘗試通過SOAP V2 API創建一個具有其他屬性的產品。只要我致電catalogProductCreate,我就會添加該產品,但我通過請求發送的附加屬性設置爲空。每當我不添加額外的屬性這兩個屬性都設置爲其默認值,所以我認爲屬性正在發送和接收但沒有正確處理?我試過了所有的東西,我已經谷歌搜索,但空了。Magento SOAP V2 API - 其他屬性集爲空

這是我的代碼(C#)

catalogProductCreateEntity cpce = new catalogProductCreateEntity(); 
    associativeEntity[] attributes = new associativeEntity[2]; 
    attributes[0] = new associativeEntity(); 
    attributes[0].key = "product_state1"; 
    attributes[0].value = _stateofbox; 

    attributes[1] = new associativeEntity(); 
    attributes[1].key = "product_state2"; 
    attributes[1].value = _stateofproduct; 

    catalogProductAdditionalAttributesEntity additionalAttributes = new catalogProductAdditionalAttributesEntity(); 
    additionalAttributes.single_data = attributes; 
    cpce.additional_attributes = additionalAttributes; 

感謝您的幫助。

回答

1

修復它,我以爲我必須將預定義屬性的明文/ ID(0,1,2,3)設置爲值associativeEntity。雖然,我發現catalogProductAttributeOptions會告訴你你的值有什麼ID。因此,您必須調用該方法才能找出您應該使用的ID。

相關問題