Reputation: 4549
i am trying to catch an event that works in frontend scope only , but the event i am observing for this purpose
"controller_front_init_routers"
only works under global scope not the frontend. i have tried to find one by printing (inside Mage.php dispatchEvent method) each dispatched event name when page loads but none of those events worked under the frontend scope. i need an event that get activated when the frontend page loads. please advise.
thanks,
Upvotes: 1
Views: 1422
Reputation: 2384
To have an event more modulable and more efficient for your task I suggest to use this event :
controller_action_layout_generate_blocks_after
In your function you can do something more precise thanks to :
public function yourEvent($event) {
$controller = $event->getAction();
$action = $event->getFullActionName();
if ($action == 'catalog_product_view') //DO SOMETHING SPECIFIC TO PRODUCT PAGE
elseif ($action == 'catalog_category_view') //DO SOMETHING SPECIFIC TO CATEGORY
...
Regards,
Upvotes: 2