1. Create mymodulepack folder in local folder.
Path: C:\wamp\www\triangeli\app\code\local\mymodulepack
2. Create catalog folder inside mymodulpack namespace.
3. Create block, etc, helper folder inside Catalog folder.
4. Create Navigation.php file in block folder. Override class and write functions inside this file.
<?php
class mymodulepack_Catalog_Block_Navigation extends Mage_Catalog_Block_Navigation
{
//write the function here,which add new functionality or override the original code
public function override()
{
//write the code here
}
}
5. Create config.xml file inside etc folder.
<?xml version="1.0" encoding="iso-8859-1"?>
<config>
<modules>
<mymodulepack_Catalog>
<version>0.1.0</version>
</mymodulepack_Catalog>
</modules>
<global>
<blocks>
<catalog>
<rewrite>
<class>mymodulepack_Catalog_Block</class>
</rewrite>
</catalog>
</blocks>
<helpers>
<catalog>
<rewrite>
<class>mymodulepack_Catalog_Helper</class>
</rewrite>
</catalog>
</helpers>
</global>
</config>
6. Create Data.php file inside Helper folder.
<?php
class mymodulepack_Catalog_Helper_Data extends Mage_Core_Helper_Abstract
{
}
?>
7. To “activate” my new module “mymodulepack”:
In the file app\etc\local.xml reference mymodulepack under the global scope:
<config>
<global>
<blocks>
<catalog>
<rewrite>
<navigation>mymodulepack_Catalog_Block_Navigation</navigation>
</rewrite>
</catalog>
</blocks>
<install>
<date><![CDATA[Thu, 17 Dec 2009 11:50:52 +0000]]></date>
</install>
<crypt>
<key><![CDATA[d89edae607842ce91b0e36456faed63e]]></key>
</crypt>
<disable_local_modules>false</disable_local_modules>
<resources>
<db>
<table_prefix><![CDATA[]]></table_prefix>
</db>
<default_setup>
<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[root]]></username>
<password><![CDATA[]]></password>
<dbname><![CDATA[pizzaman]]></dbname>
<active>1</active>
</connection>
</default_setup>
</resources>
<session_save><![CDATA[files]]></session_save>
</global>
<admin>
<routers>
<adminhtml>
<args>
<frontName><![CDATA[admin]]></frontName>
</args>
</adminhtml>
</routers>
</admin>
</config>
8. Disable cache from admin section.
Any idea how to override helper class ?
ReplyDelete