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? – Yiorgos Moschovitis May 27 '16 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. – Fabian Schmengler May 27 '16 at 15:43

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.

protected by Community May 27 '16 at 16:52

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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