Search code examples
magentolayoutmagento-1.5

Magento - layout template location change of reviews link (summary_short.phtml) on Catalog page


I've made a simple custom module that places the reviews on the Product page (instead of linking to the a new page as is the default).

Everything on the Product page is working perfectly. The link on the Catalog page is not. This still links to the "review page" instead of the Product page like it should. This is because I cannot seem to trigger a layout template location change for the summary_short.phtml in my custom xml layout file.

Here is my layout file contents:

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">

<default>
    <reference name="head">
        <action method="addItem"><type>skin_css</type><name>css/reviews.css</name></action>
    </reference>      
</default>

<!-- This works great -->  

<catalog_product_view>              
    <reference name="content">     
        <reference name="product.info">
            ...  
            <action method="addReviewSummaryTemplate"><type>default</type><template>productpagereviews/review/helper/summary.phtml</template></action>
            <action method="addReviewSummaryTemplate"><type>short</type><template>productpagereviews/review/helper/summary_short.phtml</template></action>
        </reference>
    </reference>
</catalog_product_view>

<!-- Below does not work at all -->  

<catalog_category_default>
    <reference name="content">
        <reference name="product_list">
            <action method="addReviewSummaryTemplate"><type>default</type><template>productpagereviews/review/helper/summary.phtml</template></action>
            <action method="addReviewSummaryTemplate"><type>short</type><template>productpagereviews/review/helper/summary_short.phtml</template></action>
        </reference>
    </reference>
</catalog_category_default>
</layout>

Solution

  • I hate answering my own question AFTER I ask it - dang it! Regardless, I'm going to post the answer so others can know if they have trouble.

    It turns out I needed a different main handle. The correct one was this catalog_category_layered. I still left the "default" tag there as I'm not exactly sure why this one works and catalog_category_default doesn't. If anyone can answer that, I'd be grateful!

    The complete (chunk of) code would be as below:

    <catalog_category_layered>
        <reference name="product_list">
            <action method="addReviewSummaryTemplate"><type>short</type><template>productpagereviews/review/helper/summary_short.phtml</template></action>
        </reference>
    </catalog_category_layered>
    

    Now everything works as exactly as intended! Time for some more testing....