Saturday 11 October 2014

get order sale customer by email in magento

<?php

$orders = Mage::getModel('sales/order')
->getCollection()
->addFieldToFilter('store_id', Mage::app()->getStore()->getId())
//->addAttributeToFilter('status', Mage_Sales_Model_Order::STATE_COMPLETE)
->addAttributeToFilter('customer_email', $email)// guest email id for filter
->addAttributeToSort('entity_id', 'DESC');

foreach($orders as $order) {
    $guest_email = $order->getCustomerEmail();
}

?>

No comments:

Post a Comment