【问题标题】:show sales report to pass the parameter like month,date to Magento Soap api显示销售报告以将月份、日期等参数传递给 Magento Soap api
【发布时间】:2014-02-07 19:12:46
【问题描述】:

我正在从 Magento 商店获取销售报告以使用 SOAP API。这工作正常,但这显示了所有销售报告。我想要自定义报告,例如通过特定月份或日期。 这怎么可能我的代码如下。

  $mage_url = 'https://domain.com/index.php/api/soap/index/wsdl/1'; 
  $mage_user = 'Mohammad'; 
  $mage_api_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; 

  // Initialize the SOAP client 
   $soap = new SoapClient( $mage_url ); 

  // Login to Magento 
  $session_id = $soap->login( $mage_user, $mage_api_key );

 // Start a session to make API requests
 $resources = $soap->resources( $session_id );
 $products = $soap->call($session_id, 'sales_order.list');

这对开发人员也很有用

【问题讨论】:

    标签: magento soap


    【解决方案1】:

    对于已完成的订单

       $products = $soap->call($session_id, 'sales_order.list', array(array('status'=>array('eq'=>'complete'))));
    

    特定时期

     $thedate = date("Y-m-d", strtotime("1 month ago"));
     $thesearch =array(array('updated_at'=>array('from'=>"$thedate"), 'status'=>array('eq'=>"complete")));
     $products = $soap->call($session_id, 'sales_order.list', $thesearch);
    

    工作正常

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-28
      • 1970-01-01
      相关资源
      最近更新 更多