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

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -