2010-02-26 57 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