如何删除或隐藏Magento产品页的属性为N/A的项?加个判断语句吧.
找到模版 app\design\frontend\default\your_theme\template\catalog\product\view\attributes.phtml 查找如下位置
<?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; ?
改为:
<?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; ?>
That's All!
原文地址:http://www.magentogoreview.com/hide-dont-display-na-attributes~194