- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2017
08:00 AM
02-22-2017
08:00 AM
Who can I overide function _loadNodes in flat.php
I am new in overriding Magento code.
I function _loadNodes i just want to change the sort order which works when changing the core file, but as this is not the correct approach i want to override the class/function.
I currently have as config.xml
<config> <modules> <MyModule_Catalog> <version>0.1.0</version> </MyModule_Catalog> </modules> <global> <models> <catalog> <rewrite> <resource_category_flat>MyModule_Catalog_Model_Resource_Category_Flat</resource_category_flat> </rewrite> </catalog> </models> </global> </config>
Flat.php
class MyModule_Catalog_Model_Catalog_Resource_Category_Flat extends Mage_Index_Model_Resource_Abstract {
Xml file in etc\modules
<config> <modules> <MyModule_Catalog> <active>true</active> <codePool>local</codePool> <depends> <Mage_Catalog /> </depends> </MyModule_Catalog> </modules> </config>
it doesn't run the new code, it doesn't override
Labels:
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2017
09:16 PM
02-22-2017
09:16 PM
Re: Who can I overide function _loadNodes in flat.php
Here are your two mistakes
First Class Name In config.xml MyModule_Catalog_Model_Resource_Category_Flat
<resource_category_flat>MyModule_Catalog_Model_Resource_Category_Flat</resource_category_flat>
And class name in your file and
So here is you class look like
class MyModule_Catalog_Model_Catalog_Resource_Category_Flat extends Mage_Index_Model_Resource_Abstract {
Change it and second it must be extends with rewrite class Mage_Catalog_Model_Resource_Category_Flat
class MyModule_Catalog_Model_Resource_Category_Flat extends Mage_Catalog_Model_Resource_Category_Flat {
Find helpful ? Consider Giving Kudos to this post.
Problem solved? Click Accept as Solution!"
Qaisar Satti
Problem solved? Click Accept as Solution!"
Qaisar Satti