Magento的1.5,数字的SKU和productIdentifierType [英] Magento 1.5, numeric SKUs and productIdentifierType

查看:145
本文介绍了Magento的1.5,数字的SKU和productIdentifierType的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Magento的1.5,访问从C#的catalogProductInfo API调用像这样的作品与非数字的SKU:

In Magento 1.5, accessing the catalogProductInfo API call from C# like this works with non-numeric SKUs:

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);



但随着数字的SKU我得到'商品不存在的错误。结果
想必这是因为Magento的不能告诉你是否传递一个的product_id或SKU。设置productIdentifierType为SKU应该解决这个问题,在理论上,根据所有文件我能找到的:

But with numeric SKUs I get 'Product not exists' errors.
Presumably this is because Magento cannot tell whether you are passing it a product_id or an SKU. Setting the productIdentifierType to 'sku' should fix that, in theory, according to all the documentation I can find:

...
string productIdentifierType = "sku";
...



但它不解决它。结果
在事实上,它似乎使情况变得更糟,Magento的然后停止寻找非数字的SKU。结果
所以想必SKU是不正确的值通过。

任何人有什么想法?

推荐答案

简短的回答是这有什么地方防止 product.update 的最后一个参数被设置正确的错误(或者瓦瑞恩还没有付诸实施),这也带来一个问题的方法 product.info

Short answer is that there's a bug somewhere preventing the last param of product.update from being set properly (or maybe Varien haven't yet implemented it), which also presents a problem for the method product.info.

一个快速的解决方法(如果你不介意失去了选择按ID更新)只是到商品API中设置的 $ identifierType 更新()法):

A quick workaround (if you don't mind losing the option to update by ID) is just to set the $identifierType in the Product API update() method ):

应用程序/代码/核心/法师/目录/型号/产品/ Api.php L.198

public function update($productId, $productData, $store = null, $identifierType = 'sku')

和最后加载应用左右/代码/核心/法师/目录的l.427方法getProduct()的if($ idBySku)条件内的产品/Helper/Product.php

And finally load the product within the if ($idBySku) condition of the method getProduct() around l.427 of app/code/core/Mage/Catalog/Helper/Product.php

$productId = $idBySku;
$product->load($productId);



这是一个有点忽悠的。我要看看一个更好的解决办法作为一个覆盖;否则,也许别人可以发表一个更好的解决方案。

It's a bit of a fudge. I'll have a look for a better workaround as an override; otherwise, maybe someone else can post a better solution.

这篇关于Magento的1.5,数字的SKU和productIdentifierType的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆