【发布时间】:2017-05-16 15:48:22
【问题描述】:
我在 Internet 上找到了 Ez.Newsletter.MagentoApi C# 项目。 我认为它是测试 Magento SOAP API 的好工具。
但是在为 WEEKS 编写了一些代码后,我决定问一个问题。
在项目中,AddOption 中没有ProductAttributeOption 的示例(Link)。
这是我添加到 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
【问题讨论】:
-
它与 'is_default' 选项有关。我做错了什么?
-
有谁知道如何转换这段代码: $label = array ( array( "store_id" => array("0"), "value" => "some random data" ) ); $data = array( "label" => $label, "order" => "10", "is_default" => "1" );转 C#