「店オーナーのカタログ入力タイプ」を「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");
私は間違っていますか?
my_priceの代わりにmyPriceはどうですか?試しましたか? –
私は同じ問題を抱えています。あなたはそれを理解しましたか?私のcatalogProductCrateEntityは何もデータを渡すことはありません。 –