photo credit: Will Scullin via photopin cc

How to add a custom template in Magento

Sometimes you have situations where you have to create a custom template for your Magento webshop. Take a homepage for example. These pages are always themed with slideshows, categories, advertisements, etc. The last thing you want is misuse the wysiwyg editor, bloating your CMS content with HTML and keep your fingers crossed that your client doesn’t accidentally destroys the whole layout and blames you for it!
A custom template might be just what you need in this case. And creating one is actually quite simple. Let’s take the homepage as an example.

Screen Shot 2014-10-08 at 16.38.25

Add a custom template to your module.

The first thing you need is a module. I assume you already know how to define a module in Magento, and otherwise there are plenty of articles out there covering this topic. The only thing you need to do now, is define a new template in the etc/config.xml  of your module:

That’s it! You now have an extra template to choose from. Now the only thing you need to do is make sure that the file page/homepage.phtml  exists in your template folder.

Visitors give this article an average rating of 4.0 out of 5.

How would you rate this article?

Leave a Reply