Magento – How to customize the Error Report Page so it uses blocks

ee-1.13errortemplate

We have a custom error report page set up, the specs for the page was that it had to look like the site normally showing the top navigation and category list in the left sidebar, this was done in Enterprise 1.11

while looking at it i found that the person who created the page just got the HTML Source and replaced all the http:// parts with getBaseUrl and added the code in to add the 404 or report .phtml pages, i have found 2 problems with this

  1. in 1.13 all our urls are broken because of the new globally unique url keys, 2/3rds will no longer work
  2. if a chnage has been made to the way the sites looks or new categories are added these wont appear making the error report page and the site no longer looking similar

while i can fix these 2 thing up, the fix is a pain in the ass of how often the page will need to be edited every time there is a change, i have thought to recreate the error page so that it builds up like a normal magento frontend template

here's the kicker, no matter what i google i get the same results which is using static html to make the page with a $baseUrl variable for every link and a require_once $contentTemplate; to get the 404, 503 or report phtml file

i am wondering how i can customize the error report page using the normal blocks so that the page doesn't have to be changed in any template is changed

Best Answer

As stated in the comments... This is just my opinion. I don't think it's a good idea to have the error page (404 or 503, specially the 503) include website assets (categories, products or any other entities that might come from the DB). The page should be as light as possible.
Let's say there is an error connecting to the DB. You want the customer to see that there is an error, but if you try to show categories in it, you will have an error in the error page. (error-ception).
My suggestion is to use a static page, with resources (images) served from and other server. A simple image with an unplugged computer should do the trick.

But if you really insist, here is a quick and dirty way to do it. Create a file (menu.php) where you create an instance of Mage::app() and generate the menu and include that in the error page.

Related Topic