2010-02-26 55 views
1

我有检索我的产品的问题,在1.3它工作,我只是在1.4上添加了一些产品,但在capalogProductInfo中有一个新的函数叫做产品标识符,我不知道该放什么在那里,我尝试传递产品类型表格列表,但我不断收到一个错误,说该产品不会退出。Magento 1.4 productIdentifierType

任何人都可以帮忙吗?

catalogProductInfo(sessionId, Product_id, CurrentStore, attributes, productIdentifierType) 

回答

1

如果要谈论的Magento API Catalog Product Info,该函数requieres 3个参数

  • 混合产物 - 产品ID或SKU
  • 混合storeView - 商店视图ID或代码(可选)
  • 数组属性 - 将要加载的属性列表(可选)

1.4版本似乎以同样的方式工作。尝试调试这个类Mage_Catalog_Model_Product_Api_V2

/** 
* Retrieve product info 
* 
* @param int|string $productId 
* @param string|int $store 
* @param stdClass $attributes 
* @return array 
*/ 
public function info($productId, $store = null, $attributes = null, $identifierType = null){} 
+1

哦,我使用了空值,它工作大声笑,我的坏,但如果它有一个空值,Ÿ麻烦提出一个论点,它是什么目的? – 2010-02-26 11:31:41

+0

您必须使用它,否则该函数将不会收到预期的数字参数。检查文档中的示例5以更好地理解为什么参数应该在那里。 http://www.php.net/manual/en/functions.arguments.php – 2010-02-26 17:09:11

+0

该API的C#版本有四个参数,如原始问题中所列。第4个“productIdentifierType”参数的目的是告诉Magento您是否使用SKU或product_id标识符,我想。 – codeulike 2011-05-09 16:21:33

3

之前我定义我想回来的属性,我一直得到了同样的错误(产品不退出):

catalogProductRequestAttributes attrib = new catalogProductRequestAttributes(); 
attrib.attributes = new string[] { "description", "name" }; 

catalogProductInfo(sessionId, Product_sku, CurrentStore, attrib, null) 

不知道的productIdentifierType,但展台空和“sku”为我工作。

+1

null用于为我工作,但在Magento 1.5中,如果您的SKU是数字,它现在无法找到它们。传入“sku”作为productIdentifierType似乎没有帮助... – codeulike 2011-07-19 13:31:12