簡體   English   中英

Magento:從一個團隊中獲取所有客戶

[英]Magento: get all customer from a group

就像在標題上說的一樣,我需要將所有用戶分配到特定組。

在magento中,我創建了一個名為“customers”且ID為4的客戶組。

現在我需要使用自定義腳本列出magento之外的該組中的所有用戶,但我找不到解決方案。

使用這個小代碼,我可以獲得所有注冊用戶,你知道我如何過濾這個只能獲得組ID 4的客戶嗎?

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

謝謝!

您可以輕松地向集合中添加過濾器,以返回特定組中的所有客戶。

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

我想你應該添加: - > addFieldToFilter('customer_group_id','1');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM