1

In app/code/local/AB/CarLocator/controllers/Adminhtml/CarlocatorController.php code I have:

class AB_CarLocator_Adminhtml_CarlocatorController extends Mage_Adminhtml_Controller_Action
{
    public function editAction ()
    {   
         $this->_setTitle();
         $model = Mage::getModel('carlocator/car');
         if ($id = $this->getRequest()->getParam('id')) {
              $model->load($id);
         }
         Mage::register('_current_car', $model);
         $this->loadLayout(); //THIS IS WHERE THE CODE CRUSHES AND I GET THE ERROR IN system.xml
         $this->_setActiveMenu('carlocator');
    }
}

which generated the following error in var/log/system.log:

Warning: include(Mage/Ab/Carlocator/Helper/Data.php): failed to openstream:
No such file or directory 
in /var/www/vhosts/abcars.com/httpdocs/staging/lib/Varien/Autoload.php on line 93
Warning: include(): Failed opening 'Mage/Ab/Carlocator/Helper/Data.php' for inclusion
(include_path='/var/www/vhosts/abcars.com/httpdocs/staging/app/code/local
:/var/www/vhosts/abcars.com/httpdocs/staging/app/code/community
:/var/www/vhosts/abcars.com/httpdocs/staging/app/code/core
:/var/www/vhosts/abcars.com/httpdocs/staging/lib:.:')
in /var/www/vhosts/abcars.com/httpdocs/staging/lib/Varien/Autoload.php on line 93

It looks quite similar to the problem here and here so I tried the solutions suggested there and verified my config.xml file over and over and it still gives me this error.

maybe the problem derives from the fact that Magento is looking for the file under Mage/Ab/Carlocator/Helper/Data.php while it exists in code/local/AB/CarLocator/Helper/Data.php

Any help would be truly appreciated!

EDIT

app/code/local/AB/CarLocator/etc/config.xml:

<?xml version="1.0"?>
<config>
<modules>
    <AB_CarLocator>
        <version>0.1.0</version>
    </AB_CarLocator>
</modules>
<global>
    <blocks>
        <carlocator>
            <class>AB_CarLocator_Block</class>
            <rewrite>
                <carlocator>AB_CarLocator_Block_CarLocator</carlocator>
            </rewrite>
        </carlocator>
    </blocks>
    <helpers>
        <carlocator>
            <class>AB_CarLocator_Helper</class>
        </carlocator>
    </helpers>
    <request>
        <direct_front_name>
            <carlocator />
        </direct_front_name>
    </request>
    <models>
        <carlocator>
            <class>AB_CarLocator_Model</class>
            <resourceModel>carlocator_resource</resourceModel>
        </carlocator>
        <carlocator_resource>
            <class>AB_CarLocator_Model_Resource</class>
            <entities>
                <car>
                    <table>cars</table>
                </car>
            </entities>
        </carlocator_resource>
    </models>
    <resources>
        <carlocator_setup>
            <setup>
                <module>AB_CarLocator</module>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </carlocator_setup>
    </resources>
</global>
<frontend>
    <routers>
        <carlocator>
            <use>standard</use>
            <args>
                <module>AB_CarLocator</module>
                <frontName>carlocator</frontName>
            </args>
        </carlocator>
    </routers>
    <layout>
       <updates>
            <carlocator>
                <file>carlocator.xml</file>
            </carlocator>
       </updates>
    </layout>
    <translate>
        <modules>
            <carlocator>
                <files>
                    <default>CarLocator.csv</default>
                </files>
          </carlocator>
        </modules>
    </translate>
</frontend>
<adminhtml>
    <layout>
        <updates>
            <carlocator>
                <file>carlocator.xml</file>
            </carlocator>
        </updates>
    </layout>
</adminhtml>
<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <carlocator before="Mage_Adminhtml">AB_CarLocator_Adminhtml</carlocator>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>
<default>
    <catalog>
        <carlocator>
            <google_api_key>1</google_api_key>
        </carlocator>
    </catalog>
</default>
</config>

app/code/local/AB/CarLocator/Helper/Data.php:

<?php

class AB_CarLocator_Helper_Data extends Mage_Core_Helper_Abstract
{

}
12
  • provide your config.xml file here. The problem definitely resides there. Commented Jun 24, 2014 at 7:44
  • enter the code for config.xml
    – Dexter
    Commented Jun 24, 2014 at 8:00
  • Definitely an xml error
    – mpaepper
    Commented Jun 24, 2014 at 8:11
  • Please also include the path and class name of your helper Commented Jun 24, 2014 at 9:01
  • @DouglasRadburn I've stated it above - it's code/local/AB/CarLocator/Helper/Data.php
    – Urik
    Commented Jun 24, 2014 at 9:07

5 Answers 5

2
  1. check your modules registration file it should be at app/etc/modules/ Naming should be like YourNamespace_YourModulesName.xml

it should looks like :

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <YourNamespace_ModulesName>
            <active>true</active>
            <codePool>local</codePool>
        </YourNamespace_ModulesName>
    </modules>
</config>

Now check in your Adminpanel at System -> Configuration -> ADVANCED -> Advances weather your module is listed here. If its not you should propably have an error in your registration file.

2.1 If registration file is ok check your modules configuration file it should be at app/code/local/YourNamespace/YourModulesName/etc/config.xml. To find the problem here it would be great if you could post your modules configuratino file. But also you can check in the source code of Magento how the config.xml is setup up in the right way.

Hope my answers helped you.

2
  • Hi Samir, my module shows in the admin panel as AB_CarLocator and it's enabled. I've posted the config.xml file above and still can't find the problem there.
    – Urik
    Commented Jun 24, 2014 at 9:21
  • Well maybe there is problem with the name of your namespace, try to rename it to Ab instead of AB, could be an issue about case sensitive and non case sensetive os. Commented Jun 24, 2014 at 9:27
2

In the code you provided, there is no spelling issue that could cause this error. I have tested the provided code i a fresh installed MAgento 1.9.0.1. Have you checked all correspondending files used in the applied layout handle?

It looks like you have used somewhere in the code

Mage::helper('ab_carlocator')

instead of

Mage::helper('carlocator')

cheers

0
1

Start with @samir-shaban's answer, but in your case the problem seems to be your helper definition in config.xml. It's looking for the carlocator module in the Mage namespace because you didn't define the Ab namespace.

You have:

<helpers>
    <carlocator>
        <class>AB_CarLocator_Helper</class>
    </carlocator>
</helpers>

You need:

<helpers>
    <ab_carlocator>
        <class>AB_CarLocator_Helper</class>
    </ab_carlocator>
</helpers>
0

your block definition is look like this

<blocks>
    <carlocator>
        <class>AB_CarLocator_Block</class>
        <rewrite>
            <carlocator>AB_CarLocator_Block_CarLocator</carlocator>
        </rewrite>
    </carlocator>
</blocks>

This means you are trying to overwrite block. Since you specified that your module is independent module your block definition should look like this.

 <blocks>
    <carlocator>
        <class>AB_CarLocator_Block</class>
    </carlocator>
</blocks>

It says magento that you will have blocks in your module. So magento should look in the location code/local/AB/CarLocator/Block for its blocks. That is enough.

Now look at your admin router definition

 <admin>
<routers>
    <adminhtml>
        <args>
            <modules>
                <carlocator before="Mage_Adminhtml">AB_CarLocator_Adminhtml</carlocator>
            </modules>
        </args>
    </adminhtml>
</routers>
</admin>

Here you are trying to overwrite an adminhtml controller. You dont need to do that. your router definition must be look like this

<admin>
<routers>
    <carlocator>  
            <use>admin</use>
            <args>
                <module>AB_CarLocator</module>
                <frontName>carlocator</frontName>
            </args>
    </carlocator>
</routers>
</admin>
0

Magento compilation is enabled and code was not recompiled System -> Tools -> Compilation -> Run compiation process and Refresh cache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.