Here I will add the solution to the question just in case someone else has the same issue/extension. I have also sent the Code updates to [link]http://www.boostmyshop.com/english/magento/product-return-rma.html to add to a possible upgrade of their RMA's extension.

I needed to add the name of the logged in admin that created an RMA in Magento CE 1.7 using the above extension that I purchased along with their Embedded ERP solution.

Here's the code:

add this to AdminController.php (Not sure if it is really neccessary)

    public function getUser()    {  

   return Mage::getSingleton('admin/session')->getUser();   


At the top of info.phtml add this:

 <?php $user = Mage::getSingleton('admin/session');$userName = $user->getUser()>getUsername();?>

Then this around line 10

<input name="data[rma_admin]" type="hidden" value="<?php echo $userName ?>" />

Then create an additional tr/td and add this:

       <tr><td class="label"><?php echo $this->__('Updated by'); ?></td><td class="input-ele"><?php echo $this->getRma()->getrma_admin(); ?> </td> </tr>

You must also add the additonal columns to display the admin name in the Grid.php files

 $this->addColumn('rma_admin', array(
'header'=> Mage::helper('ProductReturn')->__('Updated by'),
'width' => '100px', 
'type'  => 'text', 
'index' => 'rma_admin', )); 

Finally inside the rma Database table ceate a new column called "rma_admin"


  • Have you enabled Magento Developer Mode? In which template file are you trying to output the username? Does the corresponding block class have a getUser() method?
    – Vinai
    Jun 12 '13 at 16:20
  • @Vinal I'm using an RMA's extension. Unfortuantely the ext. doesn't add the name of the admin that has created an RMA.. Jun 12 '13 at 18:32
  • You already said so in the original post. How about answering the additional questions, then it might be possible to provide a real answer?
    – Vinai
    Jun 12 '13 at 19:25
  • @Vinai thanks for the assistance. I've added some more code and an explanation of what I am trying to do here... Jun 12 '13 at 20:26
  • Please confirm, you are trying to replace the default RMA adminhtml controller with one from your module, so you can save the admin user name in the admin_user RMA attribute. Is that correct?
    – Vinai
    Jun 13 '13 at 5:34

This answer refers to the Enterprise_Rma module, not the CE extension the OP is using.

As far as I understand, what you are wanting to do is set the admin user value on the RMA model when an RMA is created in the backend.
You already have added the column admin_user (or whatever you have used as your attribute code) to the enterprise_rma table.

Instead of using a controller overwrite to achieve your goal, it's much more compatible and upgrade safe to use an event observer.

Unfortunately, the RMA model doesn't set it's own event prefix, so you will have to observer the generic core_abstract_save_before event, and check the object instance type in the observer method.

To do so, you first need to define it in your modules etc/config.xml file.


Then, in the observer class:

class MyModul_ProductReturn_Model_Observer
    public function coreAbstractSaveBefore(Varien_Event_Observer $observer)
        $model = $observer->getObject();
        if ($model instanceof Enterprise_Rma_Model_Rma) {
            /** @var Enterprise_Rma_Model_Rma $model */
            if ($model->isObjectNew()) {
                /** @var Mage_Admin_Model_User $admin */
                $admin = Mage::getSingleton('admin/session')->getUser();
                if ($admin && $admin->getId()) {

Now, every time a new RMA is saved, the admin's username will be set.

  • Thanks for the solution. I have almost got it top work except the admin name is still not saving in the Database table. I think it has something to do with 'if ($model instanceof Enterprise_Rma_Model_Rma)' as I am using community 1.7 should I change this to an instance of my module? Jun 14 '13 at 9:56
  • I was assuming you are using the Enterprise_Rma module, since there is no RMA functionality in the community edition. Let me reread your question.
    – Vinai
    Jun 14 '13 at 11:03
  • You seem to be using some kind of RMA extension. Add that information to the original question, as it is important in regards to being able to answer.
    – Vinai
    Jun 14 '13 at 11:05
  • Which RMA extension are you using? Provide a link, otherwise it's still guesswork.
    – Vinai
    Jun 14 '13 at 11:40
  • The RMA module you linked is commercial code, I'm pretty sure the copyright owner would not like you to publish their code on bitbucket.
    – Vinai
    Jun 14 '13 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.