4

How can I add static block in specific CMS page?

Can I do it through Layout Update XML?

enter image description here

8

To 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"}}
3

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:

enter image description here

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

enter image description here

Select the Static Block you want to add from the list

enter image description here

After selecting the block, the code will be added automatically. It should look like this.

enter image description here

Save and boom your static Block is added in your CMS Page

  • I appreciate your effort. But the question demands insertion of static block via LAYOUT UPDATE XML. But please do not remove the answer. Next time, do more look into the actual question. – Rajeev K Tomy Jul 6 '15 at 10:55
  • Thanks.I thought OP is looking to add a CMS static block mainly, and wondering if Layout Update XML can be of some help. The way question has been phrased in 2 parts, it does look like it. – Ajay Bisht Jul 6 '15 at 11:04
2

Yes Layout updates are built for that sort of things. You can add/remove blocks to/from any CMS page using it.

  • do you have sample code for it? – Alyssa Reyes Dec 10 '14 at 6:46
  • @Alyssa From your screenshot it looks like your layout is 1column, in that case you will use: {{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 – Tarun Dec 11 '14 at 9:39
1

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/

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.