Reputation: 33
I'm having a problem with Magento, how do I show an image on certain products description only when customer is logged in? And is it possible to access to which customer group the customer belongs to after logged in? So that if it's a regular customer he see's some image or not, if is a distributor he sees another kind of image.
I'm talking of images in the product description, has a banner in the beggining of the text, Im not talkign about product images.
Upvotes: 0
Views: 123
Reputation: 2334
You'll need to modify your themes catalog/product/view/description.phtml
template as that's where the product description is output.
$customerSession = Mage::getSingleton('customer/session');
$customer = $customerSession->getCustomer();
if ($customerSession->isLoggedIn()) {
// your image actions here
}
if ($customer && $customer->getCustomerGroupId() == 5) {
// your customer group specific actions
}
The first if statement checks if the user is logged in, the second checks if the customer group ID is equal to 5 (or whatever customer group you're searching for.) Place this before your description to output the necessary image / content.
Upvotes: 2