How can I add a static block in product page before reviews?
-
12-12-2019 - |
Question
I'm using default RWD theme. I'm trying to add my static block in product page between additional information tab and product reviews tab.
I tried to add something like this in my local.xml file but it doesn't work:
<catalog_product_view>
<reference name="product.info">
<block type="cms/block" name="my_block_name" before="reviews">
<action method="setBlockId"><id>my_block_name</id></action>
</block>
</reference>
</catalog_product_view>
Solution
If you have a lok at how the review tab has been added in review.xml
of the rwd theme, you find:
<catalog_product_view>
<reference name="product.info">
<block type="review/product_view_list" name="product.reviews" as="reviews" template="review/product/view/list.phtml" after="additional">
<action method="addToParentGroup"><group>detailed_info</group></action>
<action method="setTitle" translate="value"><value>Reviews</value></action>
</block>
</reference>
</catalog_product_view>
You can use the same method to add any other block as a tab in your own module (or local.xml of your theme). For a static block, it can look like this:
<catalog_product_view>
<reference name="product.info">
<block type="cms/block" name="product.whatever" as="whatever" after="additional">
<action method="addToParentGroup"><group>detailed_info</group></action>
<action method="setTitle" translate="value"><value>Whatever</value></action>
<action method="setBlockId"><id>my_whatever_block_id</id></action>
</block>
</reference>
</catalog_product_view>
after="additional"
will move it before the reviews tab because the core modules are always loaded first.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange