kingberrill of Magento
4/9/2016 - 4:46 PM

Get Attributes

Get Attributes

	// need to add placeholder in admin or will break when no image
	
<?php
    // get custom image attribute "image_banner"
    $ban_img = $this->helper('catalog/image')->init($_product, 'image_banner')->resize(1600, 312);
    if (strpos($ban_img, 'no_image_1.gif') === false) {
        $_img = '<img src="' . $ban_img . '" alt="' . $this->htmlEscape($this->getImageLabel()) . '" title="' . $this->htmlEscape($this->getImageLabel()) . '" />';
        echo $_img;
    }
?>
get attribute value (you have to capitalise the fist character of the attribute code)
<?php echo $_product->getAttributename(); ?>

get attribute text
<?php echo ($_product->getAttributeText('attributename') ); ?>

get data attribute 
<?php echo $_product->getData('attributename');?>

get attribute dropdown and yes/no values
<?php echo $_product->getResource()->getAttribute('attributename')->getFrontend()->getValue($_product);?>