Magento Forum

   
How do I display Custom Attributes? 
 
cgfc
Sr. Member
 
Avatar
Total Posts:  92
Joined:  2008-08-29
Montevideo, Uruguay
 

Hi everybody, I need a hand with this. I’m putting together a website and products on this site will have many attributes, some of them will be text and others will be drop down (in the backend, at the frontend will always be text), but my problem is how do I do to display these attributes on the web.
Lets suppose that I have a custom attribute named Presentation (id: presentation, in lowercase), which is a drop down where I have the ways in which my product is sold (pack of 10, pack 20, pack of 30, etc. ..), the ways that I have tried to show that attribute is:

<?php echo $_product->getPresentation()?>
<?php echo $_product->getpresentation()?>
<?php echo $_product->getAttributeText('presentation')?>
<?php echo $_product->getResource()->getAttribute(’presentation’)->getFrontend()->getValue($_product?>
<?php echo $_product->getResource()->getAttribute('presentation')->getSource()->getOptionText($_product->getPresentation()) ?>

But I the result is allways the same: Nothing......
Any ideas?

Thxs to all

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tobias Vogt
Member
 
Avatar
Total Posts:  42
Joined:  2009-01-28
 

Hi cgfc,

you have to add the Presentation attribute to your collection. Take a look at the related products ( Mage_Catalog_Block_Product_List_Related):

Line 44:

$this->_itemCollection $product->getRelatedProductCollection()
            ->
addAttributeToSelect('required_options')
            ->
addAttributeToSelect('presentation')
            ->
addAttributeToSort('position''asc')
            ->
addStoreFilter()

Greetings

Tobi

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top