显示销售报告,将月份,日期等参数传递给Magento Soap api

时间:2014-02-06 12:18:45

标签: magento soap

我从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');

这对开发人员来说也很有用

1 个答案:

答案 0 :(得分:0)

完成订单

   $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);

工作正常

相关问题