Get last order of an customer magento
Posted by navaneeth on Dec 29, 2013 in Magento, Php | No comments yet
$_customer = Mage::getModel('customer/customer');
$_customer->loadByEmail('example@example.com');
$orders = Mage::getResourceModel('sales/order_collection')
->addFieldToSelect('*')
->addFieldToFilter('customer_id', $_customer->getId())
->addAttributeToSort('created_at', 'DESC')
->setPageSize(1);
ID
echo $orders->getFirstItem()->getId();

Leave a Reply