while i was working on one magento site one of my client wants to show a page only for wholesale customer.I knew How to assign customer group in magento But didn't know how to check it.I had to make this condition on Aw_blog module page, I opened that module and wrote the Following code and worked correctly.
First I check whether a Customer logged in or not ,then I fetch the value of customer group id to know in which cutomer group visited this page.In my website Wholesale customer Id was 2.
<?php
$login = Mage::getSingleton( 'customer/session' )->isLoggedIn(); //Check if User is Logged In
if($login)
{
$groupId = Mage::getSingleton('customer/session')->getCustomerGroupId(); //Get Customers Group ID
if($groupId == 2) //My wholesale customer id was 2 So I checked for 2. You can check according to your requirement
{
echo 'You are a wholesale Customer';
}
}
?>
Nice, Just what I was looking for, works fine in 1.4.1.1
ReplyDeleteThanks
hi can any one tell me how can i change the customer groupid as soon as he place order?
ReplyDeleteHello, Thank you very much for that code!!!
ReplyDelete