Eg I have a block
that is on the page
to edit the purchase order, both the editing page
of the order as the block
passes through the event sales_order_load_after when obeserver the event can not know what they spent for the event, if it was page
or block
.
How to know who called or went by event?
I have a fraud clearsales module, this module is on the order page to check I just click on the button analyze, when I click on it, it passes the event "sales_order_load_after" need to know who is passing by the magnitude of the event is ClearSale or page, I know that the two are going through the event as a test print.
config.xml:
<adminhtml>
<events>
<sales_order_load_after>
<observers>
<ceicom_managesale>
<class>ceicom_managesale/observer</class>
<method>someMethod</method>
</ceicom_managesale>
</observers>
</sales_order_load_after>
</events>
</adminhtml>
Observer:
<?php
class Ceicom_ManageSale_Model_Observer
{
public function someMethod($observer)
{
echo("teste");
}
}
Best Answer
Events like
*_load_after
have no information where or by whom they were called.But using request object you can get area, mudule, controller and action name and check them as you want.
But you will have problem if some model (in your case
sales_order
) can be called twice on the same page.