2

I am trying to create my own module to override / extend Mage_Cms_Model_Resource_Page.

This is what I have so far

1) Enable the module by creating /app/etc/modules/Namespace_ModuleName.xml

<config>
    <modules>
        <Namespace_ModuleName>
            <active>true</active>
            <codePool>local</codePool>
        </Namespace_ModuleName>
    </modules>
</config>

2) Set up the config /app/code/local/Namespace/ModuleName/etc/config.xml

 <?xml version="1.0"?> 
 <config>  
  <global>  
     <models>  
        <page_resource>
            <rewrite>
              <page>Namespace_ModuleName_Model_Resource_Page</page>
            </rewrite>
        </page_resource>
    </models>  
 </global>   
</config>

3) Set up the new model - /app/code/local/Namespace/ModuleName/Model/Resource/Page.php

class Namespace_ModuleName_Model_Resource_Page extends Mage_Cms_Model_Resource_Page
{
    protected function _getLoadSelect($field, $value, $object)
    {
        echo 'test';
        exit;
    }
}

However when I load a cms page nothing happens but I can see whats wrong. Can anyone advise please

1

Your issue at wrong calling for resource type at config.xml

it should be cms_resource from page_resource.

As per as ,magento cms_resource resource type class is Mage_Cms_Model_Resource

See at config.xml of Mage_Cms Module:

 <cms_resource>
                <class>Mage_Cms_Model_Resource</class>
  • good catch +1 from me@Amit bera – Keyur Shah May 15 '15 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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