Magento themes and extensions

how to place a block in a magento cms page sidebar

Posted on April 23rd, 2013 | Posted by admin

Magento Go allows site owners to place a block in the sidebar. If the Magento theme supports sidebars on both sides, just like the default theme, then you can place the content block in either of the two sidebars. By slightly tweaking the codes, you can position the block and control its position in relation to other blocks in the sidebar.

  • Log in to your Magento store backend after entering the correct credentials
  • From the Admin Panel, select CMS > Pages > Manage Content
  • Click to open your desired CMS page

Block Level Caching in Magento

Posted on April 14th, 2013 | Posted by admin

Most of the Magento site falls in slower side. So Magento Caching plays a big role to speed up the site. However, here we discussing the Caching on the Block level. How to cache a particular block part.
You only need to add below code in the block class:

protected function _construct()
       'cache_lifetime'    => 3600,
       'cache_tags'        => array(Mage_Catalog_Model_Product::CACHE_TAG),
       'cache_key'        => "PRODUCT" . $this->getProduct()->getId(),

cache_lifetime – you can either specify number in seconds or false. If set to false, then cache will never expire.

Magento disable / stop block caching

Posted on January 3rd, 2013 | Posted by admin
  • Magento disable cache for block
  • Magento disable footer cache
  • Magento disable cache block
  • Magento block cache
  • Disable cache from specific module in magento
  • Sidebar cache_lifetime false in magento

Have you ever want to disable cache for a Magento block? When do we need it? – Yes, by default some Magento Block is enabled cache, sometime you may have some custom code (spaghetti style) in a HTML block and you will need to disable caching in this case, otherwise your footer will be cached on first visitor.

How to Show Static Block in theme Magento

Posted on July 11th, 2012 | Posted by admin

In magento: Create an Static Block from your CMS admin tab and show it in your theme.

In my case I wanted to call a Static Block from my theme to show up in the sidebar.

I edited my theme file called 2columns-left.phtml and then added the following code.

Please notice you need to replace the YourBlockId with your own Static Block Id.

<?php echo $this->getLayout()->createBlock(‘cms/block’)
->setBlockId(‘YourBlockId’)->toHtml() ?>

How to get a block in any where?

Posted on July 29th, 2011 | Posted by admin

By the normal way, you can get a block by using object Layout.

For example,  in a controller:


It is the same with a block or a template file.

But if you want to get a block in a helper, model or any where, what way?

In this case, you can use: Mage::app()->getBlockSingleton(‘module_name/block_name’);

· ·

No comments yet.

Page 1 of 3123»