0

I Magento, when you go to Customers -> Manage Customers and you are on the list of all customers, my client wants to add "Lifetime Sales" to this report. Is this possible ?

Thanks, Mark

2 Answers 2

2

There is already something similar in Reports > Customers > Customers by orders total.

Note that reports tend to take a long time to render because they are collating a lot of information, the Manage-* pages need to be kept light so I wouldn't like the thought of shoe-horning too much information into those tables. If the Customers by orders total report isn't quite right then consider writing a new report - in the reports section - that is better suited.

1
  • thanks for the tip. I will check this out under writing custom reports. This client is a pain so we'll see if that works.
    – Mark G
    Feb 27, 2012 at 20:42
0

It's not that hard to do it. You need to extend that grid. I recently needed something similar so here is my query to get lifetime sales.

$orderStatuses = array(Mage_Sales_Model_Order::STATE_COMPLETE, Mage_Sales_Model_ORder::STATE_PROCESSING);

$order = Mage::getModel('sales/order');
$resourceOrder = $order->getResource();

$select = $readConnection->select()
    ->from(array('sales' => $resourceOrder->getTable('sales/order')), 'SUM(base_subtotal)')
    ->where('sales.customer_id=?', $customer->getId())
    ;
//filter by status
$select->where('state IN (?)', $orderStatuses);
//    echo $select . '<br/>'; exit;

$total = $readConnection->fetchOne($select);

You can change orderStatuses array and add whatever suits you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.