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 7440845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:54:52+00:00 2026-05-29T10:54:52+00:00

I am working on creating what I hope one day will be a publicly

  • 0

I am working on creating what I hope one day will be a publicly available Magento extension (this part I mention because it’s important to me that I do the “right thing” here). One of the things I would like to do is add a box in the default Magento dashboard, basically a new “box” exactly like “Top 5 Search Terms” except with my own content. I would like my new custom box to be the last box that is displayed (ideally).

The issue that I’m running into is that the template that is responsible for rendering the dashboard calls out specific blocks to be rendered, and these blocks are nested inside of html. In other words, where often there is an area where child blocks will be rendered into a nice reasonable HTML element, in this situation it appears that specific blocks are rendered. Here is the contents of /app/design/adminhtml/default/default/template/dashboard/index.phtml

  <div class="dashboard-container">
            <?php echo $this->getChildHtml('store_switcher') ?>
            <table cellspacing="25" width="100%">
                <tr>
                    <td><?php echo $this->getChildHtml('sales') ?>
                        <div class="entry-edit">
                            <div class="entry-edit-head"><h4><?php echo $this->__('Last 5 Orders') ?></h4></div>
                            <fieldset class="np"><?php echo $this->getChildHtml('lastOrders'); ?></fieldset>
                        </div>
                        <div class="entry-edit">
                            <div class="entry-edit-head"><h4><?php echo $this->__('Last 5 Search Terms') ?></h4></div>
                            <fieldset class="np"><?php echo $this->getChildHtml('lastSearches'); ?></fieldset>
                        </div>
                        <div class="entry-edit">
                            <div class="entry-edit-head"><h4><?php echo $this->__('Top 5 Search Terms') ?></h4></div>
                            <fieldset class="np"><?php echo $this->getChildHtml('topSearches'); ?></fieldset>
                        </div>
                    </td>
                    <td>
                        <div class="entry-edit" style="border:1px solid #ccc;">
                            <?php echo $this->getChildHtml('diagrams') ?>
                            <?php if (is_array($this->getChild('diagrams')->getTabsIds())) : ?>
                                <div id="diagram_tab_content"></div>
                            <?php endif; ?>
                            <div style="margin:20px;">
                                <?php echo $this->getChildHtml('totals') ?>
                            </div>
                            <div style="margin:20px;">
                                <?php echo $this->getChildHtml('grids') ?>
                                <div id="grid_tab_content"></div>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>

If I was doing this in my own store, I believe I could achieve this relatively easily by editing the base Magento dashboard template index.phtml above, add what I need to have my block render, something like:

<div class="entry-edit">
     <div class="entry-edit-head">
         <h4><?php echo $this->__('Top 5 Search Terms') ?></h4></div>
         <fieldset class="np"><?php echo $this->getChildHtml('myDashboardBox'); ?></fieldset>
     </div>
</div>

But, this isn’t my own store, so this doesn’t really seem like an option.

Now, after some thought my options seem to be as follows (note that most of these seem “bad” and not something I’d be super proud to have seen in the public):

0) Something obvious that I’m not seeing that you will tell me is the perfect/right solution

1) I might (maybe?) be able to add my custom block inside of one of these other blocks in this area (“topSearches”, “sales”, etc) and have my block rendered. This does not seem very “clean”

2) I might be able to have the block rendered somewhere else on the dashboard page, and then move it with javascript to the correct place. This would be fairly easy I’m guessing, but feels very “hacky” for obvious reasons.

Does anybody have any feedback on the way to do this, or IF there is a way? Keep in mind that again I would like to release this module publicly so my goal is to do a good job and do as little “hacking” as possible.

Thank you very much for reading!

  • 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-29T10:54:53+00:00Added an answer on May 29, 2026 at 10:54 am

    There is no really clean option, as you said, the template is coded in a non-extendable way, so there will always be some degree of hackiness. This is my personal preferred way of doing it by using event observers. This way it at least doesn’t conflict with other modules.

    First, add an observer for the core_block_abstract_prepare_layout_after and core_block_abstract_to_html_after event.

    <adminhtml>
        <events>
            <core_block_abstract_prepare_layout_after>
                <observers>
                    <your_module>
                        <class>your_module/observer</class>
                        <method>coreBlockAbstractPrepareLayoutAfter</method>
                    </your_module>
                </observers>
            </core_block_abstract_prepare_layout_after>
            <core_block_abstract_to_html_after>
                <observers>
                    <your_module>
                        <class>your_module/observer</class>
                        <method>coreBlockAbstractToHtmlAfter</method>
                    </your_module>
                </observers>
            </core_block_abstract_to_html_after>
        </events>
    </adminhtml>
    

    These two events are dispatched for every block that is instantiated and rendered in Mage_Core_Block_Abstract. In my experience it’s not such an issue using them in the adminhtml interface, but on the frontend observers for these events add too much overhead.

    Back to the task at hand, you need to create the observer class.

    class Your_Module_Model_Observer
    {
        public function coreBlockAbstractPrepareLayoutAfter(Varien_Event_Observer $observer)
        {
            if (Mage::app()->getFrontController()->getAction()->getFullActionName() === 'adminhtml_dashboard_index')
            {
                $block = $observer->getBlock();
                if ($block->getNameInLayout() === 'dashboard')
                {
                    $block->getChild('topSearches')->setUseAsDashboardHook(true);
                }
            }
        }
    
        public function coreBlockAbstractToHtmlAfter(Varien_Event_Observer $observer)
        {
            if (Mage::app()->getFrontController()->getAction()->getFullActionName() === 'adminhtml_dashboard_index')
            {
                if ($observer->getBlock()->getUseAsDashboardHook())
                {
                    $html = $observer->getTransport()->getHtml();
                    $myBlock = $observer->getBlock()->getLayout()
                        ->createBlock('you_module/block')
                        ->setTheValuesAndTemplateYouNeed('HA!');
                    $html .= $myBlock->toHtml();
                    $observer->getTransport()->setHtml($html);
                }
            }
        }
    }
    

    Your template will need to accomodate for the fact that you are inserting a sibling <div> from inside the sibling, but otherwise you should be fine.

    </fieldset></div>
    <div class="entry-edit">
        <div class="entry-edit-head"><h4>Your Module</h4></div>
        <fieldset class="np">Your Content
    

    Leave it at that, because the parent template will be closing the <fieldset> and the <div> for you (ugly as heck, I know).

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

Sidebar

Related Questions

I'm working on creating a self updating application and one issue I'm running into
I am working on creating a web app that will query event logs on
I am working on creating a Google Chrome extension. We have it included in
I'm working on creating a SQL query that will pull records from a table
First-timer here, I hope I explain this well enough... PHP/Smarty, I'm working on a
I am using this AutoCopy chrome extension as a framework for what I hope
I am working on creating a Windows Phone app that will play a series
I am working on creating an MVC application for an existing Bug tracker of
I am working on creating a thread safe control for my windows forms application.
I’m working on creating a full-screen 3-D app (based on Johnny Lee's Wii head

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.