Jul 27, 2014

Magento - Customize your error page by store view.

In your magento home directory you can find file/folder structure.
Magento/
  errors/
     default/
        css/
        images/
        404.phtml
        503.phtml
        page.html
        report.phtml
     404.php
     503.php
     report.php
     processor.php
     local.xml

File description and uses.
404.php       -> I guess 404 page but seems not calls when i encounter.
503.php       -> Mostly for maintenance page(check your index.php)
report.php    -> this file calls when encounter un-handle exception.
processor.php -> Main class for error handling
local.xml     -> Error Handling configuration
    404.phtml -> 404 page template
    503.phtml -> Maintenance error handin template.
    page.html -> Main page or layout of the error excemption
    report.phtml -> Exception error template

Above info is just a head up about the file/folder structure and information. Now lets assume that you have store view with store code mobile(that simplify the store is for mobile). To create custom error for your store(Store front). Best way copy the default error and name it same to your store code.
$ cd MAGENTO_PATH_DIR/errors/
$ cp default mobile

Now is time for you to customize the mobile custom error page. For this to able to use, you have to modify MAGENTO/errors/local.xml

<config>
    <skin>default</skin> <!-- Change default in to mobile-->
    <!-- Some other setting below -->
</config>

Aside from modifying your local.xml. You can also access the site with a parameter skin and is your store code.
Example: http://localhost/magento?skin=mobile
or you can modify the MAGENTO/index.php and the code before below.
<?php
$_GET['skin']='mobile'; // Add aditional parameter on every request.
Mage::run($mageRunCode, $mageRunType);
?>