Magento覆盖模型资源类别树文件

时间:2015-12-02 07:02:43

标签: magento

尝试覆盖app \ code \ core \ Mage \ Catalog \ Model \ Resource \ Category \ tree.php     使用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

1 个答案:

答案 0 :(得分:0)

使用下面的代码

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