Mage_Adminhtml_Block_Customer_Edit_Tab_View_Orders Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Customer_Edit_Tab_View_Orders:

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)
 getHeadersVisibility ()

Protected Member Functions

 _preparePage ()
 _prepareCollection ()
 _prepareColumns ()


Detailed Description

Definition at line 34 of file Orders.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 Orders.php.

00038     {
00039         parent::__construct();
00040         $this->setId('customer_view_orders_grid');
00041         $this->setDefaultSort('created_at', 'desc');
00042         $this->setSortable(false);
00043         $this->setPagerVisibility(false);
00044         $this->setFilterVisibility(false);
00045     }


Member Function Documentation

_prepareCollection (  )  [protected]

Prepare grid collection object

Returns:
this

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 54 of file Orders.php.

00055     {
00056         //TODO: add full name logic
00057         $collection = Mage::getResourceModel('sales/order_collection')
00058             ->addAttributeToSelect('increment_id')
00059             ->addAttributeToSelect('created_at')
00060             ->addAttributeToSelect('grand_total')
00061             ->addAttributeToSelect('order_currency_code')
00062             ->addAttributeToSelect('store_id')
00063             ->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left')
00064             ->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left')
00065             ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')
00066             ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')
00067             ->addExpressionAttributeToSelect('billing_name',
00068                 'CONCAT({{billing_firstname}}, " ", {{billing_lastname}})',
00069                 array('billing_firstname', 'billing_lastname'))
00070             ->addExpressionAttributeToSelect('shipping_name',
00071                 'CONCAT({{shipping_firstname}}, " ", {{shipping_lastname}})',
00072                 array('shipping_firstname', 'shipping_lastname'))
00073             ->addAttributeToFilter('customer_id', Mage::registry('current_customer')->getId());
00074         $this->setCollection($collection);
00075         return parent::_prepareCollection();
00076     }

_prepareColumns (  )  [protected]

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 78 of file Orders.php.

00079     {
00080 
00081         $this->addColumn('increment_id', array(
00082             'header'    => Mage::helper('customer')->__('Order #'),
00083             'align'     => 'center',
00084             'index'     => 'increment_id',
00085             'width'     => '100px',
00086         ));
00087 
00088         $this->addColumn('created_at', array(
00089             'header'    => Mage::helper('customer')->__('Purchased at'),
00090             'index'     => 'created_at',
00091             'type'      => 'datetime',
00092         ));
00093 
00094         $this->addColumn('billing_name', array(
00095             'header'    => Mage::helper('customer')->__('Bill to Name'),
00096             'index'     => 'billing_name',
00097         ));
00098 
00099         $this->addColumn('shipping_name', array(
00100             'header'    => Mage::helper('customer')->__('Shipped to Name'),
00101             'index'     => 'shipping_name',
00102         ));
00103 
00104         $this->addColumn('grand_total', array(
00105             'header'    => Mage::helper('customer')->__('Grand Total'),
00106             'index'     => 'grand_total',
00107             'type'      => 'currency',
00108             'currency'  => 'order_currency_code',
00109         ));
00110 
00111         if (!Mage::app()->isSingleStoreMode()) {
00112             $this->addColumn('store_id', array(
00113                 'header'    => Mage::helper('customer')->__('Bought From'),
00114                 'index'     => 'store_id',
00115                 'type'      => 'store',
00116                 'store_view' => true,
00117             ));
00118         }
00119 
00120         $this->addColumn('action', array(
00121             'header'    =>  ' ',
00122             'filter'    =>  false,
00123             'sortable'  =>  false,
00124             'width'     => '100px',
00125             'renderer'  =>  'adminhtml/sales_reorder_renderer_action'
00126         ));
00127 
00128         return parent::_prepareColumns();
00129     }

_preparePage (  )  [protected]

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 47 of file Orders.php.

00048     {
00049         $this->getCollection()
00050             ->setPageSize(5)
00051             ->setCurPage(1);
00052     }

getHeadersVisibility (  ) 

Return visibility of column headers

Returns:
boolean

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 136 of file Orders.php.

00137     {
00138         return ($this->getCollection()->getSize() > 0);
00139     }

getRowUrl ( row  ) 

Definition at line 131 of file Orders.php.

00132     {
00133         return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
00134     }


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

Generated on Sat Jul 4 17:22:48 2009 for Magento by  doxygen 1.5.8