0

I need to get the average order price of a customer in M1.

Getting the totals:

$customer = $this->getCustomer();

    $customerTotals = Mage::getResourceModel('sales/sale_collection')
     ->setOrderStateFilter(Mage_Sales_Model_Order::STATE_CANCELED, true)
     ->setCustomerFilter($customer)
     ->load()
     ->getTotals();

Output:

[_data:protected] => Array
        (
            [lifetime] => 6
            [base_lifetime] => 6
            [base_avgsale] => 6
            [num_orders] => 1
            [avgsale] => 6
        )

I know I can get:

lifetime like- $customerTotals->getLifetime() and
num_orders like - $customerTotals->getNumOrders()

but how do I get avgsale?

1 Answer 1

2

Quite simply :

$customerTotals->getData('avgsale');

or

$customerTotals->getAvgsale();
0

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.