如何在magento api V1中检索客户订单

时间:2014-09-22 19:01:32

标签: php magento soap

我使用的是magento API V1。我想检索特定的客户订单。我正在使用order.list方法。在这个方法我的过滤器不工作。它给我完整的订单列表。我不知道我在哪里犯错误。这是我的代码

$client = new SoapClient('http://magentohost/api/soap/?wsdl');

$session = $client->login('apiUser', 'apiKey');

$filter = array('filter' => array(array('key=' => 'customer_id', 'value' => 210)));

$result = $client->call($session, 'order.list',$filter);
var_dump ($result);

1 个答案:

答案 0 :(得分:0)

最后,我找到了一种检索客户订单的方法

$client = new SoapClient('http://magentohost/api/soap/?wsdl');

$session = $client->login('apiUser', 'apiKey');
$customer_id = 210;

$result = $client->call($session, 'order.list');

if($result)
{       
foreach($result as $val)
{
  if($customer_id==$val['customer_id'])
  {
    $res[] = $val;
  }

var_dump ($res);

}