- 浏览: 72348 次
- 性别:
- 来自: 上海
最新评论
重载购物车页
Mage_Checkout_CartController::indexAction().
第一步:建立相应的文件
app/code/local/MyNameSpace/MyModule/etc/config.xml
app/code/local/MyNameSpace/MyModule/controllers/Checkout/CartController.php
app/etc/modules/MyNameSpace_All.xml
第二步:编辑刚才新建的配置文件 etc/config.xml
写入如下的内容:
第三步:编辑controllers/Checkout/CartController.php
写入如下:
第四步:编辑模块配置文件 app/etc/modules/MyNameSpace_All.xml
写入:
第五步,编辑app/design/frontend/[myinterface]/[mytheme]/layout/checkout.xml
写入:
Mage_Checkout_CartController::indexAction().
第一步:建立相应的文件
app/code/local/MyNameSpace/MyModule/etc/config.xml
app/code/local/MyNameSpace/MyModule/controllers/Checkout/CartController.php
app/etc/modules/MyNameSpace_All.xml
第二步:编辑刚才新建的配置文件 etc/config.xml
写入如下的内容:
<?xml version="1.0"?> <config> <modules> <MyNameSpace_MyModule> <version>0.1.0</version> </MyNameSpace_MyModule> </modules> <global> <!-- This rewrite rule could be added to the database instead --> <rewrite> <!-- This is an identifier for your rewrite that should be unique --> <!-- THIS IS THE CLASSNAME IN YOUR OWN CONTROLLER --> <mynamespace_mymodule_checkout_cart> <from><![CDATA[#^/checkout/cart/#]]></from> <!-- - mymodule matches the router frontname below - checkout_cart matches the path to your controller Considering the router below, "/mymodule/checkout_cart/" will be "translated" to "/MyNameSpace/MyModule/controllers/Checkout/CartController.php" (?) --> <to>/mymodule/checkout_cart/</to> </mynamespace_mymodule_checkout_cart> </rewrite> </global> <!-- If you want to overload an admin-controller this tag should be <admin> instead, or <adminhtml> if youre overloading such stuff (?) --> <frontend> <routers> <mynamespace_mymodule> <!-- should be set to "admin" when overloading admin stuff (?) --> <use>standard</use> <args> <module>MyNameSpace_MyModule</module> <!-- This is used when "catching" the rewrite above --> <frontName>mymodule</frontName> </args> </mynamespace_mymodule> </routers> </frontend> </config>
第三步:编辑controllers/Checkout/CartController.php
写入如下:
<?php # Controllers are not autoloaded so we will have to do it manually: //require_once 'Mage/Checkout/controllers/CartController.php'; //don’t break the magento compiler functionality and magento can find your class from compiled folder,better require_once Mage::getModuleDir('controllers','Mage_Checkout').DS.'CartController.php'; class MyNameSpace_MyModule_Checkout_CartController extends Mage_Checkout_CartController { # Overloaded indexAction public function indexAction() { # Just to make sure error_log('Yes, I did it!'); parent::indexAction(); } }
第四步:编辑模块配置文件 app/etc/modules/MyNameSpace_All.xml
写入:
<?xml version="1.0"?> <config> <modules> <MyNameSpace_MyModule> <active>true</active> <codePool>local</codePool> </MyNameSpace_MyModule> </modules> </config>
第五步,编辑app/design/frontend/[myinterface]/[mytheme]/layout/checkout.xml
写入:
<mynamespace_mymodule_checkout_cart_index> <update handle="checkout_cart_index"/> </mynamespace_mymodule_checkout_cart_index>
发表评论
-
Magento随机生成sales rule的coupon code
2013-01-02 22:09 2243在Magento中可以使用SalesRule模块下的Mage_ ... -
Magento 后台配置中实现日期选择 (Date picker)
2012-12-28 15:07 2477首先,创建一个新的Form Field 类: <?p ... -
获得指定customer 购买的产品数据
2011-12-10 20:54 1324获得指定customer 购买的产品信息,如果是configu ... -
将缺货产品放在产品列表后面
2011-12-10 20:50 1375Rewrite Mage_Catalog_Model_Laye ... -
Mac Lion上安装配置Nginx PHP PHP-FPM
2011-12-10 16:01 8005<!--?xml version="1.0&q ... -
How to customize Magento as CMS system (1.5.0 CE)
2011-03-06 22:42 1036Before install: 1. Go to app/et ... -
How to redirect to another url in block or template
2011-02-25 13:47 1105In Block class: public funct ... -
Use call back function to proccess Magento large collection
2011-01-19 12:58 927$orders = Mage::getModel('sal ... -
How to remove unnecessary columns in Magento collection
2011-01-19 12:56 1099$orders = Mage::getModel('sal ... -
How to calculate currency according to reward points rate in Magento
2011-01-13 18:03 1302$rate = Mage::getModel('enter ... -
Magento二次开发的利器:Rewrite
2010-12-08 17:15 2715Magento是一个十分优秀的电子商务系统,但是有时候我们需要 ... -
增加Magento后台管理功能三:在后台设置(System/Configuration)中加入自定义设置
2010-11-30 16:17 1957在模块的etc目录下新建system.xml配置文件,内容如下 ... -
增加Magento后台管理功能二:开发后台Controller
2010-11-30 16:02 2694在模块的controllers目录下创建Adminhtml目录 ... -
增加Magento后台管理功能一:在后台管理界面加入菜单
2010-11-30 15:47 4504在模块的etc目录下增加adminhtml.xml配置文件,用 ... -
Magento在CMS Page中增加用户信息变量
2010-11-26 10:14 2810Magento的cms页面和static block页面中可以 ... -
Magento根据不同的浏览器自动切换package或 theme
2010-11-26 10:05 2037在后台设置中: System > Configurat ... -
Magento让后台数据列表中的action列链接在新窗口打开
2010-11-08 16:56 1138'actions' => array( ... -
Maegen获得后台当前用户的信息
2010-11-08 16:53 850$admin = Mage::getSingleton(' ... -
Magento中用子类替换Block
2010-10-15 10:47 1828Step 1:创建一个新的Module Step 2: 编辑模 ... -
Magento中添加带有选项的属性
2010-10-14 14:49 1430下面的代码为Customer实体添加了性别属性,有两个可选值 ...
相关推荐
magento 常用的方法 与 总结, 对于起步学习magento 的非常有帮助
magento的SMTP插件magento的SMTP插件magento的SMTP插件
magento数据结构分析 magento数据字典
NULL 博文链接:https://hudeyong926.iteye.com/blog/1416591
magik shoes magento 模板, magento 1.7 模板
magento1.9 邮件发送失败解决方法,附带视频教程和图片,文字和修改好的文件,只测试过1.9版本. 其他版本没遇到这个问题
magento csv多图批量导入 解决方法
深入理解Magento 由精东博客下载下来制作成pdf
Magento插件开发手册 Magento Extension Developers Guide
Athlete Magento主题,兼容Magento 1.9.x, 1.8.x, 1.7.x ,特点:完全自适应(响应式布局),自定义子主题,无限颜色,完全自定义,一键安装演示,小工具化横幅系统,颜色选择,MEGA菜单,多商店支持,自定义产品...
magento2 developers cookbook, magento 开发手册,magento教程
Magento Magento商城 Magento目录结构
Magento 2 Beginners Guide by Gabriel Guarino English | 14 Mar. 2017 | ASIN: B01MS81BQX | 442 Pages | AZW3 | 31.84 MB Key Features Set up and manage your very first online store with a friendly and ...
主要包括的内容有:magento的常用设置、Magento模板制作教程、Magento商城_目录结构说明、Magento中文教程实用文档、常用的xml的文件的作用以及自定义模块的应用
快速在服务器上复制为另一个站,版本用的是magento,php语言
Magento 的配置系统就像是 Magento 的心脏,支撑着 Magento 的运行。这套 配置系统掌管着几乎所有“module/model/class /template/etc”。它把整个 Magento 系统抽象出来,用一个配置文件来描述。这里的“配置文件”...
[Packt Publishing] Magento 扩展开发入门教程 (英文版) [Packt Publishing] Getting Started with Magento Extension Development (E-Book) ☆ 图书概要:☆ Understand Magento extensions, and build your own...