Magento default installation already has a predefined custom 404 page (no-route). But is it enough to help visitor/customer get back on right track!?

. Let’s look over a few examples of custom designed 404 pages. http://centar-alata.hr/404https://github.com/404,http://www.bluedaniel.com/404http://www.casino-lemonade.com/404/ –
as you can see, it can be funny, creative or you can take advantage of this “case” and try to engage potential customer. Here are a few quick and dirty ideas on how to reuse custom 404 page in Magento and try to serve specific content on it.



Under Magento administration we can manually set default 404 page template. System -> Configuration -> General -> Web -> Default Pages -> CMS No Route Page. Here you can add any previously created CMS page (Customer Services for example).

Default 404 page settings

Or you can use more specific content (search form, store sitemap, contact form, specific store categories with promoted products…).

We can use layout update via CMS -> Pages -> 404 not found -> Design -> Layout Update XML. But, we want more controls and we will edit template files. Only thing you can change here is Page Layout, I will use
1 Column page.

Page settings

Default 404 page.

Default 404 page

Now we need to have access to layout and template files or your current theme, first we will start with cms.xml app/design/frontend/yourpackage/yourtheme/layout/cms.xml in my example path is app/design/frontend/base/default/layout/cms.xml.

Open cms.xml in favorite editor go to line 73 or find

<cms_index_noroute translate="label">

Little cleaning

<cms_index_noroute translate="label">
<label>CMS No-Route Page</label>
<reference name="content">
<remove name="page_content_heading"/>
<remove name="cms.wrapper"/>
</reference>
</cms_index_noroute>

Blank 404 page

Clean layout, and now we can add specific category listing with products, or we can create new category which will contain only products for 404 landing page. We can also create Catalog Price Rules for 404 page
category and add some compensation through discount…

    <cms_index_noroute translate="label">
<label>CMS No-Route Page</label>
<reference name="content">
<remove name="cms.wrapper"/>
<block type="catalog/product_list" name="featured" template="catalog/product/list.phtml" after="page_content_heading">
<action method="setCategoryId"><category_id>15</category_id></action>
<action method="setColumnCount"><column_count>5</column_count></action>
<action method="setDefaultGridPerPage"><limit>15</limit></action>
</block>
</reference>
</cms_index_noroute>

404 page category listing

Željko has already written about a slightly different approach trough CMS 404 page content editinghttp://inchoo.net/ecommerce/magento/last-things-first/.

In most cases 404 pages always have some kind of search form, we can use 2 approaches, simple quick search or advanced search form.

Quick search:

<cms_index_noroute translate="label">
<label>CMS No-Route Page</label>
<reference name="content">
<remove name="cms.wrapper"/>
<block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/>
</reference>
</cms_index_noroute>

Quick search

Now we will try to use advanced search, in this case we need to create new template for advanced search form. app/design/frontend/base/default/template/catalogsearch/advanced/form.phtml – I will simply duplicate
this template and give it a name 404search.phtml, open that file and on line 38 find

<form action="<?

php echo $this->getSearchPostUrl() ?

>" method="get" id="form-validate">

Replace with

<form action="<?

php echo $this->getUrl('catalogsearch/advanced/result'); ?>" method="get" id="form-validate">

Open cms.xml and add some magic

    <cms_index_noroute translate="label">
<label>CMS No-Route Page</label>
<reference name="content">
<remove name="cms.wrapper"/>
<remove name="page_content_heading"/>
<block type="catalogsearch/advanced_form" name="catalogsearch_advanced_form" template="catalogsearch/advanced/404search.phtml"/>
</reference>
</cms_index_noroute>

voila

Advanced Search

One more idea is to add a contact form where users can submit a message if they need some help or cannot find something over and over.

Again we need to edit .phtml file, app/design/frontend/base/default/template/contacts/form.phtml and create duplicated template, my name was 404form.phtml.

Open it and around line 31 find:

<form action="<?

php echo $this->getFormAction(); ?>" id="contactForm" method="post">

replace with:

<form action="<?php echo Mage::getUrl(); ?>contacts/index/post/" id="contactForm" method="post">

Now edit cms.xml

    <cms_index_noroute translate="label">
<label>CMS No-Route Page</label>
<reference name="content">
<remove name="page_content_heading"/>
<block type="core/template" name="contactForm" template="contacts/404form.phtml"/>
</reference>
</cms_index_noroute>

Contact Form

This article is for demonstration purposes only and to give you ideas how to spice up a little, boring 404 page.

Good luck!

Enhance Magento 404 page的更多相关文章

  1. custom post types 404 Page Error

    问题: 注册新的文章类型后,用新的类型写文章,打开后报 404 错误 原因: 因为虽然注册了新的帖子类型,但WordPress还不知道如何处理它 解决: 到设置 -> 固定链接,重新点击保存,再 ...

  2. C# MVC模式 404 500页面设置方法

    <customErrors mode="On" defaultRedirect="Controllers/Action"> <error st ...

  3. 经典设计:30个另类的 404 not found 页面设计

    404页面是每个网站必不可少的一部分.我们在网络上能看到很多创意的404错误页面.在这篇文章中,我挑选了30个充满灵感和启发性的404页面设计的例子.Web 设计师们花精力设计一个另类的自定义的404 ...

  4. Magento Meigee-Glam 主题的用法

    Start起点 Package Structure包装结构 License许可证 Installation安装 What's new Updated!更新了什么! Theme options主题选项 ...

  5. 在Tomcat中配置404自定义错误页面详解

    这篇文章主要介绍了在Tomcat中配置404自定义错误页面全解,需要的朋友可以参考下 一直使用tomcat,今天想到一个问题,自定义404错误页面, 为了获得很好的用户感受,是不应当向用户暴露404这 ...

  6. 构建通用的 React 和 Node 应用

    这是一篇非常优秀的 React 教程,这篇文章对 React 组件.React Router 以及 Node 做了很好的梳理.我是 9 月份读的该文章,当时跟着教程做了一遍,收获很大.但是由于时间原因 ...

  7. JHipster框架的简要搭建与说明

    JHipster的亮点 风头超劲,席卷欧美,最新全能Java Web开发程式产生器 (java web generator). 由Java专家累积的开发经验,配上各类实用的框架技术,去繁取精的运用,全 ...

  8. Web Application Penetration Testing Local File Inclusion (LFI) Testing Techniques

    Web Application Penetration Testing Local File Inclusion (LFI) Testing Techniques Jan 04, 2017, Vers ...

  9. python 爬虫(一)

    1. 一次简单的网页访问 urllib 是一个标准的python库(意味着不需要安装任何附件的东西来运行这个demo),包含了通过网络请求数据的方法,处理cookies,甚至更改metadata比如h ...

随机推荐

  1. dos命令及HTML基础语法

  2. 汇编3栈帧,参数传递,串操作,混合汇编,x64,asm文件

    基础知识2 选择结构 通过判断 + 条件跳转指令来实现 循环结构 通过判断 + 条件跳转指令来实现(会有一个向上跳转的语句) 函数调用约定 C调用约定: 由外部平衡栈 标准调用约定 : 由函数内部平衡 ...

  3. DFS、BFS和Backtracking模板

    区别与联系 区别 DFS多用于连通性问题因为其运行思想与人脑的思维很相似,故解决连通性问题更自然,采用递归,编写简便(但我个人不这样觉得...) DFS的常数时间开销会较少.所以对于一些能用DFS就能 ...

  4. Swift语言Storyboard教程:第二部

    本文由CocoaChina翻译小组@TurtleFromMars翻译自raywenderlich,原文:Storyboards Tutorial in Swift: Part 2 更新记录:该Stor ...

  5. 牛客OI赛制测试赛2 C 数组下标

    链接:https://www.nowcoder.com/acm/contest/185/C来源:牛客网 题目描述 给出一个数列 A,求出一个数列B. 其中Bi   表示 数列A中 Ai 右边第一个比 ...

  6. 自定义ngCloak

    场景: 一个非常复杂的表单页面,页面有5个标签,第五个标签中又有5个标签,也就是说一共有9个标签,每个标签中都有一个表单,表单之间相互关联.所有表单项(包括复合的),有80多个数据.全部东西写在一个h ...

  7. ps---打开文件及图片保存格式

    1.打开图片,可以按Ctrl或者Shift来进行多张图片的选择或者用鼠标框选. 2.勾选图像序列,可以选择命名上有次序的多个图像. 3. PSD是ps里面的标准保存格式,包含颜色.图层.通道.路径.动 ...

  8. IDM下载器使用方法详解:百度网盘下载,视频会员一网打尽!

    一. IDM的设置 [01]IDM插件与各大浏览器的集成 默认情况下,在成功安装IDM后,直接点击这里的选项,会弹出[常规设置],一般情况下直接保持默认的配置即可,如果你使用的是比较小众的浏览器,你可 ...

  9. 框架之---Django

    Django是功能最为健全的一个WEB框架,但就因为过于健全,显得过于臃肿.但是Django中最为正要的就是Middleware.ORM和From表单. Django之web本质 Django之初 D ...

  10. LeetCode(67) Add Binary

    题目 Given two binary strings, return their sum (also a binary string). For example, a = "11" ...