How To Add Custom Field in Report ->Sales->Sales->Order Form In Magento -


i want add new field in report->sales->sales->order->form

enter image description here

from screenshot, understand want "add new field - order date similar date field"

steps achieve that:

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

  1. 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         )); 
  1. 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; } 
  1. 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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -