Portnyagin Mikhail
Portnyagin Mikhail

Reputation: 337

Can't override Mage_Sales_Model_Order

I have such section in config.xml

<global>        
    <models>
        <sales>
            <rewrite>
                <order>Apptha_Reservation_Model_Order</order>                   
            </rewrite>
        </sales>
    </models>
</global>

In addition, I have download Alan Strom config viewer from here http://alanstorm.com/magento_config but when I check myhost.com/?showConfig=true, I don't see my new rewrite rule.

Upvotes: 1

Views: 2308

Answers (1)

benmarks
benmarks

Reputation: 23205

There are three possibilities when module configuration is not being merged into Magento's configuration DOM:

  1. Configuration is being cached. Clear it by flushing all in System > Cache Management
  2. Your module's config.xml is not being parsed due to incorrect module declaration or incorrect path.
  3. global/disable_local_modules is set to 1 or true - in general, see app/etc/local.xml, but the only way to know for sure is to inspect the full DOM.

In the case of (2), troubleshooting should occur only after config cache has been cleared. Then, check each of the conditions for your module's config.xml file to be parsed into the configuration DOM:

  1. Correct module declaration: an file with a name ending in ".xml" containing valid XML syntax present in app/etc/ or in app/etc/modules/ (by convention, it's the latter).
  2. The module contains structure as follows (currently SO is not displaying these correctly; see gist instead):

    true local

  3. Based on the above configuration, the config file must be located at app/code/local/Module/Path/etc/config.xml and must contain valid XML syntax in order to be parsed.

Provided that module declaration and file paths are correct, the likely culprit is invalid syntax. This can be determined by setting the developer mode flag and ensuring that PHP is displaying errors (see index.php).

Upvotes: 1

Related Questions