0

I have an almost empty magento 1.9.3 project, caches disabled, with 4 custom modules and I want to make an observer in one of them. I made observers before in other projects and they worked, but in this project the observer is not doing anything.

The code is:

//App/Code/Local/Feliu/Promos/etc/config.xml

<config>
    <modules>
        <Feliu_Promos>
            <version>0.1.0</version>
        </Feliu_Promos>
    </modules>
    <global>
        <models>
            <feliu_promos>
                <class>Feliu_Promos_Model</class>
                <resourceModel>feliu_promos_resource</resourceModel>
            </feliu_promos>
            <feliu_promos_resource>
                <class>Feliu_Promos_Model_Resource</class>
                <entities>
                    <promos>
                        <table>feliu_promos</table>
                    </promos>
                </entities>
            </feliu_promos_resource>
        </models>
        <blocks>
            <feliu_promos>
                <class>Feliu_Promos_Block</class>
            </feliu_promos>
        </blocks>
        <helpers>
            <feliu_promos>
                <class>Feliu_Promos_Helper</class>
            </feliu_promos>
        </helpers>
        <resources>
            <feliu_promos_setup>
                <setup>
                    <module>Feliu_Promos</module>
                </setup>
            </feliu_promos_setup>
        </resources>
        <events>
            <controller_front_init_routers>
                <observers>
                    <feliu_promos_model_observer>
                        <type>singleton</type>
                        <class>>Feliu_Promos_Model_Observer</class>
                        <method>interceptMethod</method>
                    </feliu_promos_model_observer>
                </observers>
            </controller_front_init_routers>
        </events>
    </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <Feliu_Promos before="-">Feliu_Promos_Adminhtml_Promos</Feliu_Promos>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
    <frontend>
    <routers>
        <promotions>
            <use>standard</use>
                <args>
                    <module>Feliu_Promos_Frontend_Promos</module>
                    <frontName>promotions</frontName>
                </args>
            </promotions>
        </routers>
    </frontend>
</config>

and the observer:

//App/Code/Local/Feliu/Promos/Model/Observer.php

class Feliu_Promos_Model_Observer
{
    public function interceptMethod($observer) {

        $event = $observer->getEvent()->getControllerAction()->getFullActionName();
        Mage::log('**** EVENT FIRED ****' . $event );
        exit(__METHOD__);

    }
}

I can't see where is the error, everything seems ok, I read all the previous questions about 'event observer not firing' that I found, but I still can't see the error, maybe it's obvious but I can't see it and the rest of the module is working fine.

PD: I tried to replace the class of the event observer in config.xml from Feliu_Promos_Model_Observer to feliu_promos/observer but nothing changes.

1
  • There is a typo error in your config.xml. <class>>Feliu_Promos_Model_Observer</class> should be <class>Feliu_Promos_Model_Observer</class> there is an extra > Mar 10, 2017 at 11:24

1 Answer 1

3

you have added ">" in your config.xml from line <class>>Feliu_Promos_Model_Observer</class>. Try remove this ">" code and check.

1
  • As I suspected the error was obvious... I lost literally a lot of hours only by one > .... Thank you
    – Alex
    Mar 10, 2017 at 11:26

Your Answer

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

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