How to show CMS static block in only one specified category page in magento

Topics focus on Web Developments, Programming, Database, Digital Marketing Tutorials, Code Snippets, SEO, Social Media Marketing and Inspirational articles.

How to show CMS static block in only one specified category page in magento

How to show CMS static block in only one specified category page in magento

Here, We will explain How to show CMS static block in only one specified category page in magento?

In some cases, We need to show a single static block in one or few categories, instead of all categories or pages. So, here I am explaining how to do this.
First of all, you can achieve this by coding in layout XML. It will show the static block ‘my-sidebar-1’ on right sidebar of category with id ‘1’. Similarly, static block ‘my-sidebar-2’ is displayed on the category page with id ‘2’.

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<CATEGORY_1>
	<reference name="right">
		<block type="cms/block" name="my.sidebar.1" before="-">
			<action method="setBlockId"><block_id>my-sidebar-1</block_id></action>				
		</block>
	</reference>
</CATEGORY_1>
<CATEGORY_2>
	<reference name="right">
		<block type="cms/block" name="my.sidebar.2" before="-">
			<action method="setBlockId"><block_id>my-sidebar-2</block_id></action>				
		</block>
	</reference>
</CATEGORY_2>

Add comment


 

Pin It on Pinterest

Share This