1

レビューを製品ページに配置する単純なカスタムモジュールを作成しました(デフォルトのように新しいページにリンクするのではありません)。

製品ページのすべてが完全に機能しています。カタログページのリンクはそうではありません。これは、本来の製品ページではなく、「レビューページ」にリンクしています。これは、カスタムxmlレイアウトファイルのsummary_short.phtmlのレイアウトテンプレートの場所の変更をトリガーできないように見えるためです。

これが私のレイアウトファイルの内容です:

<?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>
4

2 に答える 2

1

私は質問した後に自分の質問に答えるのが嫌いです。とにかく、他の人が問題があるかどうかを知ることができるように、回答を投稿します。

別のメインハンドルが必要であることがわかりました。正解はこれでしたcatalog_category_layered。これが機能する理由と機能しない理由が正確にわからないため、「デフォルト」タグをそこに残しましたcatalog_category_default。誰かがそれに答えることができれば、私は感謝します!

完全な (チャンクの) コードは次のようになります。

<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>

これで、すべてが意図したとおりに機能します。もう少しテストの時間....

于 2012-06-27T23:35:19.340 に答える
0

これは、一方が機能し、他方が機能しなかった理由についての質問に答えるのに役立つ場合があります

基本的に、*catalog_category_layered* は、カテゴリ オプション "Is Anchor" が有効になっている場合に使用されます。

于 2012-07-26T20:51:45.560 に答える