php - Exporting Magento Orders - Getting Discount Amount -
php - Exporting Magento Orders - Getting Discount Amount -
i have custom php code shown below exports orders in magento. need code able total discount of order amount of items in order. can please help me this?
// ! ----- new orders ----- $myorder=mage::getmodel('sales/order'); $orders=mage::getmodel('sales/mysql4_order_collection'); //optional filters might want utilize - more available operations in method _getconditionsql in varien_data_collection_db. $orders->addfieldtofilter('total_paid',array('gt'=>0)); //amount paid larger 0 $orders->addfieldtofilter('status',array('eq'=>"processing")); //status "processing" $allids=$orders->getallids(); foreach($allids $thisid) { $myorder->reset()->load($thisid); //getting order fields echo "'" . $myorder->getbillingaddress()->getlastname() . "',"; echo "'" . $myorder->gettotal_paid() . "',"; echo "'" . $myorder->getshippingaddress()->gettelephone() . "',"; echo "'" . $myorder->getpayment()->getcc_type() . "',"; echo "'" . $myorder->getstatus() . "',"; echo "\r\n"; }
as loading order model can utilize getdiscountamount method.
$discount = $myorder->getdiscountamount();
you can number of items from:
$numberoforderitems = count( $myorder->getallvisibleitems() );
php magento export orders
Comments
Post a Comment