Magento 1.5,数字SKU和productIdentifierType

cod*_*ike 2 c# magento magento-1.5

在Magento 1.5中,从C#访问catalogProductInfo API调用,这适用于非数字SKU:

catalogProductRequestAttributes fetchattrib = new catalogProductRequestAttributes();
fetchattrib.attributes = new string[] { "name", "description", "and_so_on"};
fetchattrib.additional_attributes = new string[] { "custom_attribs_go_here"};

string storeView = null;
string productIdentifierType = null;
catalogProductReturnEntity ret = m_magentoClient.catalogProductInfo(
    sessionId, sku, storeView, fetchattrib, productIdentifierType);
Run Code Online (Sandbox Code Playgroud)

但是使用数字SKU,我得到"产品不存在"错误.
据推测,这是因为Magento无法判断您是将它传递给product_id还是SKU.将productIdentifierType设置为'sku'应该在理论上根据我能找到的所有文档来解决这个问题:

...
string productIdentifierType = "sku";
...
Run Code Online (Sandbox Code Playgroud)

但它没有解决它.
事实上,它似乎使情况变得更糟,Magento然后停止寻找非数字SKUS.
所以大概"sku"不是正确的价值.

有人有任何想法吗?

Tur*_*mer 10

纯数字或混合SKU有一个解决方法,对我来说很安静.

只需在SKU末尾添加一个空格即可.Magento会将该值解释为SKU,因为空格是非数字的.Internaly Magento后来修剪了空白

这完全适用于Magento 1.4.x - 1.9.(编辑:感谢Brett用1.9进行测试)

例:

    catalogProductReturnEntity ret = m_magentoClient.catalogProductInfo(sessionId, sku+" ", storeView, fetchattrib, productIdentifierType); 
Run Code Online (Sandbox Code Playgroud)