For some odd reason, the Magento developers decided that an empty attribute should NOT be empty, but rather “No” or “N/A”, depending on its type. This is not just annoying, but in some cases can display wrong information which means confused visitors and potentially lost sales.
Fortunately, there is a quick fix that will solve the problem until the Magento developers fix this bug. Open the file /app/design/frontend/default/[theme name]/template/catalog/product/view/attribute.phtml in an editor and find the following lines:
<?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
; ?>
Replace these lines with this:
<?php
foreach
(
$_additional
as
$_data
): ?>
<?php
$_attribute
=
$_product
->getResource()->getAttribute(
$_data
[
'code'
]);
if
(!
is_null
(
$_product
->getData(
$_attribute
->getAttributeCode())) && ((string)
$_attribute
->getFrontend()->getValue(
$_product
) !=
''
)) { ?>
<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 } ?>
<?php
endforeach
; ?>
Revisions
- November 26, 2015 @ 11:30:08 [Current Revision] by admin
- November 26, 2015 @ 11:30:08 by admin
No comments yet.