Magento Core: Empty product attributes showing up with N/A or No

Send Snippet To: Save this snippet to Code Collector Pro -- view all tamburra's snippets
language: Other
license: Other

Code for Snippet:

                
---------------
Open:
---------------
 
/app/design/frontend/base/default/template/catalog/product/view/attributes.phtml
 
 
---------------
Find:
---------------
 
        	<?php foreach ($_additional as $_data): ?>
 
 
---------------
Add Below:
---------------
 
		<?php if(($_data['value']) != 'No' & ($_data['value']) != 'N/A'): ?>
 
 
---------------
Find:
---------------
 
        	<?php endforeach; ?>
 
 
---------------
Add Above:
---------------
 
		<?php endif; ?>
 
 
---------------
Open:
---------------
 
/app/design/frontend/base/default/template/catalog/product/compare/list.phtml
 
 
---------------
Find:
---------------
 
        <?php foreach ($this->getAttributes() as $_attribute): ?>
            <tr>
                <?php $_i=0 ?>
                <?php foreach($this->getItems() as $_item): ?>
 
 
---------------
Add Below:
---------------
 
				<?php if (!is_null($_item->getData($_attribute->getAttributeCode())) && ((string)$_attribute->getFrontend()->getValue($_item) != '')): ?>
 
 
---------------
Find:
---------------
 
                <td>
                    <?php switch ($_attribute->getAttributeCode()) {
                        case "price": ?>
                            <?php echo $this->getPriceHtml($_item, true, '-compare-list-' . $_attribute->getCode()) ?>
                            <?php break;
                        case "small_image": ?>
                            <img src="<?php echo $this->helper('catalog/image')->init($_item, 'small_image')->resize(125, 125); ?>" width="125" height="125" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" title="<?php echo $this->htmlEscape($_item->getName()) ?>" />
                            <?php break;
                        case "date":
                              echo substr($this->getProductAttributeValue($_item, $_attribute),0,10);
                              break;
                        default: ?>
                            <?php echo $this->helper('catalog/output')->productAttribute($_item, $this->getProductAttributeValue($_item, $_attribute), $_attribute->getCode()) ?>
                            <?php break;
                    } ?>
                </td>
 
 
---------------
Add Below:
---------------
 
				<?php endif; ?>
comments powered by Disqus

Info

Tags: Core CE 1.6

Link to this snippet:


Download to Code Collector

To use the direct link to your snippet on CodeCollector.net either copy the html from the above section or drag the Download to Code Collector to where you would like to use it.

More Info:

Times Viewed: 881
Date Added: 2012-01-24 05:51:14
Last Modified: 0000-00-00 00:00:00

Web Analytics