How To Add Custom Field in Report ->Sales->Sales->Order Form In Magento -
from screenshot, understand want "add new field - order date similar date field"
steps achieve that:
- override file app/code/core/mage/sales/block/adminhtml/report/filter/form/order.php
by override, mean create custom module under /app/code/local/namespace/module
- after line no: 56 add below code block:
$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 ));
- so function below:
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; }
- in case, not want make required field, make sure have done this:
'required' => false //instead of true
find screenshot here: order date new field added
currently, have given "name" => "order_date", might need filter collection show reports appropriately.
let me know if helps.
happy coding...
Comments
Post a Comment