We have modified Magento’s history.phtml to show all orders, without any limitation for a restricted website. This is working, but we ran into a problem when we are trying to print or view an order. I’ve debugged and the problem lays with Magento’s _canViewOrder (located in Mage_Sales_Controller_Abstract). In that function, an extra and ofcourse logical check is implemented to check if the user that is logged in can view/print the order that is requested:
if ($order->getId() && $order->getCustomerId() && ($order->getCustomerId() == $customerId)
&& in_array($order->getState(), $availableStates, $strict = true)
As we have some custom development here, we need to override this method to remove the restriction. Unfortunately We can’t find anywhere how to override a Controller class.
Please note we do know how to override routers/controllers, but this one is located in the Controller folder and is an abstract class.
Can anyone point me in the right direction or provide me with a sample config.xml to override this class?
I’ve decided to use the quick way after all. I’ve overridden the
Mage_Sales_OrderController:In my config.xml I’m telling Magento to use my controller first and use the
OrderControlleras back-up. As I’ve only overridden one function, all the existing code will not be touched.