Magento:从一个团队中获取所有客户

Lap*_*aig 4 php magento

就像在标题上说的一样,我需要将所有用户分配到特定组.

在magento中,我创建了一个名为"customers"且ID为4的客户组.

现在我需要使用自定义脚本列出magento之外的该组中的所有用户,但我找不到解决方案.

使用这个小代码,我可以获得所有注册用户,你知道我如何过滤这个只能获得组ID 4的客户吗?

    $collection = Mage::getModel('customer/customer')
        ->getCollection()
        ->addAttributeToSelect('*');
    $result = array();
    foreach ($collection as $customer) {
        $result[] = $customer->toArray();
    }
Run Code Online (Sandbox Code Playgroud)

谢谢!

100*_*les 20

您可以轻松地向集合中添加过滤器,以返回特定组中的所有客户.

$collection = Mage::getModel('customer/customer')
        ->getCollection()
        ->addAttributeToSelect('*')
        ->addFieldToFilter('group_id', 4);
Run Code Online (Sandbox Code Playgroud)