lisamiltonbayer
3/13/2017 - 4:05 PM

Magento - Add custom attribute to product grid with if statement

Magento - Add custom attribute to product grid with if statement

<!-- Number of particular animals -->
<?php if($_product->getData('no_of_animals') > 0): ?>
  <p><?php echo $_product->getData('no_of_animals'); ?></p>
  <p><?php echo $_product->getAttributeText('animal_type'); ?></p>
<?php endif; ?>
<!-- Add custom attribute to catalog.xml within "catalog/product_list" block -->
<action method="addAttribute"><name>no_of_chickens</name></action>
<action method="addAttribute"><name>animal_type</name></action>