Update Magento page structure by overloading the layout content

There are many ways to update Magento page structure content: all lead to the same thing, a custom page, but not in the same ways. Each method has its own advantages and drawbacks.

Within this topic we’ll overview overloading page structure by overloading native Magento layout files

How to overload Magento page structure using loading mechanism ?

All this process is based upon template loading mechanism which I explained before:

  • You define your design through back-office
  • You copy the Magento layout file to update in the layout folder of your custom design folder

For example, if you want to overload Magento customer account page content, you can do it by copying the original customer.xml into your custompackage layout folder

When Magento will be looking for the customer.xml file it will find yours before the default one: this is yours which will be used instead of the native one

Very easy and quick method to update Magento layout…

Advantages of updating Magento page content by overloading native layouts

You are totally independent of the native page structure

With this method, you are totally independent of the existing page structure: you can do what you want inside

Quick way to update page structure content

This is also the quickest way to update page structure: you’ve found which layout file contains the element you want to update, you just have to copy it and update it. No layout update definition, no new module to load to embed some update

Code more clear

Almost everybody knows now which files describe Magento page structure. Using this method makes the code reading easier: no many layout update to find which are involved in a page, this is our layout copy which is involved in your page. There are also less treatments to build your page because there are less files to parse to build your page

Drawback of updating Magento page content by overloading native layouts

Difficult to capitalize

Your new layout page structure depends on the design applied. Even if you can add files of some specific packages in a Magento connect package, it’ll only work if the Magento has configured the same design: force users to use a specific value of design is a difficult choice and will make all other modules installation harder

Difficult to maintain

Creating a fork makes it more difficult to take advantage of developments that may contain Magento updates, and generally the community.

Do you use this kind of method to overload Magento page structure?