Magento ::如何过滤多余的信息?

时间:2011-10-28 08:20:54

标签: magento magento-1.5

我正试图通过api电话获取客户名单&我收到了客户详细信息列表,但返回了与客户相关的所有属性,但我只想要检索 customer name,employee_id,email 。在magento api wiki中,我发现customer.list接受两组参数(array filters & filter list)有人可以告诉我区别b / w我尝试使用下面的代码只检索customer_id,email& firstname但var_dump();显示所有客户信息我如何只检索我想要的属性? 提前谢谢。

<?php 
     $proxy = new SoapClient('http://www.localhost/magento/index.php/api/soap/?wsdl');
    $sessionId = $proxy->login('test', '123456');
    // Get new customer info
    $filters=array('employee_id'=>array('eq'=>'234567'));
    $filter_list=array('customer_id','email','firstname');
    $results= $proxy->call($sessionId, 'customer.list',array($filters),array($filter_list));
    var_dump($results);  

    ?>

1 个答案:

答案 0 :(得分:0)

过滤器仅用于检索与这些特定属性匹配的客户记录。

您有几种选择:

  1. 添加新的API端点以检索所需的值。
  2. 破解核心Customer wsdl并删除不需要的属性。
  3. 在您的API调用之后通过每个数组并取消设置不需要的值。

  4. 添加自定义端点

    基本上你必须创建一个扩展核心api的新模块,并不难做到以下指南详细介绍

    http://www.magentocommerce.com/wiki/doc/webservices-api/custom-api