setId('recurring_profile_orders') ->setUseAjax(true) ->setSkipGenerateContent(true) ; } /** * Prepare grid collection object * * @return Mage_Sales_Block_Adminhtml_Recurring_Profile_View_Tab_Orders */ protected function _prepareCollection() { $collection = Mage::getResourceModel('sales/order_grid_collection') ->addRecurringProfilesFilter(Mage::registry('current_recurring_profile')->getId()) ; $this->setCollection($collection); return parent::_prepareCollection(); } /** * Prepare grid columns * * TODO: fix up this mess * * @return Mage_Sales_Block_Adminhtml_Recurring_Profile_View_Tab_Orders */ protected function _prepareColumns() { $this->addColumn('real_order_id', array( 'header'=> Mage::helper('sales')->__('Order #'), 'width' => '80px', 'type' => 'text', 'index' => 'increment_id', )); if (!Mage::app()->isSingleStoreMode()) { $this->addColumn('store_id', array( 'header' => Mage::helper('sales')->__('Purchased From (Store)'), 'index' => 'store_id', 'type' => 'store', 'store_view'=> true, 'display_deleted' => true, )); } $this->addColumn('created_at', array( 'header' => Mage::helper('sales')->__('Purchased On'), 'index' => 'created_at', 'type' => 'datetime', 'width' => '100px', )); $this->addColumn('billing_name', array( 'header' => Mage::helper('sales')->__('Bill to Name'), 'index' => 'billing_name', )); $this->addColumn('shipping_name', array( 'header' => Mage::helper('sales')->__('Ship to Name'), 'index' => 'shipping_name', )); $this->addColumn('base_grand_total', array( 'header' => Mage::helper('sales')->__('G.T. (Base)'), 'index' => 'base_grand_total', 'type' => 'currency', 'currency' => 'base_currency_code', )); $this->addColumn('grand_total', array( 'header' => Mage::helper('sales')->__('G.T. (Purchased)'), 'index' => 'grand_total', 'type' => 'currency', 'currency' => 'order_currency_code', )); $this->addColumn('status', array( 'header' => Mage::helper('sales')->__('Status'), 'index' => 'status', 'type' => 'options', 'width' => '70px', 'options' => Mage::getSingleton('sales/order_config')->getStatuses(), )); if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) { $this->addColumn('action', array( 'header' => Mage::helper('sales')->__('Action'), 'width' => '50px', 'type' => 'action', 'getter' => 'getId', 'actions' => array( array( 'caption' => Mage::helper('sales')->__('View'), 'url' => array('base'=>'*/sales_order/view'), 'field' => 'order_id' ) ), 'filter' => false, 'sortable' => false, 'index' => 'stores', 'is_system' => true, )); } return parent::_prepareColumns(); } /** * Return row url for js event handlers * * @param Varien_Object * @return string */ public function getRowUrl($row) { return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId())); } /** * Url for ajax grid submission * * @return string */ public function getGridUrl() { return $this->getTabUrl(); } /** * Url for ajax tab * * @return string */ public function getTabUrl() { return $this->getUrl('*/*/orders', array('profile' => Mage::registry('current_recurring_profile')->getId())); } /** * Class for ajax tab * * @return string */ public function getTabClass() { return 'ajax'; } /** * Label getter * * @return string */ public function getTabLabel() { return Mage::helper('sales')->__('Related Orders'); } /** * Same as label getter * * @return string */ public function getTabTitle() { return $this->getTabLabel(); } /** * @return bool */ public function canShowTab() { return true; } /** * @return bool */ public function isHidden() { return false; } }