When working with Magento, I am sure that you are very familiar with error page which shows message "There has been an error processing your request". Of course, you will never want your customers to see this page. Well, you can avoid this by testing the site very carefully but you can't guarantee 100% about that. Another good approach is to customize this error page to make it more friendly. You can add a contact form into that page or change the layout and css to make it the same as your site. Thanks to a Magebase post (http://magebase.com/magento-tutorials/customizing-the-magento-error-report-and-maintenance-page/), we can understand about error page very clearly. In this post, I will expand the tutorial to help you customize skin and layout of error page. Following this article, you can have your error page the same as your site style and layout. And you will know how to call a static block in the error page. Let's go!
Step 1: Create custom skin for error page
All necessary files for error page are in errors folder. In errors folder, you can find local.xml.sample file, change its name to local.xml. Now you can defind the skin for error page. Open this file and change the value between <skin></skin> tag.
After that, you need to copy 'default' folder and rename it into your site theme name.
Step 2: Customize html and css
In your skin folder (it should be errors/[your_theme_name]), there are following important files and folders:
- page.phtml: this file is used to control the layout of error page
- report.phtml: show the error message
- css and images folder: contain css and image files for error page.
First, you should copy styles.css from skin/frontend/[your_package]/[your_theme]/css folder into error/[your_theme]/css. Then you will need to change html of page.html, customize css to make sure that it has the same header and footer as your whole site.
I cannot go detail for this step. It requires you to be good at html/css and have some knowledge about Magento layout. If you have any question, do not hesitate to give me a comment.
Step 3: Call a static block in error page
If you just want the error page to have same layout, header and footer as your whole site, you can skip this step.
First, create a static block in backend of your Magento site. You can call this block in either page.phtml or report.phtml. It is up to you.
To call static block in these pages, you need to add following code:
$baseDir = dirname(__FILE__); require $baseDir . '/../../app/Mage.php'; Mage::app();
And echo the content of this static block
$staticBlock = Mage::getModel('cms/block')->load('error-page'); echo $staticBlock->getContent();
This is not a descriptive tutorial, it shows you step by step to customize and add static block to Magento error page. To have it done, you must have knowledge about Magento, html and css.
If you need any help, I will be your guy.