Skip to main content
deleted 23 characters in body
Source Link

Another way to change router load order is through controller_front_init_beforecontroller_front_init_before event because is invoked right before any router gets addedis invoked right before any router gets added.

Soso in confix.xml you canapp\code\{codePool}\{Namespace}\{Module}\etc\config.xml add a listener for that event: <controller_front_init_before>
<Namespace_Module>
Namespace_Module_Controller_Router initControllerRouters </Namespace_Module>
</controller_front_init_before>

<controller_front_init_before>
  <observers>
    <Namespace_Module>
      <class>Namespace_Module_Controller_Router</class>
      <method>initControllerRouters</method>
    </Namespace_Module>
  </observers>
</controller_front_init_before>

(I've used the same Router Class so $this object represents the router)

Then the initControllerRouters function in that class should be: public function initControllerRouters(Varien_Event_Observer $observer) { $front = $observer->getEvent()->getFront(); $front->addRouter('Namespace_Module', $this); } app/code/local/Namespace/Module/Controller/Router.php

public function initControllerRouters(Varien_Event_Observer $observer)
{
  $front = $observer->getEvent()->getFront();
  $front->addRouter('Namespace_Module', $this);
}

(change $this object for your router in case your event class is in Model/Observer or somewhere else than the router class itself)

Another way to change router load order is through controller_front_init_before event because is invoked right before any router gets added.

So in confix.xml you can a listener for that event: <controller_front_init_before>
<Namespace_Module>
Namespace_Module_Controller_Router initControllerRouters </Namespace_Module>
</controller_front_init_before> (I've used the same Router Class so $this object represents the router)

Then the initControllerRouters function in that class should be: public function initControllerRouters(Varien_Event_Observer $observer) { $front = $observer->getEvent()->getFront(); $front->addRouter('Namespace_Module', $this); } (change $this object for your router in case your event class is in Model/Observer or somewhere else than the router class itself)

Another way to change router load order is through controller_front_init_before event because is invoked right before any router gets added.

so in app\code\{codePool}\{Namespace}\{Module}\etc\config.xml add a listener for that event:

<controller_front_init_before>
  <observers>
    <Namespace_Module>
      <class>Namespace_Module_Controller_Router</class>
      <method>initControllerRouters</method>
    </Namespace_Module>
  </observers>
</controller_front_init_before>

(I've used the same Router Class so $this object represents the router)

Then in app/code/local/Namespace/Module/Controller/Router.php

public function initControllerRouters(Varien_Event_Observer $observer)
{
  $front = $observer->getEvent()->getFront();
  $front->addRouter('Namespace_Module', $this);
}

(change $this object for your router in case your event class is in Model/Observer or somewhere else than the router class itself)

Source Link

Another way to change router load order is through controller_front_init_before event because is invoked right before any router gets added.

So in confix.xml you can a listener for that event: <controller_front_init_before>
<Namespace_Module>
Namespace_Module_Controller_Router initControllerRouters </Namespace_Module>
</controller_front_init_before> (I've used the same Router Class so $this object represents the router)

Then the initControllerRouters function in that class should be: public function initControllerRouters(Varien_Event_Observer $observer) { $front = $observer->getEvent()->getFront(); $front->addRouter('Namespace_Module', $this); } (change $this object for your router in case your event class is in Model/Observer or somewhere else than the router class itself)