0

I've added my code to cms.xml to display static blocks in the footer. I want them to be in the following order:

  • Left
  • Middle
  • Right

But when I check my site, they're loaded in this order:

  • Right
  • Left
  • Middle

Here is the code I use to display the blocks

<reference name="footer">
        <block type="cms/block" name="cms_footer_links" before="footer_links">
            <action method="setBlockId"><block_id>footer_links</block_id></action>
        </block>

       <block type="cms/block" name="cms_footer_middle" before="footer_middle">
            <action method="setBlockId"><block_id>footer_middle</block_id></action>
        </block>

        <block type="cms/block" name="cms_footer_right" before="footer_right">
            <action method="setBlockId"><block_id>footer_right</block_id></action>
        </block>
 </reference>

Can anybody tell me what i'm doing wrong?

0

I see that you have before attributes in your layout.
The value of before should not be the static block id. It should be the block type="cms/block" name.
But if you want to add them in that order you should use after instead of before. Both of them work, but it's more readable using after

<reference name="footer">
    <block type="cms/block" name="cms_footer_links"><!-- this does not need after-->
        <action method="setBlockId"><block_id>footer_links</block_id></action>
    </block>

   <block type="cms/block" name="cms_footer_middle" after="cms_footer_links"><!-- placed after `cms_footer_links` -->
        <action method="setBlockId"><block_id>footer_middle</block_id></action>
    </block>

    <block type="cms/block" name="cms_footer_right" after="cms_footer_middle"><!-- placed after `cms_footer_middle` -->
        <action method="setBlockId"><block_id>footer_right</block_id></action>
    </block>
 </reference>
0

Hi you need to in xml

Magento is managed xml block position by before and after layout tag at which is managed a block postion

See basic knowledge:

https://stackoverflow.com/questions/14484955/magento-xml-using-before-after-to-place-blocks-hardly-ever-works

http://www.magentocommerce.com/design_guide/articles/intro-to-layouts

<reference name="footer">
    <!-- change postion by  cms_footer_right -->
        <block type="cms/block" name="cms_footer_links" after="cms_footer_right">
            <action method="setBlockId"><block_id>footer_links</block_id></action>
        </block>

       <block type="cms/block" name="cms_footer_middle" after="cms_footer_links">
            <action method="setBlockId"><block_id>footer_middle</block_id></action>
        </block>

        <block type="cms/block" name="cms_footer_right" after="-">
            <action method="setBlockId"><block_id>footer_right</block_id></action>
        </block>
 </reference>

See study on block position

http://www.magentocommerce.com/knowledge-base/entry/controlling-block-order

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.