Gilberto Albino
Gilberto Albino

Reputation: 2744

How to override magento 1.7 default Mage_Page codePool

Before getting started, I am using Magento 1.7.

I am trying to create a custom theme outside default package and got everything okay so far. But I have to change the app/etc/modules/Mage_All.xml file so that I can access the local folder with the module configs.

This is the original block of code:

<Mage_Page>
    <active>true</active>
    <codePool>core</codePool>
    <depends>
        <Mage_Core/>
    </depends>
</Mage_Page>

And this is the line I have changed:

<codePool>core</codePool>

However, as good practice in programming we should never edit core files, so I'm afraid that if upgrade my magento that file will be replaced and so, the theme would stop working.

So que question is how to override this settings.

I've created a module 'Local' inside app/code/local/Local with proper config.xml and system.xml files.

And created a xml file for the module itself inside app/etc/modules/Local.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Local>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Page/>
            </depends>
        </Local>
    </modules>
</config>

As I said, if I alter the Mage_All file it works like a charm... but I'd like to know if there is another way off calling local code folder

Upvotes: 1

Views: 988

Answers (1)

Kalpesh
Kalpesh

Reputation: 5695

First, create a file in app/etc/modules/ with name Mage_Page.xml

Put below content in it:

<?xml version="1.0"?>
<config>
    <modules>
        <Mage_Page>
            <active>true</active>
            <codePool>local</codePool>
        </Mage_Page>
    </modules>
</config>

Now, if you want whole Mage_Page module to override, copy whole app/code/core/Mage/Page/ contents and put it in your local. If you already have customized module in your local which you said is working properly, just change it's namespace to Mage and module name to Page.

Upvotes: 2

Related Questions