How To Create Custom 404 Page?

The new default error 404 page for CS-cart is horrible and extremely un-user friendly. Does anyone know we can create our own custom 404 page? Yes we’re aware we can do this via CP but we’re curious if this is possible in CS-Cart 2.1.4 as it was in 1.3.5? Thank you in advance for your advice :slight_smile:

I really don’t like the default error page either so I came up with my own.



This is how my skins/my-skin/customer/exception.tpl file looks:


```php {* $Id: index.tpl 10618 2010-09-13 11:50:51Z alexions $ *}




{strip}

{if $page_title}
{$page_title}
{else}
{foreach from=$breadcrumbs item=i name="bkt"}
{if !$smarty.foreach.bkt.first}{$i.title}{if !$smarty.foreach.bkt.last} :: {/if}{/if}
{/foreach}
{if !$skip_page_title}{if $breadcrumbs|count > 1} - {/if}{$location_data.page_title}{/if}
{/if}

{/strip}
{include file="meta.tpl"}

{include file="common_templates/styles.tpl" include_dropdown=true}
{include file="common_templates/scripts.tpl"}



{if "SKINS_PANEL"|defined}
{include file="demo_skin_selector.tpl"}
{/if}


{include file="common_templates/loading_box.tpl"}

{include file="main_exception.tpl"}

{if "TRANSLATION_MODE"|defined}
{include file="common_templates/translate_box.tpl"}
{/if}
{if "CUSTOMIZATION_MODE"|defined}
{include file="common_templates/template_editor.tpl"}
{/if}
{if "CUSTOMIZATION_MODE"|defined || "TRANSLATION_MODE"|defined}
{include file="common_templates/design_mode_panel.tpl"}
{/if}


{hook name="index:footer"}{/hook}




```

That is calling up a file called main_exception.tpl

In that file I have:

```php {* $Id: main.tpl 10618 2010-09-13 11:50:51Z alexions $ *}

{block group="top" assign="top"}
{block group="left" assign="left"}
{block group="right" assign="right"}
{block group="bottom" assign="bottom"}

{hook name="index:main_content"}
{include file="top.tpl"}

{/hook}



{if $top|trim}

{$top}

{/if}

{hook name="index:columns"}




{$exception_status}




{if $exception_status == "403"}
{$lang.access_denied}
{elseif $exception_status == "404"}
{$lang.page_not_found}
{/if}




{if $exception_status == "403"}

{$lang.access_denied_text}


{elseif $exception_status == "404"}

{$lang.page_not_found_text}


{/if}







{$manifest.Customer_logo.alt}







{$left}


{if $right|trim}

{$right}

{/if}
{/hook}

{if $bottom|trim}

{$bottom}

{/if}






{include file="bottom.tpl"}



```

There might be a cleaner way to do this, but the results are good. You can see a 404 error page on my site at [url]http://www.saltwatertogo.com/a[/url]

Hope that helps,

Brandon

brandonvd code is good but other method is if you able to buy themes which is easily available on themeforest.net

how you can display the menu ? because when i copy the code from index.html my menu doesn’t display. Maybe problems come from the hook index ?

For error pages all you have to do is make them, name the right way and place them in your web root. You should have;



400.shtml

404.shtml

405.shtml

500.shtml



Take a look at mine here - [url]Football4sale |Programmes,Cup Final Memorabilia, Tickets,Football Magazines |F4S Est 1999.

Thanks Brandon, works for me. My page probably needs to be a little longer to make the template look better, but I’ll have to work on that.

Where is the file where the text



404



Page Not Found



The page you have requested cannot be found.



can be changed?

In CS 2.2.5 we ended up using the instructions found here:

How to redirect a customer to a custom 404 error page in CS-Cart - Knowledgebase - Granite Web

I just redirecting people to the sitemap to keep it simple.

Hello,



We have developed “CS-Cart 404 custom redirect add-on” and installed more than 10+ CS-Cart website.



Please check here for more details.



Thankyou.