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

  • Home
  • SEARCH
  • 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 6475947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:45:57+00:00 2026-05-25T06:45:57+00:00

I have created a custom Magento module which extends the core sales order functionality

  • 0

I have created a custom Magento module which extends the core sales order functionality with some custom user input. After an order has been placed I would like to display this data in a custom tab on the order detail page of the admin area. I have managed to get the new tab displaying in the tab list however when I click on the tab it gives me a 404.

Here’s my code:

app/code/local/Zac/Attack/etc/config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Zac_Attack>
            <version>0.1.0</version>
        </Zac_Attack>
    </modules>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <!-- Override Adminhtml module here. -->
                        <Zac_Attack_Adminhtml before="Mage_Adminhtml">Zac_Attack_Adminhtml</Zac_Attack_Adminhtml>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
    <adminhtml>
        <layout>
            <updates>
                <attack>
                    <file>attack.xml</file>
                </attack>
            </updates>
        </layout>
    </adminhtml>
    <global>
        <blocks>
            <attack>
                <class>Zac_Attack_Block</class>
            </attack>
        </blocks>
    <!-- models, resources, etc -->
    </global>
</config>

app/code/local/Zac/Attack/Block/Adminhtml/Sales/Order/View/Tab/Attack.php:

<?php

class Zac_Attack_Block_Adminhtml_Sales_Order_View_Tab_Design extends Mage_Adminhtml_Block_Template
    implements Mage_Adminhtml_Block_Widget_Tab_Interface
{
    protected function _construct()
    {
        parent::_construct();
        $this->setTemplate( 'attack/sales/order/view/tab/attack.phtml' );
    }

    public function getTabLabel()
    {
        return $this->__( 'Attack' );
    }

    public function getTabTitle()
    {
        return $this->__( 'Attack' );
    }

    public function getTabClass()
    {
        return '';
    }

    public function getClass()
    {
        return $this->getTabClass();
    }

    public function getTabUrl()
    {
        // Here the url gets rewritten to my custom name, throws 404 when called...
        // The url takes the form:
        // http://mydomain.com/admin/sales_order/attack/order_id/1/key/65cbb0c2956dd9413570a2ec8761bef5/
        return $this->getUrl('*/*/attack', array('_current' => true));
    }

    public function canShowTab()
    {
        return true;
    }

    public function isHidden()
    {
        return false;
    }

    public function getOrder()
    {
        return Mage::registry( 'current_order' );
    }
}

app/code/local/Zac/Attack/controllers/Adminhtml/Sales/OrderController.php:

<?php

require_once "Mage/Adminhtml/controllers/Sales/OrderController.php";

class Zac_Attack_Adminhtml_Sales_OrderController extends Mage_Adminhtml_Sales_OrderController
{
    public function viewAction()
    {
        // This doesn't get called when viewing the default order detail page.
        // I should see the <h1> output as the only content on the page but I don't.
        die( '<h1>viewAction()</h1>' );
    }

    public function attackAction()
    {
        // This should be called when the url has the pattern '*/*/attack' (as it does
        // when displaying my custom tab) however clicking this tab gives a 404.
        die('<h1>attackAction()</h1>');
    }
}

app/design/adminhtml/default/default/layout/attack.xml

<?xml version="1.0" encoding="UTF-8"?>
<layout>
    <adminhtml_sales_order_view>
        <reference name="sales_order_tabs">
            <action method="addTab">
                <name>order_design_details</name>
                <block>attack/adminhtml_sales_order_view_tab_design</block>
            </action>
        </reference>
    </adminhtml_sales_order_view>
</layout>

What appears to be failing is the controller override. Neither the overriden method “viewAction()” nor the custom action “attackAction()” get called. I can tell that the config is being picked up because when I print “Mage::getConfig()->getNode(‘admin/routers/adminhtml’)” I can see the following output:

Mage_Core_Model_Config_Element Object
(
    [args] => Mage_Core_Model_Config_Element Object
        (
            [module] => Mage_Adminhtml
            [modules] => Mage_Core_Model_Config_Element Object
                (
                    [Mage_Index] => Mage_Index_Adminhtml
                    [Mage_Paygate] => Mage_Paygate_Adminhtml
                    [Mage_Paypal] => Mage_Paypal_Adminhtml
                    [widget] => Mage_Widget_Adminhtml
                    [Mage_GoogleOptimizer] => Mage_GoogleOptimizer_Adminhtml
                    [Mage_GoogleBase] => Mage_GoogleBase_Adminhtml
                    [Mage_Authorizenet] => Mage_Authorizenet_Adminhtml
                    [Mage_Bundle] => Mage_Bundle_Adminhtml
                    [Mage_Centinel] => Mage_Centinel_Adminhtml
                    [Mage_Compiler] => Mage_Compiler_Adminhtml
                    [connect] => Mage_Connect_Adminhtml
                    [Mage_Downloadable] => Mage_Downloadable_Adminhtml
                    [importexport] => Mage_ImportExport_Adminhtml
                    [Mage_PageCache] => Mage_PageCache_Adminhtml
                    [xmlconnect] => Mage_XmlConnect_Adminhtml
                    [EM_DeleteOrder_Adminhtml] => EM_DeleteOrder_Adminhtml
                    [find_feed] => Find_Feed_Adminhtml
                    [moneybookers] => Phoenix_Moneybookers
                    [Zac_Attack_Adminhtml] => Zac_Attack_Adminhtml
                )

            [frontName] => admin
        )

    [use] => admin
)

So, my first question is: Am I following the correct approach for adding a custom tab to the page?

If I am not following the correct approach can you please advise me what the correct approach is or provide a link which clearly outlines the whole approach (there are too many answer fragments when searching for Magento information, not enough whole answers).

If I am following the correct approach, why is my controller not overriding?

Well, I hope that I’ve provided enough detail to make the problem clear. If not, feel free to post follow up questions in the comments and I’ll be happy to elaborate – if I know how.

Thanks in advance for any help offered.

Cheers,
Zac

P.S. I noticed that there is another module in the community section overriding the same controller – however that override doesn’t appear to be taking effect either. Regardless, I have completely removed the 3rd party module for the purposes of debugging to ensure that there is no interference.

  • 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-05-25T06:45:58+00:00Added an answer on May 25, 2026 at 6:45 am

    Well, this isn’t the first time the solution wasn’t what I was expecting it to be. As I mentioned in reply to OSDave’s comments above, my module code was written exactly as it should be – the problem was with another module overriding the same controller.

    For future reference, if you think you’ve got your controller override done right (admin or frontend – should be the same either way) but it isn’t working, I highly recommend using “Mage::getConfig()->getNode('admin/routers/adminhtml')” to debug. Just make sure the XPath in the getNode method is appropriate for the module you’re overriding and then look for any entries that aren’t clearly Magento.

    Hopefully this will save some others the hours I wasted on the problem.

    Cheers,
    Zac

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If have created a custom role within SqlServer which I added to the db__denydatareader
I have created a simple Asp.Net custom control which automatically combines all the correct
I have the following code (which is created dynamically by Magento) and I need
I have created custom aplication resource: class Custom_Entitymanager extends Zend_Application_Resource_ResourceAbstract{ //... public function init
I have created custom MembershipUser, MembershipProvider and RolePrivoder classes. These all work and I
I have created a custom dialog for Visual Studio Setup Project using the steps
I have created a small flash CS4 project that has a few custom components
I'm interested in seeing what custom extensions other developers have created for the ASP.NET
I've created a custom object, I have it appearing automatically on the Account details
I have an application that has created a number of custom event log sources

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.