I am working on a custom Magento Extension.

Here is how i take all customers in a customer group:

                $customers = Mage::getModel('customer/customer')

                foreach($customers as $customer)

                    $CustomerPhone = $customer->getPrimaryBillingAddress()->getTelephone();
                    $CustomerName = $customer->getName();
                    $CustomerEmail = $customer->getEmail();

This how i get information about the users in a specific customer group.

My question is how i can get all the users ever paid or complete(for example) an order ?

Is it even possible, and if so how ?

Thanks in advance!

  • you mean all the users who have placed an order.? – Manashvi Birla Jun 17 '15 at 13:27
  • No i mean all users who have orders with status completed. – Venelin Vasilev Jun 17 '15 at 14:53

To find all the users who have status completed, you can load the sales/order collection like this :

$ordercollection = Mage::getModel('sales/order')->getCollection()
                 ->addFieldToFilter('status', 'complete');
foreach($ordercollection as $_order)
    $customerId[]    = $_order->getCustomerId();
    $customerEmail[] = $_order->getCustomerEmail();
echo "<pre>";print_r($customerId); //id of all customers whose order status=complete
echo "<pre>";print_r($customerEmail); //email of all customers whose order status=complete

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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