0

My Observer file is actually in the local code pool but it tries to open it from Warning: include(Mage/Schott/CurrencyDetector/Model/Observer.php): failed to open stream: No such file or directory. I don't know why it is trying to open the file from the wrong path.

Caches and compiler are disabled. Here is my config.xml. Can anyone help? Thanks!

<config>
<modules>
    <Schott_CurrencyDetector>
        <version>1.0.0</version>
    </Schott_CurrencyDetector>
</modules>
<global>
    <models>
        <schott_currencydetector>
            <class>Schott_CurrencyDetector_Model</class>
        </schott_currencydetector>
    </models>
</global>
<frontend>
    <events>
        <customer_login>
            <observers>
                <Schott_CurrencyDetector_Observer>
                    <type>model</type>
                    <class>Schott_CurrencyDetector/observer</class>
                    <method>customerLogin</method>
                </Schott_CurrencyDetector_Observer>
            </observers>
        </customer_login>
    </events>
</frontend>

1

The error pops up, because the class you try to use is not declared, so Magento "thinks" it's a part of code/core/Mage/.

Try to change:

<class>Schott_CurrencyDetector/observer</class>

to

<class>schott_currencydetector/observer</class>

It has to match the model alias you have defined here:

<models>
    <schott_currencydetector>
    ...
0

You can try this code in your config.xml

<frontend>
    <events>
        <customer_login>
            <observers>
                <Schott_CurrencyDetector_Observer>
                    <type>model</type>
                    <class>Schott_CurrencyDetector_Model_Observer</class>
                    <method>customerLogin</method>
                </Schott_CurrencyDetector_Observer>
            </observers>
        </customer_login>
    </events>
</frontend>

Note : remember that you can create observer in app->code->local->Schott->CurrencyDetector->Model->Observer.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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