Take the 2-minute tour ×

When creating a module to extend magento its great to be able to package everything up in a self contained, well, module, and simple add it to a site by dragging it in to the root directory.

I have one problem though, what happens when you create a module and need to add something to output in an existing template file say catalog/product/view.phtml for example.

This is fine when you are in full control of the code and have easy access to it, you simply use a layout update in your modules config file, add the necessary code the your modules layout file and then call getChildHtml in the desired template.

But, I am creating a module that collegues will be using, now and in the future and it would be good to have a way where they dont have that final step of having to manually edit the template file.

How do you get around this instead of completely replacing the template file as part of your module?

share|improve this question
add comment

1 Answer


Though I haven't tried it yet myself, Inchoo is a fantastic resource, and they posted this article earlier this year and it looks quite intriguing and could potentially do what you want to do without needing any template files: http://inchoo.net/ecommerce/magento/how-you-could-build-your-magento-extensions-without-view-files/

Otherwise, there's no really nice way to do it (that I know about at least). You need to do as you said and create your own layout xml file, and override the template with your own.

share|improve this answer
add comment

Your Answer


