Cannot access new product attributes in grid display
Posted
by russjman
on Stack Overflow
See other posts from Stack Overflow
or by russjman
Published on 2010-04-12T22:26:02Z
Indexed on
2010/04/12
22:33 UTC
Read the original article
Hit count: 336
I added a couple new attribute to my products(a boolean "yes/no" fields). They are variables to enable/disable the price from displaying on the product detail page, and grid view.
I managed to get it work on the product info page. But on product grid page I cant seem to access those variable. Specifically, the template i am working with is catalog/product/list.phtml.
Ive tried adding them in the xml file like this layout/catalog.xml:
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<action method="addAttribute"><name>DisplayPrice</name></action>
<action method="addAttribute"><name>CustomOrder</name></action>
</block>
and I am trying to access the attributes like so in catalog/product/list.phtml:
<?php echo $_product->getDisplayPriceName()? "Yes" : "No" ; echo $_product->getCustomOrderName()? "Yes" : "No" ;?>
ive also added in the Mage config file app/code/core/Catalog/etc/config.xml:
<frontend>
<!---- stuff before this -->
<product>
<collection>
<attributes>
<name />
<url_key />
<price />
<special_price />
<custom_order /> <!--new attribute -->
<display_price /> <!--new attribute -->
<special_from_date />
<special_to_date />
<short_description />
<thumbnail />
<small_image />
<image_label />
<thumbnail_label />
<small_image_label />
<tax_class_id />
<status />
<news_from_date />
<news_to_date />
<created_at />
<updated_at />
</attributes>
</collection>
</product>
</frontend>
At this point im shooting in the dark. I dont know enough about the Magento backend to know where else i need to go or look. ANY feed back will be greatly appreciated.
thanks in advance.
© Stack Overflow or respective owner