A new attribute was added such as "bust" and ,"Catalog Input Type for Store Owner" was set to "text field". If I don't fill any text as a product attributes value, the frontend shows "Bust: No".
This happens even if the "Values Required" attribute property is set to "No".

I would like the attribute to not be shown if I did not fill any value for it.


The reason is the class Mage_Catalog_Block_Product_View_Attributes, which implements the logic for getting the values for the additional attributes in the method getAdditionalData()

public function getAdditionalData(array $excludeAttr = array())
    $data = array();
    $product = $this->getProduct();
    $attributes = $product->getAttributes();
    foreach ($attributes as $attribute) {
        if ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), $excludeAttr)) {
            $value = $attribute->getFrontend()->getValue($product);

            if (!$product->hasData($attribute->getAttributeCode())) {
                $value = Mage::helper('catalog')->__('N/A');
            } elseif ((string)$value == '') {
                $value = Mage::helper('catalog')->__('No');
            } elseif ($attribute->getFrontendInput() == 'price' && is_string($value)) {
                $value = Mage::app()->getStore()->convertPrice($value, true);

            if (is_string($value) && strlen($value)) {
                $data[$attribute->getAttributeCode()] = array(
                    'label' => $attribute->getStoreLabel(),
                    'value' => $value,
                    'code'  => $attribute->getAttributeCode()
    return $data;

Please note especially the lines:

} elseif ((string)$value == '') {
    $value = Mage::helper('catalog')->__('No');

This bit of code is a common piece of annoyance. There are several possible ways to change that behavior.

One would be to change the block, either by a rewrite, or by creating your own custom block and then using that via layout XML.

Another approach would be to change the output in the template catalog/product/view/attributes.phtml, where the additional attribute data is rendered. Something like

<?php $_data['value'] == 'No' ? '' : $_data['value']  ?>
<td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>

And yet another potential solution would be to set HTML as allowed and use a HTML comment as the value so it no longer matches '' (example given <!-- empty -->).

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