Magento 按国家/地区id筛选客户集合
我正在按性别和姓名收集客户信息。我需要按国家id添加筛选器,但要按地址集合中每个客户的国家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
$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')
;