2

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

6
  • 2
    This is just my opinion (that's why is not written as an answer). 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...). 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. 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. :)
    – Marius
    Commented Aug 7, 2013 at 6:21
  • 1
    could not agree more.
    – ProxiBlue
    Commented Aug 7, 2013 at 6:36
  • @Marius i get that, it wasn't my idea to include the categories menu, hell, i didn't mind the default one, but the higher ups insisted we make the error page look the same as the site and the one who made the page obviously didn't raise up any concerns about changes to categories, CMS menus or the overall design and no doubt if the error page shows up the higher ups are going to say "oh the menu is different from the site, fix it", if i could build it like a normal magento template i could fix up catches to use static html if we can't generate it
    – Memor-X
    Commented Aug 7, 2013 at 22:14
  • 2
    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.
    – Marius
    Commented Aug 8, 2013 at 8:29
  • 1
    @DavidManners. Done. And next time feel free to "steal" the points :).
    – Marius
    Commented Jun 27, 2014 at 12:19

1 Answer 1

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.