Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento 按国家/地区id筛选客户集合_Magento_Magento 1.7_Magento 1.8_Magento 1.9 - Fatal编程技术网

Magento 按国家/地区id筛选客户集合

Magento 按国家/地区id筛选客户集合,magento,magento-1.7,magento-1.8,magento-1.9,Magento,Magento 1.7,Magento 1.8,Magento 1.9,我正在按性别和姓名收集客户信息。我需要按国家id添加筛选器,但要按地址集合中每个客户的国家id添加筛选器 $collection = Mage::getModel('customer/customer')->getCollection() ->addAttributeToSelect('*'); ->addAttributeToFilter('firstname', $post['firstname']); ->addAtt

我正在按性别和姓名收集客户信息。我需要按国家id添加筛选器,但要按地址集合中每个客户的国家id添加筛选器

$collection = Mage::getModel('customer/customer')->getCollection()
        ->addAttributeToSelect('*');
        ->addAttributeToFilter('firstname', $post['firstname']);
        ->addAttributeToFilter('gender', $post['gender']);
        ->load();
所以我需要这样的东西:

$collection = Mage::getModel('customer/customer')->getCollection()
        ->addAttributeToSelect('*');
        ->addAttributeToFilter('firstname', $post['firstname']);
        ->addAttributeToFilter('gender', $post['gender']);

        ->addAttributeToFilter('country_id', $post['country_id']);//US
        ->load();

如果您觉得有帮助,请接受答案
$collection = Mage::getResourceModel('customer/customer_collection')
    ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left')
    ->addFieldToFilter('billing_country_id','US')
    ;