php - How to get completion date of an order in Magento -
i'm manually building report in magento using collections , i'm trying make use order completion date instead of order created date.
my current code is:
$orders = mage::getmodel('sales/order')->getcollection() ->addattributetofilter('created_at', array('from'=>$fromdate, 'to'=>$todate)) ->addattributetofilter('status', array('eq' => mage_sales_model_order::state_complete)) ->addattributetofilter('store_id', array('eq' => 2)); i've found following question user suggest manually logging of status changes each order manually.
finding out when order status has been set completed
as i'm wanting use in collection don't believe suitable way, expect sort of information accessible in magento.
thanks,
you can retrieve collection of order-status-history updates:
$collection = mage::getresourcemodel('sales/order_status_history_collection') ->addattributetoselect('created_at', 'parent_id') ->addattributetofilter('status', array('eq'=>'complete')) ->load(); after can iterate $collection , extract parent_id , created_at information want.
Comments
Post a Comment