I need to use the customer group name in the invoice. Based on $order
I can get the customer group ID.
$customerGroupId = $order->getCustomerGroupId();
I tried the following code:
$groupname = Mage::getModel(‘customer/customer_group’)->load($customerGroupId);
This results in the following error:
Fatal error: Call to a member function load() on a non-object
How can I get the group name?
Best Answer
The object I think you are looking for is
Mage_Customer_Model_Group
so you will need to update your load to use the following.On another note there is no name on customer groups but instead 'customer_group_code'. With the default data that comes with Magento the codes look as follows.
To get the code you can either call
getCustomerGroupCode
or there is a functiongetCode
which is simply an alias for the first one.