Created
February 14, 2017 12:39
-
-
Save jwohlfeil/7bb7dcdcf15ec0cdf06b80706c571047 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
$_product->getThisattribute(); | |
$_product->getAttributeText('thisattribute'); | |
$_product->getResource()->getAttribute('thisattribute')->getFrontend()->getValue($_product); | |
$_product->getData('thisattribute'); | |
// The following returns the option IDs for an attribute that is a multiple-select field: | |
$_product->getData('color'); // i.e. 456,499 | |
// The following returns the attribute object, and instance of Mage_Catalog_Model_Resource_Eav_Attribute: | |
$_product->getResource()->getAttribute('color'); // instance of Mage_Catalog_Model_Resource_Eav_Attribute | |
// The following returns an array of the text values for the attribute: | |
$_product->getAttributeText('color') // Array([0]=>'red', [1]=>'green') | |
// The following returns the text for the attribute | |
if ($attr = $_product->getResource()->getAttribute('color')): | |
echo $attr->getFrontend()->getValue($_product); // will display: red, green | |
endif; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment