我在网上找到了Ez.Newsletter.MagentoApi C#项目。我认为它是测试的一个很好的工具。
但是经过几个星期的努力,我决定问一个问题。
在项目中,AddOption在ProductAttributeOption (链接)中没有示例。
--这是我添加到Api解决方案中的公共方法:
public static bool addOption(string apiUrl, string sessionId, object[] args)
{
IProductAttributeOption prox = (IProductAttributeOption)XmlRpcProxyGen.Create(typeof(IProductAttributeOption));
prox.Url = apiUrl;
return prox.addOption(sessionId, _catalog_product_attribute_add_option, args);
},这是添加选项的代码:
bool OptionAdded = ProductAttributeOption.addOption(apiUrl, sessionId, new object[] {
attributeCode,
new object[] {
new object[] {
"0", //store_id
"New Label Name" //value
},
"0", //orderid
"0" //is_default
}
});,但是服务器的错误类似于:
An unhandled exception of type 'CookComputing.XmlRpc.XmlRpcFaultException' occurred in CookComputing.XmlRpcV2.dll Additional information: Server returned a fault exception: [108] Default option value is not defined
发布于 2018-12-27 20:38:15
我自己也遇到过这个问题。我们将Python与Magento1.9 Xml结合使用。
您目前的格式与我最初所做的非常相似:
{'label': {'store_id': '0','value':'Purple'}, 'is_default': 0, 'order': 0}在玩了几次之后,将标签值包装在另一个列表中就达到了这个目的:
{'label': [{'store_id': '0','value':'Purple'}], 'is_default': 0, 'order': 0}这是我的5美分。希望它能帮你前进。
https://stackoverflow.com/questions/41428489
复制相似问题