Tuesday, December 24, 2013

set CMS Block order in Magento sidebar

I inserted Social Badges and an google Adsense by using Static Block and local.xml.
It was located under the original right sidebar menu.
I did not wanted to show adsense and insert social badge above community poll of shop.isdream.net.

So, I had to change the order of Static Block.

First of all, I had to make a new static block named as right.social with its Block ID right_social.

Then, to change the order of my social static block, I use "before" or "after" in positioning property in code.

* before="-"    Places the block at the top of the sidebar, before other blocks.
*  after="-"       Places the block at the bottom of the sidebar, after other blocks.

If you want to place your block before or after a specified block, just write a specified block name instead of hyphen (-)

So, code to place a static block is as follows:

<block type="cms/block" before="-" name="right.social">
<block type="cms/block" before="some-other-block" name="right.social">
<block type="cms/block" after="-" name="right.social">
<block type="cms/block" after="some-other-block" name="right.social">

I used the first one in my local.xml and I get my social badge at top of right sidebar in Magento store.


No comments:

Post a Comment