Magento Expert Forum - Improve your Magento experience

Results 1 to 6 of 6

Class not found error while extending core helper

  1. #1
    New member Kishore's Avatar
    Join Date
    Dec 2015
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question 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:


  2. #2
    New member Sean_N's Avatar
    Join Date
    Jan 2015
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Did you define class Mage_Kishore_Kp_Helper_Data somewhere?

  3. #3
    New member Kishore's Avatar
    Join Date
    Dec 2015
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    No I haven't defined the class Mage_Kishore_Kp_Helper_Data anywhere ..

  4. #4
    Junior Member
    Join Date
    Jan 2016
    Location
    Miami, Florida
    Posts
    22
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    You need to check permissions for files and folders - is it readable for server.

  5. #5
    Junior Member
    Join Date
    Aug 2016
    Posts
    72
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •