Magento 1.9 – Fix Fatal Error: Class ‘Magentothem_Installtemplate_Helper_Data’ Not Found

magento-1.9

i have a problem with magento, when i try enter to admin panel it shows the next error:

Fatal error: Class 'Magentothem_Installtemplate_Helper_Data' not found in Mage.php on line 547

and i cant acces to admin panel!, please i hope can help me! here my codes!

/public_html/app/code/local/Magentothem/Installtemplate/HelperCONFIG.XML

   <?xml version="1.0"?>
<config>
    <modules>
        <Magentothem_Installtemplate>
            <version>1.0.0</version>
        </Magentothem_Installtemplate>
    </modules>
    <frontend>
        <routers>
            <installtemplate>
                <use>standard</use>
                <args>
                    <module>Magentothem_Installtemplate</module>
                    <frontName>installtemplate</frontName>
                </args>
            </installtemplate>
        </routers>
        <layout>
            <updates>
                <installtemplate>
                    <file>installtemplate.xml</file>
                </installtemplate>
            </updates>
        </layout>
    </frontend>
    <admin>
        <routers>
            <installtemplate>
                <use>admin</use>
                <args>
                    <module>Magentothem_Installtemplate</module>
                    <frontName>installtemplate</frontName>
                </args>
            </installtemplate>
        </routers>
    </admin>
    <adminhtml>
        <menu>
            <magentothem module="installtemplate">
                <title>Installtemplate</title>
                <sort_order>71</sort_order>               
                <children>
                    <items module="installtemplate">
                        <title>Install Template</title>
                        <sort_order>0</sort_order>
                        <action>installtemplate/adminhtml_installtemplate</action>
                    </items>
                </children>
            </magentothem>
        </menu>
        <acl>
            <resources>
                <all>
                    <title>Allow Everything</title>
                </all>
                <admin>
                    <children>
                        <Magentothem_Installtemplate>
                            <title>Installtemplate Module</title>
                            <sort_order>10</sort_order>
                        </Magentothem_Installtemplate>
                    </children>
                </admin>
            </resources>
        </acl>
        <layout>
            <updates>
                <installtemplate>
                    <file>installtemplate.xml</file>
                </installtemplate>
            </updates>
        </layout>
    </adminhtml>   
    <global>
        <models>
            <installtemplate>
                <class>Magentothem_Installtemplate_Model</class>
                <resourceModel>installtemplate_mysql4</resourceModel>
            </installtemplate>
        </models>
        <blocks>
            <installtemplate>
                <class>Magentothem_Installtemplate_Block</class>
            </installtemplate>
        </blocks>
        <helpers>
            <installtemplate>
                <class>Magentothem_Installtemplate_Helper</class>
            </installtemplate>
        </helpers>
    </global>
</config>

/public_html/app/code/local/Magentothem/Installtemplate/DATA.PHP

    <?php
class Magentothem_Installtemplate_Helper_Data extends Mage_Core_Helper_Abstract
{

   public function getContentFromXmlFile($xmlPath = NULL, $node= NULL) {
        $data = new Varien_Simplexml_Config($xmlPath);
        $statickBlockData = array();
        foreach ($data->getNode($node) as $key => $node) {
            foreach ($node as $child) {
                $array = (array) $child;
                $content = (string) $array['content'];
                $array['content'] = $content;
                $statickBlockData[] = array_unique($array);
            }
        }
        if ($statickBlockData)
            return $statickBlockData;
        return array();
    } 

   public function getStaticBlockData() {
        $xmlPath = Mage::getBaseDir('code') . '/local/Magentothem/Installtemplate/Block/Xml/data_static_blocks.xml';
        $statickBlockData = $this->getContentFromXmlFile($xmlPath, 'blocks');
        if ($statickBlockData)
            return $statickBlockData;
        return array();
    }

    public function getCmsPageData() {

        $xmlPath = Mage::getBaseDir('code') . '/local/Magentothem/Installtemplate/Block/Xml/data_resources.xml';
        $statickBlockData = $this->getContentFromXmlFile($xmlPath, 'resources');
        if ($statickBlockData)
            return $statickBlockData;
        return array();

    }


    public function haveBlockBefore($identifier = NULL) {
        //$stores = implode(',', $stores);
        $exist = Mage::getModel('cms/block')->getCollection()
                ->addFieldToFilter('identifier', array('eq' => $identifier))
                ->load();
        if (count($exist))
            return true;
        return false;
    }

    public function haveBlockPageBefore($identifier = NULL) {
        //$stores = implode(',', $stores);
        $exist = Mage::getModel('cms/page')->getCollection()
                ->addFieldToFilter('identifier', array('eq' => $identifier))
                ->load();
        if (count($exist))
            return true;
        return false;
    }



    public function getNodeDataFromBlock($node = 'identifier', $blocks = array()) {

        $array_identifier = array();
        foreach($blocks as $block) {
            $identifier = $block[$node];
            $array_identifier[] = $identifier;

        }
        if($array_identifier)
            return $array_identifier;
        return array();

    }

    public function getNodeDataFromStaticBlock() {
       if($this->getNodeDataFromBlock('identifier', $this->getStaticBlockData())) 
               return $this->getNodeDataFromBlock('identifier', $this->getStaticBlockData());
       return array();
    }

      public function getNodeDataFromCmsPageBlock() {
       if($this->getNodeDataFromBlock('identifier', $this->getCmsPageData())) 
               return $this->getNodeDataFromBlock('identifier', $this->getCmsPageData());
       return array();
    }

    public function getOldConfigData(){
        $oldConfig = array(
            array(
                0=> 'default',
                1=> 'home'
            )
        );
        return $oldConfig;
    }

     public function getBannerData() {

        $xmlPath = Mage::getBaseDir('code') . '/local/Magentothem/Installtemplate/Block/Xml/banner7.xml';
        $statickBlockData = $this->getContentFromXmlFile($xmlPath, 'records');

        if ($statickBlockData)
            return $statickBlockData;
        return array();
    }

    public function getBrandSliderData() {

        $xmlPath = Mage::getBaseDir('code') . '/local/Magentothem/Installtemplate/Block/Xml/brandslider.xml';
        $statickBlockData = $this->getContentFromXmlFile($xmlPath, 'records');

        if ($statickBlockData)
            return $statickBlockData;
        return array();
    }

     public function getAllStore() {
        $stores = Mage::app()->getStores();
        $storeIds = array();
        $storeIds[]= 0;
        foreach ($stores as $_store) {

                $storeIds[] = $_store->getId();
        }
        return $storeIds;
    }

}

Best Answer

You state that in this file: app/code/local/Magentothem/Themeoptions/Helper/DATA.PHP your header looks like:

class Magentothem_Installtemplate_Helper_Data extends Mage_Core_Helper_Abstract

This is a header to another extension, not Themeoptions.

It should look like this:

class Magentothem_Themeoptions_Helper_Data extends Mage_Core_Helper_Abstract

From the original code provided which looked like: enter image description here

Looking into your functions, it appears you have more hardcoded ties to this "Installtemplate" extension. An example is here:

$xmlPath = Mage::getBaseDir('code') . '/local/Magentothem/Installtemplate/Block/Xml/data_resources.xml';

This extension appears to be a mashup of two extensions. I would attempt to contact whoever you purchased this extension from, and ask for the correct code. Otherwise, I would remove the extension from your codebase altogether.

Related Topic