Netismine

Tips & Tricks

Simulate / fake a module

I found that I needed to trick Magento into thinking it’s using one of it’s own core modules instead of a custom one, when I needed to retain certain URL-s instead of using my own module’s controller. So, to hack Magento so that it returns it’s own core module with

$this->getUrl('*/*/*');
select all

you shoud utilize this code on the controller level ideally:

$this->getRequest()->setRouteName('catalog');
select all

Where “catalog” is the core module you want to fake.

No comments yet

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">