I have wholesale attributes for certain products under one store in Magento. I would like to set it so those particular attributes only appear on the product page IF the customer is logged in and they are in the Wholesale customer group.
Is this possible?
Something like this should work, although I have not tested this together. It's assuming your wholesale groupid = 2 and that you want to show the product attribute 'productvideos'
app/design/frontend/default//template/catalog/product/view.phtml
if($_isLoggedIn === true){
$_myGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
if($_myGroupId == 2){
print $_helper->productAttribute($_product, $_product->getProductvideos(), 'productvideos');
}
}
Credit: http://www.magentocommerce.com/boards/viewthread/22597/#t74992
Okay, here's the solution.
In template/catalog/product/view> attributes.phtml use the following:
<?php
$_isLoggedIn = $this->helper('customer')->isLoggedIn();
if($_isLoggedIn == true){
$_myGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
if($_myGroupId == 2){
echo '<td class="label">Attribute Name/Label</td>';
echo '<td class="label">';
if ($_product->getResource()->getAttribute('attribute_id')->getFrontend()->getValue($_product)):
echo $_product->getResource()->getAttribute('attribute_id')->getFrontend()->getValue($_product);
endif;
echo '</td>';
}
}
?>
Thanks to @nvoyageur for the initial pointer in the right direction!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With