2

Trying to override app\code\core\Mage\Catalog\Model\Resource\Category\tree.php with config.xml

<global>
  <models>
    <catalog_resource>
      <rewrite>
         <category>Namespce_Modulename_Model_Resource_Category_Tree</category>
      </rewrite>
    </catalog_resource>
 </models>
</global>

and my class is defined in folder local\Namespce\Modulename\Model\Resource\Category\Tree.php

class Namespce_Modulename_Model_Resource_Category_Tree extends Mage_Catalog_Model_Resource_Category_Tree
{
  here is functions and code
}

it gives error Call to undefined method

Namespce_Modulename_Model_Resource_Category_Tree::checkId() in app\code\core\Mage\Catalog\Model\Category.php on line 671

While it is working fine if we put folder path in locally app\code\local\Mage\Catalog\Model\Resource\Category

Please help me anybody.

2 Answers 2

4

This is working, use <category_tree> instead of only <category>:

<global>
  <models>
    <catalog>
      <rewrite>
         <category_tree>Namespce_Modulename_Model_Resource_Category_Tree</category_tree>
      </rewrite>
    </catalog>
  </models>
</global>
4
  • Hi,we have already tried but not working.
    – akgola
    Dec 2, 2015 at 8:37
  • try with updated answer Dec 2, 2015 at 8:58
  • great .......!! Dec 2, 2015 at 9:01
  • you can accept and upvote Dec 2, 2015 at 9:02
2

use this to override the category_tree model. it is tested and working

<global>
      <models>
    <catalog_resource>
          <rewrite>
             <category_tree>Namespce_Modulename_Model_Resource_Category_Tree</category_tree>
          </rewrite>
        </catalog_resource>
        </models>
    </global>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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