2015-03-19 58 views
0

如何獲取所有數據?查看產品列表magento api的所有數據

$client = new SoapClient('http://magentohost/api/soap/?wsdl'); 
$session = $client->login('apiUser', 'apiKey'); 
$result = $client->call($session, 'catalog_product.list'); 

var_dump($result); 

它表明我的數組:

array 
    0 => 
    array 
     'product_id' => string '1' (length=1) 
     'sku' => string 'n2610' (length=5) 
     'name' => string 'Nokia 2610 Phone' (length=16) 
     'set' => string '4' (length=1) 
     'type' => string 'simple' (length=6) 
     'category_ids' => 
     array 
      0 => string '4' (length=1) 
    1 => 
    array 
     'product_id' => string '2' (length=1) 
     'sku' => string 'b8100' (length=5) 
     'name' => string 'BlackBerry 8100 Pearl' (length=21) 
     'set' => string '4' (length=1) 
     'type' => string 'simple' (length=6) 
     'category_ids' => 
     array 
      0 => string '4' (length=1) 

,但我需要得到和產品名單像描述,圖片,重量等其它數據

感謝ü

回答

0

保存新apiuser和你的magento中的apikey,並在以下代碼中使用。

$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url with your url 
    $sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary 

    $result = $proxy->catalogProductList($sessionId); 
    var_dump($result); 

使用上面的代碼將工作。