我已將「my_price」代碼與「商店所有者的目錄輸入類型」設置爲「Price」並將其分配給「Default」(僅限於)屬性集。Magento API v2和C# - 在添加產品時設置自定義屬性
現在,我想設置它的價值,每次我使用API v2(C#)添加/更新產品。這裏是不工作的代碼(值沒有設置):
// Connect & Auth:
Mage_Api_Model_Server_V2_HandlerPortTypeClient handler = new Mage_Api_Model_Server_V2_HandlerPortTypeClient();
session_id = handler.login(username, api_key);
// Getting attributes set:
catalogProductAttributeSetEntity[] attributeSets;
attributeSets = handler.catalogProductAttributeSetList(session_id);
attributeSet = attributeSets[0];
string attributeset_id = attributeSet.set_id.ToString();
// Adding product:
catalogProductCreateEntity mageProduct = new catalogProductCreateEntity();
// (...) setting product's name, sku, etc.
associativeEntity AdditionalAttributes = new associativeEntity();
AdditionalAttributes.key = "my_price";
AdditionalAttributes.value = "12,33";
associativeEntity[] AssociativeEntity = new associativeEntity[1];
AssociativeEntity[0] = AdditionalAttributes;
mageProduct.additional_attributes = AssociativeEntity;
handler.catalogProductCreate(session_id, "simple", attributeset_id, sku, mageProduct, "default");
我在做什麼錯了?
如何myPrice而不是my_price?你試過了嗎? – 2012-01-04 20:36:48
我有同樣的問題,你知道嗎。我的catalogProductCrateEntity從不傳遞任何數據, – 2012-02-03 20:39:58