Last active
June 8, 2017 14:12
-
-
Save ScarletPonytail/d31d24132b56532718d2bcb8b533df54 to your computer and use it in GitHub Desktop.
Magento - Add custom attribute to product grid with if statement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment