0

I run into this odd situation where the observer doesn't get called if I wrapped it under adminhtml. For example the following observer is called when I saved a product.

 <events>
    <catalog_product_save_after>
        <observers>
            <testname_testmodule>
                <class>testname_testmodule/observer</class>
                <method>logUpdate</method>
                <type>singleton</type>
            </testname_testmodule>
        </observers>
    </catalog_product_save_after>
</events>

However, if I wrapped event within like below, then it doesn't work.

<adminhtml>
    <events>
        <catalog_product_save_after>
            <observers>
                <testname_testmodule>
                    <class>testname_testmodule/observer</class>
                    <method>logUpdate</method>
                    <type>singleton</type>
                </testname_testmodule>
            </observers>
        </catalog_product_save_after>
    </events>
</adminhtml>

Am I missing something here?

4
  • 2
    This should definitly work ... maybe there is a typo?
    – sv3n
    Jun 2 '17 at 23:48
  • I considered that too, but the observer method logUpdate got called when the events is put outside <adminhtml>, though.
    – frostshoxx
    Jun 3 '17 at 0:02
  • 1
    Can you post your (not working) config.xm?
    – sv3n
    Jun 3 '17 at 0:08
  • Here you go gist.github.com/frostshoxx/e3104e1c4465843326219112388c507b It doesn't work unless I take out <adminhtml> and </adminhtml> tags.
    – frostshoxx
    Jun 3 '17 at 0:14
3

In your Gist code this seems to be wrong nested...

<global>
     <adminhtml>

It should be ...

<global>
    ...
</global>
<frontend>
    ...
</frontend>
<adminhtml>
    ...
</adminhtml>
1

@sv3n just helped me rubberduck debugging the issue.

Turned out <adminhtml>...</adminhtml> is supposed to be outside <global>..</global>

1
  • Maybe you'll still accept my answer ;) GN8 :)
    – sv3n
    Jun 3 '17 at 0:20

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.