[php]
<?php
/* Check if customer is logged in */
$isLoggedIn = Mage::getSingleton(‘customer/session’)->isLoggedIn();
/* If customer is logged in */
if($isLoggedIn) :
/* Get the logged in customer’s group ID */
$customerGroupId = Mage::getSingleton(‘customer/session’)->getCustomerGroupId();
/* Check if the logged in customer’s group ID matches with the ID you are after */
/* Customer group IDs are listed against each group under Admin > Customers > Customer Groups */
if($customerGroupId == 3) :
echo ‘Welcome Retailer’;
endif;
endif;
?>
[/php]
You can also write static blocks or custom variables to contain group specific information. You can name the static block identifier based on the $customerGroupId and retrieve it on the front end.
3 comments
Comments are closed.
Great snippet of code. Just what I needed – thanks!
You’re welcome
Great, that’s what I was looking for. Thank you!