范例是对后台Static Blocks 编辑页面增加两个时间字段Start time 和End Time
1.在模块升级文件中添加两个字段到cms/block表
$installer->getConnection()->addColumn($installer->getTable('cms/block'), 'start_time', 'datetime'); $installer->getConnection()->addColumn($installer->getTable('cms/block'), 'end_time', 'datetime'); $installer->endSetup();
2.覆盖后台表单生成类:Mage_Adminhtml_Block_Cms_Block_Edit_Form
重写方法_prepareForm()
在其中添加两个新的字段:
$fieldset->addField('start_time', 'text', array( 'name' => 'start_time', 'label' => Mage::helper('cms')->__('Start Time'), 'title' => Mage::helper('cms')->__('Start Time'), 'required' => false, )); $fieldset->addField('end_time', 'text', array( 'name' => 'end_time', 'label' => Mage::helper('cms')->__('End Time'), 'title' => Mage::helper('cms')->__('End Time'), 'required' => false, ));
在方法最后有个
parent::_prepareForm() 一定要改成:
return Mage_Adminhtml_Block_Widget_Form::_prepareForm();
否则会沿用系统写的block文件
相关推荐
Add Custom Properties to a PropertyGrid.c#属性有用的例子。 http://www.codeproject.com/KB/vb/PropertyGridEx.aspx
Add Python to the search path on Windows
Add 'this' qualifier to unqualified field accesses Change non static accesses to static members using declaring type Change indirect accesses to static members to direct accesses (accesses through ...
VC6 add files to project失效解决方法
asp.net mvc add edit delete asp.net mvc add edit delete asp.net mvc add edit delete
An add-in to automatically increment the PrivateBuild field in your applications resource file.(34KB)
插件名称:Add-nofollow-to-XFN 插件功能:在WordPress后台的"链接" - "添加新链接"中的"链接关系(XFN)"中增加一个"nofollow"选项,安装插件后效果如下: 安装方法: 下载插件压缩包,解压后将 "Add-nofollow-to...
To add or edit a new shotcut, go to /res/xml/shortcuts.xml : Handle Actions To handle shortcuts, just add new constant: private final static String CUSTOM_ACTION = "custom_action"; and check the ...
You will create custom styleable attributes that work with Android XML layouts, learn to process touch events, define custom attributes, and add properties and events to them. By the end of this book...
This demonstrates how to add radio buttons to your menus
matlab功能函数,给直线加上箭头,使之成为矢线,起点[a,b],终点[c,d] 引用格式:add_arrow_to_line(a, c, b, d, color, linewidth, length_arrow) length_arrow指箭头边线长度
Multi-page add/edit/view pages as tabs with page captions Audit Trail Email Notification on Add/Edit/Delete Optional CAPTCHA system File uploading to folder and database Dynamic table loading Server ...
Getting started with a new Single Page Application (SPA) JavaScript framework can be an overwhelming task, but Vue.js makes this daunting task simple and easy to learn, allowing you to start ...
To add a new job login workflow In the Login Setup Folders cabinet, open the Workflows folder. Right-click and choose Add > Job Login Workflow. The Workflow property sheet appears. Enter a Name and ...
经过测试,并在项目中有用过的,页面收藏到桌面的功能 js版本,有例子可测试
MpDS Add-Field可作为[npm软件包](npm i mpds-add-field)提供。 // with npm npm i mpds-add-field 用法 这是一个快速的示例,可以帮助您入门,这就是您所需要的: import * as React from "react" ; import ...
Add a field to UFP VDO 1 and DFP VDO to indicate whether the UFP or DFP is a USB-C receptacle or a USB-C captive cable or fixed plug.
其源代码可在以下位置获得:https://github.com/gregsadetsky/chrome-dont-add-custom-search-engines ====更新于2019年7月22日-支持更多站点(包括DuckDuckGo)-错误修复已更新2018年6月16日-支持更多站点-错误修复...
mp3fILE-EDIT
While writing a dev notes Visual Studio plug in, I wanted the rich edit control in a dialog to understand URL's so developers could add links to sites and email addresses. After talking to "Long John...