没有在Magento块文件中获取客户?

时间:2013-04-24 05:21:45

标签: magento

我正在尝试根据他们的州明智地获取所有客户的详细信息,例如来自亚利桑那州的所有客户的收集。

代码:

$collection = array();
$collection = Mage::getResourceModel('customer/customer_collection')
    ->joinAttribute('company', 'customer_address/company', 'default_billing', null, 'left')
    ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
    ->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
    ->addFieldToFilter('billing_region',$stateName)
    ->setOrder('billing_city', 'asc');
echo $stateName;   
echo $collection->getSelect();
print_r($collection); 
return $collection;

现在,当我显示查询并在sql中运行它时工作正常,但该集合没有显示任何内容。

任何帮助将不胜感激!!!!

1 个答案:

答案 0 :(得分:0)

尝试加载集合:

->setOrder('billing_city', 'asc')->load();