How to add custom block

In this article we will add new, two columns, text block. 

1. Create a thumbnail of the block.

Create some thumbnail image like bellow

Thumbnail file should be uploaded to this directory:

skin/adminhtml/default/default/mt/email/theme/default/block/images/grid2.png

2. Create the block template (.phtml) file

Please create new file called grid2.phtml here:

app/design/frontend/base/default/template/mt/email/theme/default/block/grid2.phtml

The content of the file grid2.phtml you can download here, and copy it to the file.

3. Layout updates

The next thing what you need to do is to update the layout files. Just copy and paste this code. Important parts are in bold.

<mt_email_block_grid2>
        <block type="mtemail/email_block" name="block" template="block.phtml" >
                <block type="mtemail/email_block_template" name="grid2" template="block/grid2.phtml"/>
        </block>
</mt_email_block_grid2>

in these two files files:

app/design/frontend/base/default/layout/mt/email.xml

and 

app/design/adminhtml/default/default/layout/mt/email.xml

after this line:
<layout version="0.1.0">

4. Add this block to the email template

All mt emails templates are under this directory:

app/locale/en_US/template/email/mt/email/default

If you want to add the block to each template you have to add the code, which are bellow, to each template file. In this example I will show how to add it to the custom.html template. The process is the same with other files.

The code of the block:

"layout handle=\"mt_email_block_grid2\" theme=\"default\" template_id=$this.id block_id=0 block_name=\"mt_email_block_grid2\" ":"mt_email_block_grid2", "mt/email/theme/default/block/images/grid2.png":"mt_email_block_grid2_image",

You have to add this code after this

line:"mt/email/theme/default/block/images/text2.png":"mt_email_block_text2_image",

That's all! Now you can do some tests.