When searching through the forums (thank goodness for the forums) you will see posts that recommend you edit a “local” copy of a given Mangento core file such as
The recommendation to edit a local copy of a core file is so that when you upgrade to a new version of Magento the core file you edited will be overwritten and you will lose your changes.
Core files in the local folder override the same files in the core folder. For example, if you copy
app/code/local/Mage/Catalog/Model/Layer/Filter/Price.php then Magento will use
The complication is that the
app/code/local/* folders are not created by default, so if you would attempt to copy the file in an ssh session etc. the copy would fail since the enclosing folders have not been created.
You could just create folders as need, for example if you wanted to create a local copy of
app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php you would first create the
local folder if it did not exist, then inside
local you would create a
Mage folder and so on.
With PHP 5 and up you can create a complete directory structure with one mkdir command as it now has a recursive option, as well you can set permissions during that process.
To make that task easier I created a PHP script to duplicate the
/app/code/core/Mage/ folder structure to
/app/code/local/Mage/ and set the permissions to 777 (world readable,writeable,executable) during creation.
If world WRX is too open for your security structure please modify that value accordingly. If you are curious about what other values are acceptable, Google for “online chmod calculator”.
Note that the script creates a folder only if it has not been created, if a local folder or subfolder exists now it does not create it nor does it modify any contents, it simply creates folders under
/app/code/local/Mage/ if they do not exist.
Before running any script is important to understand what it does, if you don’t understand the PHP commands used below then please research them at http://www.php.net before running the script, or better yet, just don’t run the script. As with running any code against your Magento directory structure, make sure you have a complete backup of your files/folders before running the script.
First, create a new file named
createlocal.php within your Magento root folder. Copy the following code and paste into that file, then open it within a web browser using http://yourdomain/yourmagentorootfolder/createlocal.php and you should see lines of folders stating
exists: for each folder/subfolder, then finally you will see a
process complete. message.