/** * */ public function viewInvoiceAction() { $invoiceId = (int) $this->getRequest()->getParam('invoice_id'); if (!$invoiceId) { return parent::invoiceAction(); } $invoice = Mage::getModel('sales/order_invoice')->load($invoiceId); $order = $invoice->getOrder(); if ($this->_canViewOrder($order)) { Mage::register('current_order', $order); if (isset($invoice)) { Mage::register('current_invoice', $invoice); } $this->loadLayout(); $this->_initLayoutMessages('catalog/session'); $navigationBlock = $this->getLayout()->getBlock('customer_account_navigation'); if ($navigationBlock) { $navigationBlock->setActive('sales/order/invoices'); } $this->renderLayout(); } else { if (Mage::getSingleton('customer/session')->isLoggedIn()) { $this->_redirect('*/*/history'); } else { $this->_redirect('sales/guest/form'); } } }
protected function _canViewOrder($order) { if (Mage::helper('orderspro')->isHideDeletedOrdersForCustomers()) { if ($order->getOrderGroupId() == 2) { return false; } } return parent::_canViewOrder($order); }