Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9036767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:04:54+00:00 2026-06-16T09:04:54+00:00

We have modified Magento’s history.phtml to show all orders, without any limitation for a

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T09:04:55+00:00Added an answer on June 16, 2026 at 9:04 am

    I’ve decided to use the quick way after all. I’ve overridden the Mage_Sales_OrderController:

    <?php
    require_once Mage::getModuleDir('controllers', 'Mage_Sales') . DS . 'OrderController.php';
    class MyCompany_MyModule_OrderController extends Mage_Sales_OrderController
    {   
        /**
         * Check order view availability
         * Overridden from Mage_Sales_Controller_Abstract to
         * remove the customer restriction. We want to show all
         * orders to all customers on any time. 
         * 
         * TODO: Maybe in the future add a customer group restriction
         *
         * @param   Mage_Sales_Model_Order $order
         * @return  bool
         */
        protected function _canViewOrder($order)
        {
            $availableStates = Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates();
            if ($order->getId() && in_array($order->getState(), $availableStates, $strict = true)) {
                return true;
            }
    
            return false;
        }
    }
    

    In my config.xml I’m telling Magento to use my controller first and use the OrderController as back-up. As I’ve only overridden one function, all the existing code will not be touched.

    <?xml version="1.0"?>    
    ...
    
    <frontend>
    ...
        <routers>
    ...
            <sales>
                <args>
                    <modules>
                        <MyCompany_MyModule before="Mage_Sales_OrderController">MyCompany_MyModule_Sales</MyCompany_MyModule>
                    </modules>
                </args>
            </sales>
        </routers>
    ...
    </frontend>
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have modified this example from the SDK pages to grab all the Contact
I am using Magento eCommerce and I have modified my header.phtml via the Blank
I have modified a website with a redirection to a single page: RewriteCond %{REQUEST_FILENAME}
I have added a Bundled Product in Magento programmatically, using all the options /
I have modified http://fivefilters.org/term-extraction/ this project so that: Given input (https://gist.github.com/4426264) of text the
I have modified the tpl used for the grid view to show 3 columns
I have modified my project into a one page website type. Part of the
I have modified this countdown script to countdown to 4:20pm everyday. I have attempted
I have modified the code in this question ,according to the answers there, in
I have modified in a general way all the select of a stylesheet, doing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.