0

I would like to show an additional product attribute on the product page in the same place as the rest, but only if I'm loggged in as a certain customer group.

So put simply I need to show an additional attribute on the front end when logged in as a certain customer group.

Any ideas?

Thank you very much in advance,

| improve this question | | | | |
0

Copy this file

app/design/frontend/base/default/template/catalog/product/view/attributes.phtml

here

app/design/frontend/{package}/{theme}/template/catalog/product/view/attributes.phtml

And replace these code

<?php foreach ($_additional as $_data): ?>
        <tr>
            <th class="label"><?php echo $this->escapeHtml($this->__($_data['label'])) ?></th>
            <td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
        </tr>
    <?php endforeach; ?>    

With These

<?php 
    $excludeAttributeOnLogin = array('country_of_manufacture'); // add all attribute which don't want to show for guest user
    $isLogedIn = Mage::getSingleton('customer/session')->isLoggedIn(); // Add our condition here and assigned true or false 
    ?>
    <?php foreach ($_additional as $_data): 

        if(!$isLogedIn && in_array(trim($_data['code']), $excludeAttributeOnLogin)){
            continue;
        }
        ?>
        <tr>
            <th class="label"><?php echo $this->escapeHtml($this->__($_data['label'])) ?></th>
            <td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
        </tr>
    <?php endforeach; ?>
| improve this answer | | | | |
0

use this code to check customer is logged in or not

 <?php 
        if(!Mage::getSingleton('customer/session')->isLoggedIn()){
            //not logged in
        }else{
            // logged in
        }
    ?>

put your code to print attribute value in logged in block

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.