`
kirenenko04
  • 浏览: 152331 次
  • 性别: Icon_minigender_2
  • 来自: 上海
社区版块
存档分类
最新评论

Add Custom Field to Static Block Edit Page

 
阅读更多

范例是对后台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

    Add Custom Properties to a PropertyGrid.c#属性有用的例子。 http://www.codeproject.com/KB/vb/PropertyGridEx.aspx

    eclipse 格式化模板

    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 ...

    An add-in to automatically increment the PrivateBuild field

    An add-in to automatically increment the PrivateBuild field in your applications resource file.(34KB)

    VC6_add files to project失效解决方法

    在使用Microsoft Visual C++ 6.0(简称VC6)进行C++开发时,有时会遇到"Add Files to Project"功能失效的问题,这使得无法通过菜单项将新文件添加到项目中,对开发流程造成不便。本文将详细介绍如何解决这个问题,并...

    Android代码-AndroidShortcuts

    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 ...

    add_block simulink 脚本:使用 simulink 脚本学习 add_block 非常简单。-matlab开发

    在MATLAB开发过程中,我们经常会用到Simulink脚本来自动化模型的构建过程,比如添加模块(add_block)。这个标题和描述指出,我们将讨论如何通过Simulink脚本来实现`add_block`功能,以便更高效地进行模型构建。 首先...

    Building.Android.UIs.with.Custom.Views

    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...

    phpmaker610官方安装版

    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 to Know Vue.js Learn to Build Single Page

    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 ...

    mpds-add-field

    MpDS Add-Field可作为[npm软件包](npm i mpds-add-field)提供。 // with npm npm i mpds-add-field 用法 这是一个快速的示例,可以帮助您入门,这就是您所需要的: import * as React from "react" ; import ...

    不要添加自定义搜索引擎「Don't add custom search engines」-crx插件

    其源代码可在以下位置获得:https://github.com/gregsadetsky/chrome-dont-add-custom-search-engines ====更新于2019年7月22日-支持更多站点(包括DuckDuckGo)-错误修复已更新2018年6月16日-支持更多站点-错误修复...

    Replacing "RICHEDIT" control with "RichEdit20A"

    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...

    Getting to Know Vue js

    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 ...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - FIX Add moving block for first and last connector's segments also for non-orthogonal connectors. - FIX Class TPenProp rewrote without TPen delphi object. - FIX In some cases TFlexCurve.Paint ...

    ios-把block当成属性放在全局字典中的用例.zip

    class_addMethod(self.class, setterSel, imp_implementationWithBlock(block), "@@:"); } self.sharedBlock = block; } @end ``` 最后,为了实现单例字典,我们可以遵循典型的单例模式: ```objc + ...

    USB PD R3.0 V2.0 ECN - Add Connector Type to ID Header VDO

    Add a field to the ID Header VDO to indicate whether the connector is a USB-C receptacle or a USB-C plug. SOP products (UFP or DFP) may choose either USB Type-C Receptacle or USB Type-C Plug options ...

    block的简单使用

    int (^addBlock)(int, int) = ^(int a, int b) { return a + b; }; int result = addBlock(3, 5); // result = 8 ``` 2. 作为方法参数:许多API中,Block常作为参数用于处理异步任务的回调,例如网络请求、图片...

    Add Save to Workspace Block To Signal & Scope Manager:Add Save-to-Workspace Block to Signal and Scope Manager-matlab开发

    此示例基于有关如何将自定义模块添加到 Simulink Signal and Scope Manager 的 Simulink 帮助文件。 这是一种非常巧妙的方法,可以减少向模型添加保存到工作区模块并利用 Simulink 的强大功能。

    How to build a custom control in WPF

    - **丰富内容(Rich Content)**:在传统的Win32应用程序中,只有RichEdit控件可以支持富文本格式化。而WPF中的大多数控件都支持文本样式和格式化,这极大地提高了控件的功能性和美观性。 - **简单的编程模型**:WPF...

Global site tag (gtag.js) - Google Analytics