00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 class Mage_Adminhtml_Block_Sales_Shipment_Grid extends Mage_Adminhtml_Block_Widget_Grid
00033 {
00034
00035 public function __construct()
00036 {
00037 parent::__construct();
00038 $this->setId('sales_shipment_grid');
00039 $this->setDefaultSort('created_at');
00040 $this->setDefaultDir('DESC');
00041 }
00042
00043 protected function _prepareCollection()
00044 {
00045
00046 $collection = Mage::getResourceModel('sales/order_shipment_collection')
00047 ->addAttributeToSelect('increment_id')
00048 ->addAttributeToSelect('created_at')
00049 ->addAttributeToSelect('total_qty')
00050 ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')
00051 ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')
00052 ->joinAttribute('order_increment_id', 'order/increment_id', 'order_id', null, 'left')
00053 ->joinAttribute('order_created_at', 'order/created_at', 'order_id', null, 'left')
00054 ;
00055 $this->setCollection($collection);
00056 return parent::_prepareCollection();
00057 }
00058
00059 protected function _prepareColumns()
00060 {
00061 $this->addColumn('increment_id', array(
00062 'header' => Mage::helper('sales')->__('Shipment #'),
00063 'index' => 'increment_id',
00064 'type' => 'number',
00065 ));
00066
00067 $this->addColumn('created_at', array(
00068 'header' => Mage::helper('sales')->__('Date Shipped'),
00069 'index' => 'created_at',
00070 'type' => 'datetime',
00071 ));
00072
00073 $this->addColumn('order_increment_id', array(
00074 'header' => Mage::helper('sales')->__('Order #'),
00075 'index' => 'order_increment_id',
00076 'type' => 'number',
00077 ));
00078
00079 $this->addColumn('order_created_at', array(
00080 'header' => Mage::helper('sales')->__('Order Date'),
00081 'index' => 'order_created_at',
00082 'type' => 'datetime',
00083 ));
00084
00085 $this->addColumn('shipping_firstname', array(
00086 'header' => Mage::helper('sales')->__('Ship to First name'),
00087 'index' => 'shipping_firstname',
00088 ));
00089
00090 $this->addColumn('shipping_lastname', array(
00091 'header' => Mage::helper('sales')->__('Ship to Last name'),
00092 'index' => 'shipping_lastname',
00093 ));
00094
00095 $this->addColumn('total_qty', array(
00096 'header' => Mage::helper('sales')->__('Total Qty'),
00097 'index' => 'total_qty',
00098 'type' => 'number',
00099 ));
00100
00101 $this->addColumn('action',
00102 array(
00103 'header' => Mage::helper('sales')->__('Action'),
00104 'width' => '50px',
00105 'type' => 'action',
00106 'getter' => 'getId',
00107 'actions' => array(
00108 array(
00109 'caption' => Mage::helper('sales')->__('View'),
00110 'url' => array('base'=>'*/*/view'),
00111 'field' => 'shipment_id'
00112 )
00113 ),
00114 'filter' => false,
00115 'sortable' => false,
00116 'is_system' => true
00117 ));
00118
00119 return parent::_prepareColumns();
00120 }
00121
00122 public function getRowUrl($row)
00123 {
00124 return $this->getUrl('*/*/view',
00125 array(
00126 'shipment_id'=> $row->getId(),
00127 )
00128 );
00129 }
00130
00131 protected function _prepareMassaction()
00132 {
00133 $this->setMassactionIdField('entity_id');
00134 $this->getMassactionBlock()->setFormFieldName('shipment_ids');
00135
00136 $this->getMassactionBlock()->addItem('pdfshipments_order', array(
00137 'label'=> Mage::helper('sales')->__('PDF Packingslips'),
00138 'url' => $this->getUrl('*/*/pdfshipments'),
00139 ));
00140
00141 return $this;
00142 }
00143
00144 public function getGridUrl()
00145 {
00146 return $this->getUrl('*/*/*', array('_current' => true));
00147 }
00148
00149 }