views:

157

answers:

1

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.

A: 

When loading your products specify what custom attributes you wanted loaded.Magento is not loading them by default.. although in my opinion it should.

$products = Mage::getModel('catalog/product')->getCollection()
    ->addAttributeToSelect("custom_order")
    ->addAttributeToSelect("display_price ") 
;
Elzo Valugi