How can I add static block in specific CMS page?
Can I do it through Layout Update XML?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityTo add static blocks through Layout Update XML in CMS Pages use something like this code
<reference name="right">
<block type="cms/block" name="your.1st.block.name" before="-">
<action method="setBlockId">
<block_id>your_1st_block_id</block_id>
</action>
</block>
<block type="cms/block" name="your.2nd.block.name" after="-">
<action method="setBlockId">
<block_id>your_2nd_block_id</block_id>
</action>
</block>
</reference>
This example code will add two static blocks to the right sidebar, one at the top and one at the bottom. Of course, you will have to set your page layout to 2 columns with right sidebar in the example. If you have a 1 column layout then you could use "content" as a <reference>
.
But there is another option, which may be easier for you, especially if you use the 1 colomn layout. You could also insert static blocks directly into the content area of your CMS Page with this code
{{block type="cms/block" block_id="your_block_id"}}
UPDATE: This method does not use Layout Update XML to add static block
Static blocks can be added to CMS Pages:
Go to CMS > Pages. Click on Add new page or select your CMS page from list
Select Content tab:
Make sure Show/Hide Editor is set to Hide, i.e; its not in Show editor mode. Click on Insert Widget
From options available, Select CMS Static Page for Widget Type and click on Select Block button
Select the Static Block you want to add from the list
After selecting the block, the code will be added automatically. It should look like this.
Save and boom your static Block is added in your CMS Page
Yes Layout updates are built for that sort of things. You can add/remove blocks to/from any CMS page using it.
{{block type="cms/block" name="your_identifier" before="<before_section>" after="<after_section>" block_id="<your_block_identifier>"}}
. If you haven't already created it, go to cms -> blocks and create the block with your_block_identifier
and you are done. NOTE: the before="" and after="" sections are optional and is useful if you want to show your block before/after any other block in the page
You can definitely use the custom layout update to place your own static block on left without any coding.
You need to create a static block and then put its reference into custom layout update
<reference name="left">
<block type="cms/block" name="my_left_block" before="-">
<action method="setBlockId"><block_id>my_left_block</block_id></action>
</block>
to view an example follow the link below https://lampjs.wordpress.com/2015/07/06/magento-add-static-cms-block-to-category-page-on-left/
You could also insert static blocks directly into the content area of your CMS Page with this code
{{block type="cms/block" block_id="your_block_id"}}