cancel
Showing results for 
Search instead for 
Did you mean: 

Display product attribute not always working

Display product attribute not always working

I have defined a product attribute of type price. It works as expected on catalog and product details pages, On other grid an list displays like new products page th value displays as $0 in all case. The attribute label is displayed in all cases. I have tried variations of the code snippet below for hours but to no avail. Any ideas?

 

 

<?php echo "(".$_product->getResource()->getAttribute('donation_value')->getStoreLabel() ." ";
echo Mage::helper('core')->currency($_product->getDonation_value(),true,false).")";
?>

2 REPLIES

Re: Display product attribute not always working

Yeah, I have an idea: you need to tell Magento that you want this attribute to get added to the collection (otherwise only number of base attributes get added). For testing purposes you could try something like this:

$products->addAttributeToSelect('*');

Please note that it adds ALL attributes to collection which means considerable overhead. Use you product attribute code instead of * when using it on production environment.

Tanel Raja

Re: Display product attribute not always working

Ok ill try this ty much.