Mage_Adminhtml_Block_Sales_Order_Grid Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Sales_Order_Grid:

Mage_Adminhtml_Block_Widget_Grid Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getRowUrl ($row)
 getGridUrl ()

Protected Member Functions

 _prepareCollection ()
 _prepareColumns ()
 _prepareMassaction ()


Detailed Description

Definition at line 34 of file Grid.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Varien_Object.

Definition at line 37 of file Grid.php.

00038     {
00039         parent::__construct();
00040         $this->setId('sales_order_grid');
00041         $this->setUseAjax(true);
00042         $this->setDefaultSort('created_at');
00043         $this->setDefaultDir('DESC');
00044         $this->setSaveParametersInSession(true);
00045     }


Member Function Documentation

_prepareCollection (  )  [protected]

Prepare grid collection object

Returns:
this

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 47 of file Grid.php.

00048     {
00049         //TODO: add full name logic
00050         $collection = Mage::getResourceModel('sales/order_collection')
00051             ->addAttributeToSelect('*')
00052             ->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left')
00053             ->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left')
00054             ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')
00055             ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')
00056             ->addExpressionAttributeToSelect('billing_name',
00057                 'CONCAT({{billing_firstname}}, " ", {{billing_lastname}})',
00058                 array('billing_firstname', 'billing_lastname'))
00059             ->addExpressionAttributeToSelect('shipping_name',
00060                 'CONCAT({{shipping_firstname}}, " ", {{shipping_lastname}})',
00061                 array('shipping_firstname', 'shipping_lastname'));
00062         $this->setCollection($collection);
00063         return parent::_prepareCollection();
00064     }

_prepareColumns (  )  [protected]

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 66 of file Grid.php.

00067     {
00068 
00069         $this->addColumn('real_order_id', array(
00070             'header'=> Mage::helper('sales')->__('Order #'),
00071             'width' => '80px',
00072             'type'  => 'text',
00073             'index' => 'increment_id',
00074         ));
00075 
00076         if (!Mage::app()->isSingleStoreMode()) {
00077             $this->addColumn('store_id', array(
00078                 'header'    => Mage::helper('sales')->__('Purchased from (store)'),
00079                 'index'     => 'store_id',
00080                 'type'      => 'store',
00081                 'store_view'=> true,
00082                 'display_deleted' => true,
00083             ));
00084         }
00085 
00086         $this->addColumn('created_at', array(
00087             'header' => Mage::helper('sales')->__('Purchased On'),
00088             'index' => 'created_at',
00089             'type' => 'datetime',
00090             'width' => '100px',
00091         ));
00092 
00093         /*$this->addColumn('billing_firstname', array(
00094             'header' => Mage::helper('sales')->__('Bill to First name'),
00095             'index' => 'billing_firstname',
00096         ));
00097 
00098         $this->addColumn('billing_lastname', array(
00099             'header' => Mage::helper('sales')->__('Bill to Last name'),
00100             'index' => 'billing_lastname',
00101         ));*/
00102         $this->addColumn('billing_name', array(
00103             'header' => Mage::helper('sales')->__('Bill to Name'),
00104             'index' => 'billing_name',
00105         ));
00106 
00107         /*$this->addColumn('shipping_firstname', array(
00108             'header' => Mage::helper('sales')->__('Ship to First name'),
00109             'index' => 'shipping_firstname',
00110         ));
00111 
00112         $this->addColumn('shipping_lastname', array(
00113             'header' => Mage::helper('sales')->__('Ship to Last name'),
00114             'index' => 'shipping_lastname',
00115         ));*/
00116         $this->addColumn('shipping_name', array(
00117             'header' => Mage::helper('sales')->__('Ship to Name'),
00118             'index' => 'shipping_name',
00119         ));
00120 
00121         $this->addColumn('base_grand_total', array(
00122             'header' => Mage::helper('sales')->__('G.T. (Base)'),
00123             'index' => 'base_grand_total',
00124             'type'  => 'currency',
00125             'currency' => 'base_currency_code',
00126         ));
00127 
00128         $this->addColumn('grand_total', array(
00129             'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
00130             'index' => 'grand_total',
00131             'type'  => 'currency',
00132             'currency' => 'order_currency_code',
00133         ));
00134 
00135         $this->addColumn('status', array(
00136             'header' => Mage::helper('sales')->__('Status'),
00137             'index' => 'status',
00138             'type'  => 'options',
00139             'width' => '70px',
00140             'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
00141         ));
00142 
00143         if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
00144             $this->addColumn('action',
00145                 array(
00146                     'header'    => Mage::helper('sales')->__('Action'),
00147                     'width'     => '50px',
00148                     'type'      => 'action',
00149                     'getter'     => 'getId',
00150                     'actions'   => array(
00151                         array(
00152                             'caption' => Mage::helper('sales')->__('View'),
00153                             'url'     => array('base'=>'*/*/view'),
00154                             'field'   => 'order_id'
00155                         )
00156                     ),
00157                     'filter'    => false,
00158                     'sortable'  => false,
00159                     'index'     => 'stores',
00160                     'is_system' => true,
00161             ));
00162         }
00163         $this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
00164 
00165         return parent::_prepareColumns();
00166     }

_prepareMassaction (  )  [protected]

Prepare grid massaction actions

Returns:
Mage_Adminhtml_Block_Widget_Grid

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 168 of file Grid.php.

00169     {
00170         $this->setMassactionIdField('entity_id');
00171         $this->getMassactionBlock()->setFormFieldName('order_ids');
00172 
00173         $this->getMassactionBlock()->addItem('cancel_order', array(
00174              'label'=> Mage::helper('sales')->__('Cancel'),
00175              'url'  => $this->getUrl('*/*/massCancel'),
00176         ));
00177 
00178         $this->getMassactionBlock()->addItem('hold_order', array(
00179              'label'=> Mage::helper('sales')->__('Hold'),
00180              'url'  => $this->getUrl('*/*/massHold'),
00181         ));
00182 
00183         $this->getMassactionBlock()->addItem('unhold_order', array(
00184              'label'=> Mage::helper('sales')->__('Unhold'),
00185              'url'  => $this->getUrl('*/*/massUnhold'),
00186         ));
00187 
00188         $this->getMassactionBlock()->addItem('pdfinvoices_order', array(
00189              'label'=> Mage::helper('sales')->__('Print Invoices'),
00190              'url'  => $this->getUrl('*/*/pdfinvoices'),
00191         ));
00192 
00193         $this->getMassactionBlock()->addItem('pdfshipments_order', array(
00194              'label'=> Mage::helper('sales')->__('Print Packingslips'),
00195              'url'  => $this->getUrl('*/*/pdfshipments'),
00196         ));
00197 
00198         $this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
00199              'label'=> Mage::helper('sales')->__('Print Credit Memos'),
00200              'url'  => $this->getUrl('*/*/pdfcreditmemos'),
00201         ));
00202 
00203         $this->getMassactionBlock()->addItem('pdfdocs_order', array(
00204              'label'=> Mage::helper('sales')->__('Print All'),
00205              'url'  => $this->getUrl('*/*/pdfdocs'),
00206         ));
00207 
00208 //        $statuses = Mage::getSingleton('sales/order_config')->getStatuses();
00209 //        array_unshift($statuses, array('value'=>'', 'label'=>''));
00210 //        $this->getMassactionBlock()->addItem('change_status', array(
00211 //             'label'=> Mage::helper('sales')->__('Change Status'),
00212 //             'url'  => $this->getUrl('*/*/massStatus'),
00213 //             'additional' => array(
00214 //                    'visibility' => array(
00215 //                             'name' => 'status',
00216 //                             'type' => 'select',
00217 //                             'class' => 'required-entry',
00218 //                             'label' => Mage::helper('sales')->__('New Status'),
00219 //                             'values' => $statuses
00220 //                         )
00221 //             )
00222 //        ));
00223 
00224 //        $prints = array(
00225 //            'empty'     => array('value'=>'', 'label'=>''),
00226 //            'order'    => Mage::helper('sales')->__('Orders'),
00227 //            'invoice'  => Mage::helper('sales')->__('Invoices'),
00228 //            'shipment' => Mage::helper('sales')->__('Shipments'),
00229 //        );
00230 //        $this->getMassactionBlock()->addItem('print', array(
00231 //             'label'=> Mage::helper('sales')->__('Print'),
00232 //             'url'  => $this->getUrl('*/*/massPrint'),
00233 //             'additional' => array(
00234 //                    'visibility' => array(
00235 //                             'name' => 'document',
00236 //                             'type' => 'select',
00237 //                             'class' => 'required-entry',
00238 //                             'label' => Mage::helper('sales')->__('Document'),
00239 //                             'values' => $prints
00240 //                         )
00241 //             )
00242 //        ));
00243 
00244         return $this;
00245     }

getGridUrl (  ) 

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 255 of file Grid.php.

00256     {
00257         return $this->getUrl('*/*/grid', array('_current'=>true));
00258     }

getRowUrl ( row  ) 

Definition at line 247 of file Grid.php.

00248     {
00249         if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
00250             return $this->getUrl('*/*/view', array('order_id' => $row->getId()));
00251         }
00252         return false;
00253     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:00 2009 for Magento by  doxygen 1.5.8