I have around 80 different customer groups, with different prices on.
How can I find out how many customers are in any given group?
Can I make a list of all customers included in customer group?
I have this but it gives me error Fatal error: Class 'Mage' not found in /domains/dev.domain.co.uk/http/customer_groups.php on line 3
UPDATE: adding:
require_once('app/Mage.php');
Mage::app();
Fixed it.
Update 2:
Error:
Fatal error: Call to a member function addField() on a non-object in /domains/dev.domain.co.uk/http/customer_groups.php on line 19
Where do I have to place the code to get the result. I found this code and this supposed to be a outcome but I'm struggling implementing it.
UPDATE 3
This is my code, it displays almost everything exactly as I want, except, there are gaps in between the groups, also could I have a group ID with it too?
require_once('app/Mage.php');
Mage::app();
$_customer = array();
$customerCollection = Mage::getResourceModel('customer/customer_collection');
foreach ($customerCollection as $customer) {
$_customer[$customer->getGroupId()][] = $customer->getId();
}
$_groups = array();
$groupCollection = Mage::getResourceModel('customer/group_collection');
foreach ($groupCollection as $group) {
$_groups[$group->getId()] = $group->getCode();
}
foreach ($_customer as $groupId => $customerIds) {
echo 'Group "' . $_groups[$groupId] . '" has ' . count($customerIds) . ' customers.<br>';
}