What is a Static Block?

In the Magento back-end, under CMS, you can create & edit pages, static blocks, widgets and polls.  The pages are for content such as your homepage and static blocks add a block of content to an existing page, column or email template.  It’s also a clever way of allowing you to input the same content in multiple areas but only creating the content once (e.g. social network links).

Creating and Editing a Static Block

Click on CMS – Static Blocks.

You’ll notice Magento has the footer links set up as a static block.  To add a new block, click on the orange button in the top right.  To edit an existing static block, simply click on the block’s name.

You can also use Magento widgets (e.g. new products) in a static block.

Adding a static block

  • To Template Files
    getLayout()->createBlock('cms/block')->setBlockId('blockidnamehere')->toHtml() ?>
    Change blockidnamehere to whatever your static block identifier is.
  • To a Transactional Email
    {{block type="cms/block" block_id="blockidnamehere"}}
    Change blockidnamehere to whatever your static block identifier is.

Using Static Blocks

Not convinced why you need static blocks?  They’re fantastic tools for marketing communication and an easy way of editing website content.  Here are some of the clever ways they can be used:

  • add a store strapline or marketing message to the header area
  • add microcopy to Magento’s boxes; shipping, newsletter sign up, etc.
  • create links to your social media pages once & then add them in to pages as needed
  • add a content area to the Contact Us page & Shopping Cart page
  • replace the hard-coded copy in the Registration page with a static block so it can be easily edited in the back-end

Some things are better shared

  • +1 this