Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

show attirbute value in front office
 
jakilcz
Jr. Member
 
Total Posts:  14
Joined:  2008-09-01
 

Hi
I think easy and typicall problem for more experienced people, but as i’m new to magento i have problem with it and i couldn’t find answer anywhere.
I created an attribute called “buyable” as yes/no type attribute. I set values to ‘yes’ for 1st product and ‘no’ to second one.
Now i need to see it on category page, where products are listed.

o know that magento\app\design\frontend\default\default\template\catalog\product\list.phtml is the file that i should put the…
That’s the question - what should i put there to get my value.

And as it’s product taken from products collection - are all attributes available there at all?
If not, what else should i change

BR

Jakub

 
Magento Community Magento Community
Magento Community
Magento Community
 
kullysupply
Member
 
Avatar
Total Posts:  48
Joined:  2008-08-05
 

I’m not 100% sure, but you could try this:

Add your attribute to layout/catalog.xml within the product_list block in both catalog_category_default and catalog_category_layered, like this:

<catalog_category_layered>
        <
reference name="left">
            <
block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
        </
reference>
        <
reference name="content">
            <
block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
                <
block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
                    <!-- 
Attribute to be included -->
                    <
action method="addAttribute"><attribute>buyable</attribute></action>
                </
block>
                
//...

Make sure you use the attribute code, not the attribute label.

Now, in the phtml file you mentioned, this code should work:

$_product->getBuyable()

Let me know if this works!

 
Magento Community Magento Community
Magento Community
Magento Community
 
jakilcz
Jr. Member
 
Total Posts:  14
Joined:  2008-09-01
 

It does work!
Thank You very much, you’re my personal hero now smile

BR

Jakub

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