2012-01-13 53 views
1

三天後偶爾卓有成效的撞頭,我能夠拉動產品的集合掀起了Magento的網站,並獲得特定產品的附加屬性的,但我真的需要所有產品及其屬性的完整轉儲。 所以這適用於單個產品:如何使用SOAP V2拉所有產品及其屬性關閉Magento的

$sku='HHAM-6'; 

$attributes = new stdClass(); 
$attributes->attributes = array('description', 'short_description', 'price'); 
$list = $client->catalogProductInfo($session, $sku, NULL, $attributes,''); 

print_r($list); 

和這部作品得到所有產品的基本信息:

$params = ''; 

$result = $client->catalogProductList($session, $params); 
print_r($result); 

那麼,如何合併兩個?後者的輸出包括:

 [product_id] => 1 
     [sku] => HHAM-6 

我該如何整合每個產品的第一個例程?某種foreach結構?

很抱歉,如果這是太明顯,但任何援助的歡迎。

回答

0

API方法catalogProductList總是返回僅次於屬性:

 $result[] = array(
      'product_id' => $product->getId(), 
      'sku'  => $product->getSku(), 
      'name'  => $product->getName(), 
      'set'  => $product->getAttributeSetId(), 
      'type'  => $product->getTypeId(), 
      'category_ids' => $product->getCategoryIds(), 
      'website_ids' => $product->getWebsiteIds() 
     ); 

見\程序\代碼\核心\法師\目錄\型號\產品\阿比\ V2.php線82(或它周圍的某處)。

您可以使用catalogProductList獲得所有產品的數組,然後對其進行foreach並獲取每個產品的屬性,並使用catalogProductInfo。但是,爲什麼不能去管理和使用系統 - >導入/導出 - >導出和出口的所有產品到csv?

0

對於SOAP v1我發現它在/app/code/core/Mage/Catalog/Model/Product/Api.php 108行

相關問題