- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2016
03:26 AM
04-28-2016
03:26 AM
Hi there,
I'm looking to display the customer Lifetime Sales value (£) within the admin on admin Order View page. I've managed to pull in the customer total order count with the code below, and basically would like to do the same with the lifetime value, any ideas?
<div class="label"><label><?php $customer_id = $this->getOrder()->getCustomerId(); $_orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id',$customer_id); $_orderCnt = $_orders->count(); //orders count ?></label></div> <div class="value"><?php echo 'Total number of orders <i>(Including this order)</i>: <font color="#eb5e00"><strong>'.$_orderCnt.'</strong></font>'; ?></div> <div><br /></div>
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2016
07:58 AM
05-02-2016
07:58 AM
$customerId = <CUSTOMER_ID>; $customer = Mage::getModel('customer/customer')->load($customerId);$customerTotals = Mage::getResourceModel('sales/sale_collection') ->setOrderStateFilter(Mage_Sales_Model_Order::STATE_CANCELED, true) ->setCustomerFilter($customer) ->load() ->getTotals();$customerLifetimeSales = $customerTotals->getLifetime(); echo "Life Time Sales: ".$customerLifetimeSales;
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2016
07:58 AM
05-02-2016
07:58 AM
$customerId = <CUSTOMER_ID>; $customer = Mage::getModel('customer/customer')->load($customerId);$customerTotals = Mage::getResourceModel('sales/sale_collection') ->setOrderStateFilter(Mage_Sales_Model_Order::STATE_CANCELED, true) ->setCustomerFilter($customer) ->load() ->getTotals();$customerLifetimeSales = $customerTotals->getLifetime(); echo "Life Time Sales: ".$customerLifetimeSales;