`
haohappy2
  • 浏览: 315354 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

How to List Orders by Order Status using Magento API

 
阅读更多

SOAP

<?php
$soapclient = new SoapClient('');
$sessionId = $soapclient->login('YourAPIUser', 'YourAPIKey'); 
// Webservice User and API Key
// Getting Order listing by Order Status
// Example Usage:  array('eq' => 'canceled') , array('eq' =>'processing'),array('eq' => 'complete')
try {
$orders = $soapclient->call($sessionId, 'sales_order.list',
array(array('status' => array('eq' => 'pending'))));
foreach ($orders as $order) {
echo "OrderId:" . $order['order_id'] . "
";
}
} catch (Exception $fault) {
echo $fault->getMessage();
}
?>

 XMLRPC Example:

<?php
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
umask(0);
Mage::app();
$xmlrpcclient = new Zend_XMLRPC_Client('http://example.com/api/xmlrpc/');
$session = $xmlrpcclient->call('login', array('YourAPIUser', 'YourAPIKey'));
try {
$orders = $xmlrpcclient->call('call', array($session, 'sales_order.list', array(array('status' => 'canceled'))));
foreach ($orders as $order) {
echo "OrderId:" . $order['order_id'] . "
";
}
} catch (Exception $fault) {
echo $fault->getMessage();
}
?>

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics