Magento Forum

   
Customattributes in “new products” listing
 
flohdot
Jr. Member
 
Total Posts:  5
Joined:  2008-12-15
 

Hi, kind of a n00b here.

I am trying to get a custom attribute to show up on the “new products” listing on my homepage.

Thus far, I have the custom attribute showing up where I want it to on the regular category listing page, on the search listing and wherever I want it on the actual product page. So far so good. However, no matter what I try, I cannot get it to show up on the New Products block.

The block itself is, I think, unmodified from how Magento came out of the box:

<block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="navigation">
     <
action method="addPriceBlockType">
        <
type>bundle</type>
        <
block>bundle/catalog_product_price</block>
        <
template>bundle/catalog/product/price.phtml</template>
      </
action>
    </
block>

I am using solutions found all over the forums for getting my custom attribute to show up in various places…

Specifically, I have a file /app/etc/modules/category_product_attributes.xml --

<?xml version="1.0"?>
<config>
    <
modules>
        <
category_product_attributes>
            <
active>true</active>
            <
codePool>local</codePool>
        </
category_product_attributes>
    </
modules>
</
config>

and /app/code/local/category_product_attributes.xml --

<?xml version="1.0"?>
<config>
  <
modules>
        <
category_product_attributes>
            <
version>0.0.1</version>
        </
category_product_attributes>
    </
modules>
  <
frontend>
    <
product>
      <
collection>
        <
attributes>
          <
artist/>
          <
tracklist/>
        </
attributes>
      </
collection>
    </
product>
  </
frontend>
</
config>

I’ve also modified the following block within layout file catalogsearch.xml (in both catalogsearch_advanced_result and catalogsearch_result_index):

<block type="catalogsearch/advanced_result" name="catalogsearch_advanced_result" template="catalogsearch/advanced/result.phtml">
                <
block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml"></block>
                <
action method="setListOrders"/>
                <
action method="setListModes"/>
                <
action method="setListCollection"/>
                <
reference name="search_result_list">
                    <
action method="addAttribute"><attribute>artist</attribute></action>
                </
reference>
            </
block>

I am using the following to pull up the attribute I want in list.phtml

<?php echo $this->htmlEscape($_product->getResource()->getAttribute('artist')->getFrontend()->getValue($_product)); ?>

All this to say, the code works exactly the way I want it to on the search pages and the regular category listings. However, my attribute does not show up in the New Products block (which is on my homepage). I tried sticking <action method="addAttribute"><attribute>artist</attribute></action> within the new products block, but that crashed the page. I am totally out of ideas.

Help, anyone? Thanks so much!

 
Magento Community Magento Community
Magento Community
Magento Community
 
flohdot
Jr. Member
 
Total Posts:  5
Joined:  2008-12-15
 

Help, anyone?

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