1

This question already has an answer here:

I would like to add filters (with addFieldToFilter or other) in my customer collection Mage::getResourceModel('customer/customer_collection').

In sql it is:

WHERE (billing_country_id = "FR" AND (billing_telephone LIKE "06%" 
OR billing_telephone LIKE "07%")) OR billing_telephone LIKE "00%" 
OR billing_telephone LIKE "+%"

I have created:

(billing_country_id = "FR" AND (billing_telephone LIKE "06%" 
OR billing_telephone LIKE "07%") ", 

but i don't know how add:

 " OR billing_telephone LIKE "00%" OR billing_telephone LIKE "+%" ". 

This is the beginning :

 ->addFieldToFilter(
        array(
            array('attribute' => 'billing_country_id', 'eq' => "FR")
        )
    )
    ->addFieldToFilter(
        array(
            array('attribute' => 'billing_telephone', 'like' => "06%"),
            array('attribute' => 'billing_telephone', 'like' => "07%")
        )
    )

marked as duplicate by Keyul Shah, Marius, Amit Bera, brentwpeterson, Anna Völkl Dec 1 '14 at 18:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

you need add address table on your customer collection

Mage::getResourceModel('customer/customer_collection')
            ->addNameToSelect()
            ->addAttributeToSelect('*')

            ->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
            ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
            ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
            ->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
            ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left')

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