2

How do i stop the empty attributes on my website from showing up on the products page with the section showing "N/A" or "No" see below for image: (i want it to just be a blank empty box if there is nothing entered into the attribute )

enter image description here

I looked up the option for hiding via edditing the attribute.phtml file but it doesn't exist for me see screenshot below:

enter image description here

  • Is it solve your problem ? – Gem Apr 8 '17 at 6:25
0

Copy attributes.phtml from frontend/base/default/template/catalog/product/view/attributes.phtml into your theme frontend/your_theme/default/template/catalog/product/view/attributes.phtml

Replace for each loop with the following code in attributes.phtml

<?php foreach ($_additional as $_data): ?>
<?php if($_data['value'] != 'N/A') || ($_data['value'] != 'No') : ?>
<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 endif; ?>
       <?php endforeach; ?>
0

Go in \app\design\frontend\base\default\template\catalog\product\view\attributes.phtml

replace foreach on line 43 with this

        <?php foreach ($_additional as $_data): ?>

        <?php if ($_helper->productAttribute($_product, $_data['value'], $_data['code']) === 'N/A'): ?>  
        <?php else: ?>
            <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 endif ?>            

       <?php endforeach; ?>

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