Magento创建产品与c#不传递数据
本文关键字:数据 创建 Magento | 更新日期: 2023-09-27 18:11:41
我已经浏览了整个stackoverflow和Google示例的工作代码,但无法使其工作:
static bool createProduct(string prodName, string prodDesc, string prodShort, string prodPrice, string prodSku)
{
catalogProductCreateEntity newProduct = new catalogProductCreateEntity();
newProduct.name = prodName;
newProduct.description = prodDesc;
newProduct.short_description = prodShort;
newProduct.status = "1";
newProduct.price = prodPrice;
newProduct.tax_class_id = "2";
newProduct.weight = "1";
string defaultAttrubiteSetID = "4";
associativeEntity AdditionalAttributes = new associativeEntity();
AdditionalAttributes.key = "temando_height";
AdditionalAttributes.value = "0.2";
associativeEntity[] AssociativeEntity = new associativeEntity[2];
AssociativeEntity[0] = AdditionalAttributes;
newProduct.additional_attributes = AssociativeEntity;
AdditionalAttributes = new associativeEntity();
AdditionalAttributes.key = "temando_width";
AdditionalAttributes.value = "0.1";
AssociativeEntity[1] = AdditionalAttributes;
newProduct.additional_attributes = AssociativeEntity;
try
{
mservice.catalogProductCreate(mlogin, "simple", defaultAttrubiteSetID , prodSku, newProduct, null);
}
catch (Exception merror)
{
lastError = merror.Message;
return false;
}
return true;
}
我已经尝试了"temandoHeight"answers"temandoHeight"的变化,但它们都不适合Magento 1.8
产品的创建没有任何问题,但是上面提到的我尝试的另外两个附加属性都没有被填充。
任何想法?
Thanks in advance
尝试一下newProduct.additional_attributes。
这就是我在使用API
您是否检查了"temando_height"answers"temando_width"属性的设置,可能需要更改属性的设置。只是例行检查。
另外,您是否尝试发送不同的值,如超过1,通常运输模块他们不接受小于1cm的值。