How to Create a block in Magento


Many time we need to create a new block in Magento sites.There are two types of Block in Magento:-
1. Structural Blocks
2.Content Blocks For more detail see here.
Step 1 :- Now we are going to create a new Structural Blocks for this you have to create a new file local.xml in your them's layout folder and put this code:-
<?xml version="1.0"?>

  
 
 
   
    
   
  
    


Step 2 :- Now we will create Content Blocks inside newly create Structural Blocks so now our code will be :-
<?xml version="1.0"?>

  
 
 
   
    
   
  
  
   
  
    

Step 3 :- To Call Structural Blocks inside template file use below code:-
<?php echo $this->getChildHtml('featuredproduct') ;
?>
In same way if you want to a new block in left or right column use this code :-
 
 
  
 
 
 
  
 

No comments:

Post a Comment