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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:23:35+00:00 2026-06-01T08:23:35+00:00

Edit 4/4/12 I STILL HAVE ONE QUESTION: I solved my issue but it adds

  • 0

Edit 4/4/12

I STILL HAVE ONE QUESTION:

I solved my issue but it adds my option at the top of the list. How can I sort it to my my option to the bottom of the list?

Please see answer for contents of my working config.xml file…


I’m looking for in depth help here because I’ve been at this for quite a while now and seem to be getting nowhere.

Background
I was looking to make a printable RMA form for our customers to make it easier on them to Return/Exchange items.

I did this with the help of this extension: http://www.magentocommerce.com/magento-connect/admin-order-printing-extension.html
(Please download this to see the directory structure if needed)

It adds a button to the order and then I went in and edited the form/form layout so that it was an RMA (or has RMA content).

Everything is working great, however, we have to go into each order and press the button in order for it to print.

We really need a Mass Action in order to make it more efficient and useful.

Problem
I’ve tried to different ways to get this to work but I really need help on this. Most recently I’ve tried to follow this tutorial (http://www.blog.magepsycho.com/adding-new-mass-action-to-admin-grid-in-magento/) using the second method of events but I can’t seem to get this to work.

Can someone please explain in more depth (this last method I’ve tried) so that I can get it working with this module???

I’ve added this in the config.xml(according to the tutorial)

<events>
    <core_block_abstract_prepare_layout_before>
        <observers>
            <orderprint_core_block_abstract_prepare_layout_before>
                 <class>orderprint/observer</class>
                 <method>addRmaAction</method>
            </orderprint_core_block_abstract_prepare_layout_before>
        </observers>
    </core_block_abstract_prepare_layout_before>
 </events>

And in Nastnet/OrderPrint/Model/Observer.php I’ve added this (according to the tutorial)

<?php class Nastnet_OrderPrint_Model_Observer {
public function addRmaAction($observer) {
    $block = $observer->getEvent()->getBlock();
    if(get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
        && $block->getRequest()->getControllerName() == 'sales_order')
    {
        $block->addItem('pdfrma_order', array(
            'label' => 'Print RMA',
            'url' => Mage::app()->getStore()->getUrl('nastnet/controller/action'),
        ));
    }
} }

(Sorry for the messy code above – the only way I could get it highlighted)

EDIT 1 (4/2/12)
This is my module’s config.xml file. I’ve had to go with the rewrite/override method as of right now (deleting my attempts at using events). If you see anything, including the exact structure of what it would need to be please let me know…

Minus the <config> tags:

<modules>
    <Nastnet_OrderPrint>
        <version>0.1.3</version>
    </Nastnet_OrderPrint>
</modules>

<global>
    <blocks>
        <adminhtml>
            <rewrite>
                <sales_order_grid>Nastnet_OrderPrint_Block_Sales_Order_Grid</sales_order_grid> <!-- WORKIING METHOD -->
                <sales_order_view>Nastnet_OrderPrint_Block_Sales_Order_View</sales_order_view>
            </rewrite>
        </adminhtml>
    </blocks>
    <rewrite>
        <Nastnet_OrderPrint_OrderController>
            <from><![CDATA[#/\w+/sales_order/print/#]]></from>
            <to>/orderprint/order/print/</to>
        </Nastnet_OrderPrint_OrderController>
    </rewrite>
    <models>
        <Nastnet_OrderPrint>
            <class>Nastnet_OrderPrint_Model</class>
        </Nastnet_OrderPrint>
    </models>
    <pdf>
        <order>
            <default>Nastnet_OrderPrint/order_pdf_items_order_default</default>
            <grouped>Nastnet_OrderPrint/order_pdf_items_order_grouped</grouped>
        </order>
    </pdf>
</global>
<admin>
    <routers>
        <Nastnet_OrderPrint>
             <use>admin</use>
            <args>
                <module>Nastnet_OrderPrint</module>
                <!-- This is used when "catching" the rewrite above -->
                <frontName>orderprint</frontName>
            </args>
        </Nastnet_OrderPrint>
    </routers>

  • 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-01T08:23:37+00:00Added an answer on June 1, 2026 at 8:23 am

    I’ve figured out the correct handles and everything in order for this to work (with the help of this article: http://mydons.com/simple-example-using-magento-event-observer/)

    In the config.xml file, I had to make new <adminhtml> handles after the <config> handles. This got me to the right “depth”. Here is the entire config.xml file minus the <config> handles (cause it won’t paste correctly):

    <modules>
        <Nastnet_OrderPrint>
            <version>0.1.3</version>
        </Nastnet_OrderPrint>
    </modules>
    <adminhtml>
        <events>
            <core_block_abstract_prepare_layout_before>
                <observers>
                    <Nastnet_OrderPrint_Model_Observer>
                        <type>singleton</type>
                        <class>Nastnet_OrderPrint_Model_Observer</class>
                        <method>addRmaAction</method>
                    </Nastnet_OrderPrint_Model_Observer>
                </observers>
            </core_block_abstract_prepare_layout_before>
        </events>
    </adminhtml>
    <global>
        <blocks>
            <adminhtml>
                <rewrite>
                    <sales_order_view>Nastnet_OrderPrint_Block_Sales_Order_View</sales_order_view>
                </rewrite>
            </adminhtml>
        </blocks>
        <rewrite>
            <Nastnet_OrderPrint_OrderController>
                <from><![CDATA[#/\w+/sales_order/print/#]]></from>
                <to>/orderprint/order/print/</to>
            </Nastnet_OrderPrint_OrderController>
        </rewrite>
        <models>
            <Nastnet_OrderPrint>
                <class>Nastnet_OrderPrint_Model</class>
            </Nastnet_OrderPrint>
        </models>
        <pdf>
            <order>
                <default>Nastnet_OrderPrint/order_pdf_items_order_default</default>
                <grouped>Nastnet_OrderPrint/order_pdf_items_order_grouped</grouped>
            </order>
        </pdf>
    </global>
    <admin>
        <routers>
            <Nastnet_OrderPrint>
                 <use>admin</use>
                <args>
                    <module>Nastnet_OrderPrint</module>
                    <!-- This is used when "catching" the rewrite above -->
                    <frontName>orderprint</frontName>
                </args>
            </Nastnet_OrderPrint>
        </routers>
    </admin>
    

    This is the part that I needed and it is finally correct here:

    <adminhtml>
        <events>
            <core_block_abstract_prepare_layout_before>
                <observers>
                    <Nastnet_OrderPrint_Model_Observer>
                        <type>singleton</type>
                        <class>Nastnet_OrderPrint_Model_Observer</class>
                        <method>addRmaAction</method>
                    </Nastnet_OrderPrint_Model_Observer>
                </observers>
            </core_block_abstract_prepare_layout_before>
        </events>
    </adminhtml>
    

    It points to my observer file (based on the correct event) here: app/code/local/Nastnet/OrderPrint/Model/Observer.php. This obviously then holds my addRmaAction.

    I STILL HAVE ONE QUESTION:

    This puts my option at the top of the list. How can I sort it to my my option to the bottom of the list?

    Contents of Observer.php

    <?php
    class Nastnet_OrderPrint_Model_Observer
    {
    public function addRmaAction($observer)
    {   
        $block = $observer->getEvent()->getBlock();
        if(get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
            && $block->getRequest()->getControllerName() == 'sales_order')
        {
            $block->addItem('rmamassprint', array(
                'label' => 'Print Return/Exchange',
                'url' => Mage::app()->getStore()->getUrl('orderprint/order/pdfRma'),
            ));
        }
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: I solved it seconds after posting the question (sorry!) but can't accept an
-EDIT- <li> would probably be better but the same question still applies. So I
EDIT 1 I apologize but after reading the 2 suggested articles I still don't
i have this issue working but i would like to know if there is
Ok, I have a question relating to an issue I've previously had. I know
I have two divs, one inner and one outer, but the inner div is
I have seen this kind of question a lot on the internet but it
This is one annoying issue and I can't figure out how to solve it.
this is a follow up question from my previous one. you can find it
EDIT: I'm still waiting for more answers. Thanks! In SQL 2000 days, I used

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.