I'm discovering magento since 1 week. But i have a problem now. I need to include a javascript file in my admin panel to sort a list according to another. I'm using magento 1.9 and i really don't find any tutorial to do this.

Please can someone explain me clearly how to do this because i'm really stuck at this point.

  • Do you want to add the js globally to your backend or just to a specifiv grid view? Are you using a module or just altering core files? May 27, 2016 at 10:05
  • "(Ok, my message has been deleted, i don't know why...)" - because it is not an answer. Stack Exchange does not work like a forum. If you want to add details, edit the question. Only post an answer if you have a solution. May 27, 2016 at 15:43

2 Answers 2


First you have to choose a relevant layout(.xml) file based on the grid/page you want to include your javascript in.

Then in that layout you need to add the below code in the relevant section:

    <reference name="head">
            <action method="addJs"><script>my_extension/adminhack.js</script></action>
            <action method="addJs"><script>prototype/prototype.js</script></action>         

Then you need to clear Magento caches and check if your file is loaded or not.

Hope this works for you


First you have to create one module and with in module's layout file you can add a javascript and css using above answer syntax.

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