There will be some attributes that are not compulsory when you are creating the product. And they will be ‘N/A’ or ‘No’ on the product page if you don’t specify values for them. That doesn’t look pretty. Customers might ask why this product doesn’t have this feature? To save you from the awkwardness, we may be better off by removing those ‘N/A’ or ‘No’ attributes.
How to remove or hide ‘N/A’ attributes on Magento product pages?
It’s simple. Just open and edit this file:
/app/design/frontend/default/my_theme/template/catalog/product/view/attributes.phtml
Change the bold part default/my_theme to wherever your theme resides. If attributes.phtml is not there, copy this one there:
/app/design/frontend/base/default/template/catalog/product/view/attributes.phtml
And then open and edit it:
/app/design/frontend/default/my_theme/template/catalog/product/view/attributes.phtml
You would be greeted by something like this:
<?php foreach ($_additional as $_data): ?>
<tr>
<th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
<td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
</tr>
<?php endforeach; ?>
Just add a line in there (bold part):
<?php foreach ($_additional as $_data): ?>
<?php if ($_data['value'] == 'N/A') {continue;} ?>
<tr>
<th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
<td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
</tr>
<?php endforeach; ?>
So if the attribute value is ‘N/A’, the foreach loop would continue to the next round instead of outputting the attribute value.
