Engine23

Magento - create a static block in footer

Static blocks are a Magento feature that makes adding content to your Magento site easy and convenient. Static blocks allow for your Magento site to be updated via the admin panel making it faster than having to “hard-code” every time you need to make a change to your website. Static blocks can be used anywhere on your Magento site to display text, images, & navigation. Some Magento designs have static blocks already in place for your convenience; however, you might have to install them yourself. Below is a simple tutorial on how to install a static block in the footer of your Magento site
Step One: Create Static Block in Your Magento Admin Magento Admin Panel—>Static Blocks—>Add New Block
1) Name your Static Block, in this case Custom footer Links
2) Label the Identifier (This is the link you will use to call the block later) in this case, custom-footer-links
3) Choose what store view you would like it to render in
4) Set Status to Enabled
5) Now for the fun part! Add your navigation links to the block. Make sure to use <style> to make them match your magento site’s color and theme.
Step Two: Inserting Code to Call the Static Block
This part is going to require you to FTP into your Magento site and modify footer.phtml app—>design—>frontend—->default—>(your template)—>template—>page—>footer.phtml Find where in the footer you want your navigation links to display and insert: <?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘custom-footer-links’)->toHtml(); ?> Now most of the time the Static block should display just fine but in some cases you are going to have do some extra steps to have the block display. 1) Instead of inserting: <?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘custom-footer-links’)->toHtml(); ?> Use: <reference name=”left”> <block type=”cms/block” name=”left.permanent.callout”> <action method=”setBlockId”><block_id>custom-footer-links</block_id> </action> </block> </reference> 2)Modify catalog.xml app—>design—>frontend—>default—>f002—>layout—>catalog.xml Add under <!– Mage_Catalog –> <block type=”cms/block” name=”left.permanent.callout”> <action method=”setBlockId”><block_id>custom-footer-links</block_id> </action> </block>

Share: