答案 0 :(得分:0)
从截图中,我了解到您要“添加新字段 - 与日期字段类似的订购日期”
实现这一目标的步骤:
- 覆盖文件app / code / core / Mage / Sales / Block / Adminhtml / Report / Filter / Form / Order.php
醇>
通过覆盖,我的意思是在/ app / code / local / Namespace / Module
下创建自定义模块
- 在第56行之后添加以下代码块:
醇>
$fieldset->addField('order_date', 'date', array(
'name' => 'order_date',
'format' => $dateFormatIso,
'image' => $this->getSkinUrl('images/grid-cal.gif'),
'label' => Mage::helper('reports')->__('Order Date'),
'title' => Mage::helper('reports')->__('Order Date'),
'required' => true
));
- 所以你的功能如下所示:
醇>
protected function _prepareForm()
{
parent::_prepareForm();
$form = $this->getForm();
$htmlIdPrefix = $form->getHtmlIdPrefix();
/** @var Varien_Data_Form_Element_Fieldset $fieldset */
$fieldset = $this->getForm()->getElement('base_fieldset');
$dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
if (is_object($fieldset) && $fieldset instanceof Varien_Data_Form_Element_Fieldset) {
$fieldset->addField('show_actual_columns', 'select', array(
'name' => 'show_actual_columns',
'options' => array(
'1' => Mage::helper('reports')->__('Yes'),
'0' => Mage::helper('reports')->__('No')
),
'label' => Mage::helper('reports')->__('Show Actual Values'),
));
$fieldset->addField('order_date', 'date', array(
'name' => 'order_date',
'format' => $dateFormatIso,
'image' => $this->getSkinUrl('images/grid-cal.gif'),
'label' => Mage::helper('reports')->__('Order Date'),
'title' => Mage::helper('reports')->__('Order Date'),
'required' => true
));
}
return $this;
}
- 如果您不想将其设为必填字段,请确保您已完成此操作:
醇>
'required' => false //instead of true
在此处找到屏幕截图:Order Date New Field Added
目前,我已经给出了“name”=> “order_date”,你可能需要将集合过滤到适当的SHOW REPORTS。
如果有帮助,请告诉我。
快乐编码......