16. Magento. How to add a static blocks to product details pages
1 min read- Navigate to CMS -> Static Block -> Add New Block:
- Create static block. We will use “contact_info_widget” as Identifier:
- Open the file app/design/frontend/default/themeXXX/layout/catalog.xml. It is a layout file for the catalog module. Find the reference below:
1<strong><catalog_product_view></strong>
- Add the following code right below the reference:
12345<reference name=”left”><block type=”cms/block” name=”contact_info_widget” before=”-“><action method=”setBlockId”><block_id>contact_info_widget</block_id></action></block></reference>
- In case your template comes with right sidebar area, you should change the reference name from “left” to “right”:
12345<reference name=”right”><block type=”cms/block” name=”contact_info_widget” before=”-“><action method=”setBlockId”><block_id>contact_info_widget</block_id></action></block></reference>
- Make sure to replace contact_info_widget idenfifier with your own one.
- Save the file. clear Magento cache. Navigate to product page to see the changes.