Search code examples
magentonginxmage

Magento with Custom Helper Function failed to open


I did two fresh installations of magento 1.9.0.1, one in my pc with wampserver (apache 2.44, php5.4.12) and the second in my shared hosting with nginx and php5.4.4, both working [b]fine [/b]without errors in log.

I create the simple function with a Helper class to compare the taxvat number p.e.:

app/etc/modules/MyF_checkF.xml

<config>
    <modules>
        <MyF_checkF>
            <active>true</active>
            <codePool>local</codePool>
        </MyF_checkF>
    </modules>
</config>

app/code/local/MyF/checkF/etc/config.xml

<config>
     <global>
         <helpers>
            <checkF>
                <class>MyF_checkF_Helper</class>
            </checkF>
        </helpers> 
     </global>
 </config>

app/code/local/MyF/checkF/Helper/Data.php

<?php

class MyF_checkF_Helper_Data extends Mage_Core_Helper_Abstract
{
    public function validVAT($vat)
    {
        if($vat == 123) 
                    return TRUE;
            else 
                    return FALSE;
    }
}

Copied the /app/code/core/Mage/Customer/Model/Customer.php to the /app/code/local/Mage/Customer/Model/Customer.php and added after the taxvat check

if ($attribute->getIsRequired() && !Mage::helper('checkF')->validVAT($this->getTaxvat())){
            $errors[] = Mage::helper('customer')->__('TAX/VAT wrong.');
            }

In my PC localhost works without errors, log clean, but in the shared hosting I got:

system.log

Warning: include(Mage/CheckF/Helper/Data.php): failed to open stream: No such file or directory  in /var/www/clients/client0/web10/web/lib/Varien/Autoload.php on line 93
Warning: include(): Failed opening 'Mage/CheckF/Helper/Data.php' for inclusion (include_path='/var/www/clients/client0/web10/web/app/code/local:/var/www/clients/client0/web10/web/app/code/community:/var/www/clients/client0/web10/web/app/code/core:/var/www/clients/client0/web10/web/lib:.:/usr/share/php:/usr/share/pear')  in /var/www/clients/client0/web10/web/lib/Varien/Autoload.php on line 93

error.log

FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'Mage_CheckF_Helper_Data' not found in /var/www/clients/client0/web10/web/app/Mage.php on line 547" while reading response header from upstream, request: "POST /index.php/customer/account/createpost/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9019"

Both installations with magento cache disabled, idk why in shared hosting the magento looks for Mage/CheckF.. instead local/checkf, but in localhost works.

Thanks for any help!


Solution

  • Warning: include(Mage/CheckF/Helper/Data.php): failed to open stream, it is trying to locate in Mage package instead of your custom module MyF, this might give you a clue,

    and correct your name , MyF_checkF_Helper_Data to MyF_CheckF_Helper_Data, as Magento autloads classes from directory