Magento Expert Forum - Improve your Magento experience
-
New member
Class not found error while extending core helper
I am trying to extend the core helper class But found the below error..
Fatal error: Class 'Mage_Kishore_Kp_Helper_Data' not found
Below are the path of my files..
1. app/etc/modules/Kishore_Kp.xml
2. app/code/community/Kishore/Kp/etc/config.xml
3. app/code/community/Kishore/Kp/Helper/Data.php
These are my files..
1.Kishore_Kp.xml
<?xml version="1.0"?>
<config>
<modules>
<Kishore_Kp>
<active>true</active>
<codePool>community</codePool>
<depends>
<Mage_Core/>
<Mage_Catalog/>
</depends>
</Kishore_Kp>
</modules>
</config>
2. config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Kishore_Kp>
<version>1.0.0</version>
</Kishore_Kp>
</modules>
<global>
<helpers>
<kishore_kp>
<class>Kishore_Kp_Helper</class>
</kishore_kp>
</helpers>
</global>
<frontend>
<routers>
<kishore_kp>
<use>standard</use>
<args>
<module>Kishore_Kp</module>
<frontName>kpswitcher</frontName>
</args>
</kishore_kp>
</routers>
</frontend>
</config>
3.Data.php
<?php
class Kishore_Kp_Helper_Data extends Mage_Core_Helper_Abstract
{
const FULL_SITE_COOKIE = 'USE_FULL_SITE';
public function getMobileToDesktopUrl() {
echo "helllllo";exit;
}
}
I am calling this helper in the footer.phtml as..
<a href="<?php echo Mage::helper('kishore_kp')->getMobileToDesktopUrl() ?>">View</a>
can any one says what am I doing wrong ?
Thanks.
View more threads in the same category:
-
-
New member
Did you define class Mage_Kishore_Kp_Helper_Data somewhere?
-
-
New member
No I haven't defined the class Mage_Kishore_Kp_Helper_Data anywhere ..
-
-
You need to check permissions for files and folders - is it readable for server.
-
-
You should always create helper class in your custom module.
[magento_root]/app/code/local/[company]/[module]/helper/Data.php
Sample file:
<?php
class Company_Module_Helper_Data extends Mage_Core_Helper_Abstract
{
}
Besides creating the Company_Module_Helper_Data class,you need to add class mapping to your config.xml
<config>
...
<global>
<helpers>
<module>
<class>Company_Module_Helper</class>
</module>
</helpers>
</global>
...
</config>
-
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks