1

Can anyone help me to get all available customer groups?

I want to find customer group names and their ids.

8

You can use below mentioned code run it from your magento dir:

<?php 
error_reporting(E_ALL | E_STRICT);
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
Mage::app('admin'); 
$customer = Mage::getModel('customer/group')->getCollection();
foreach($customer as $type) {
    echo '<pre>Customer group id :'.$type->getCustomerGroupId().'<br>';
    echo '<pre>Customer group code :'.$type->getCustomerGroupCode().'<br>';

   }
?>
3

Use following function

$groups = Mage::getModel('customer/group')->getCollection();
foreach ($groups as $Group) {

  echo 'Customer GroupID = '.$Group->getCustomerGroupId().'<br>';
  echo 'Customer Group Name = '.$Group->getCustomerGroupCode().'<br>';

}

Hope this will help you

  • Yes I have tried that but I am not getting how to get all customer group names and ids from it? – vedu Mar 3 '16 at 6:47
  • Modified my answer check it – Rohit Kundale Mar 3 '16 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.