Get customer order count in Magento
Hello Friends
If you want to get order count of particular customer in magento from customer id then you can use my below script
$customer_id = 5;
$_orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id',$customer_id);
$_orderCnt = $_orders->count(); //orders count
echo 'Customer with ID '.$customer_id.' has '.$_orderCnt.' orders';
Let me know if you have any query
If you want to get order count of particular customer in magento from customer id then you can use my below script
$customer_id = 5;
$_orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id',$customer_id);
$_orderCnt = $_orders->count(); //orders count
echo 'Customer with ID '.$customer_id.' has '.$_orderCnt.' orders';
Let me know if you have any query
0 comments:
Post a Comment