You always get people saying never to modify the core magento files (/app/code/core/), but what about the /js/mage/ files? Will this get overwritten when you upgrade magento? Is there an alternative place to create them (e.g. with core in /app/code/local/mage/)?
Anything that will be overwritten on an upgrade is core, including stuff in the skins folder.– Fiasco LabsFeb 3, 2014 at 17:00
Never edit any file that is in the core.
This includes php classes, template classes, and js files.
What you can do is to "somehow" rewrite them.
You can clone any file in a custom folder but still in
Then you can edit the layout files of you theme and make them include your file instead of the original one.
<reference name="head"> <action method="removeItem"><type>js</type><name>original/js/file</name></action> <action method="addJs"><name>my_company/filename.js</name></action> <reference>
If you want to extend a js "class" don not clone the full file.
You can create your own and just add it to the page.
See a very nice explanation from @Fooman on how to manage these kind of js extensions.
Hey Marius, thanks for the answer, my confusion comes from the following - the /js/mage folder isn't actually in the 'core' folder (/app/code/core/), so do they still count as core files? This is what I'm trying to do.– eddhallFeb 3, 2014 at 12:08
1@Edward. It depends what
coremeans to you. For me it means every file that comes with the Magento archive. The templates are also not located in
app/code/codebut you should not edit any file in
app/design/frontend/base/defaulteither. Same goes for any file in the
jsfolder.– Marius ♦Feb 3, 2014 at 12:15
Hey Marius, Good to know thanks. All I'm trying to do is add one line of text to a js file, would the fooman link be the best way of doing this?– eddhallFeb 10, 2014 at 15:44
skin/frontend/default/foobar/js or your own custom library under
js/mage folder contents yes, it will get overwritten in an upgrade unless you specifically exclude that directory/files - but after that could come the real trouble.