March 02, 2014

8:48 am
In this article, we are going to discuss about How to add the CMS blocks into the pages in Magento. Magento is a popular E-commerce CMS framework. Magento is a feature-rich, open-source, enterprise-class platform that offers merchants a high degree of flexibility and control over the user experience, catalog, content and functionality of their online store. We can add CMS blocks into Magento pages in 2 ways.

Step 1 : Using the xml layouts

<block type="cms/block" name="block_name" as="block_name" after="-">
    <action method="setBlockId"><block_id>the_block_id</block_id></action>
</block>

Step 2 : Using the phtml files

<?php
echo $this->getLayout()->createBlock('cms/block')->setBlockId('the_block_id')->toHtml() ;
?>

0 comments:

Post a Comment