General warning — while ideally it should be supported, what you're trying to do isn't really meant to be done by a non-core Magento developer. The abstractions around routing are confusing, and possibly incomplete. It's relatively safe to introduce a new router object with a match
method, but (as you've seen) expecting it to behave in predicable ways with the system is asking Magento too much. Generally speaking, if you want a special URL in Magento, you use the rewrite system (either the rewrite models, or the configuration rewrites)
But that's not any fun.
So, the particular problem you're running into is a routername/frontName mismatch. Your router configuration is named customsearch
, but your frontName
is named lookfor
. This is a common problem when customizing system behavior, because most developers don't realize there's a difference between these two. That's because Magento core code always has them match each other. You see this this a lot in the various methods of replacing a controller action, and having the layout handles generated not match the layout handles Magento expects.
Looking at your specific problem, my guess (because it's hard to tell with the information provided) is your custom router class
`Namespace_Customsearch_Controller_Router`
in inheriting from the Mage_Core_Controller_Varien_Router_Abstract
class. If you look at the getFrontNameByRoute
method definition there
#File: app/code/core/Mage/Core/Controller/Varien/Router/Abstract.php
public function getFrontNameByRoute($routeName)
{
return $routeName;
}
You can see the method is essentially a placeholder. In the standard router
#File: app/code/core/Mage/Core/Controller/Varien/Router/Standard.php
public function getFrontNameByRoute($routeName)
{
if (isset($this->_routes[$routeName])) {
return $this->_routes[$routeName];
}
return false;
}
This method checks the configuration built up in the internal _routes
array, and returns the value it finds (which will be the frontName).
As I said, my guess is your router object inherits from the Abstract class, and doesn't have a custom getFrontNameByRoute
method. Your router object needs a similar/identical method, or needs to inherit from the standard router to have this functionality.
If you have a separate extension for import/export just add this in the install script of you extension:
$io = new Varien_Io_File();
$io->checkAndCreateFolder(Mage::getBaseDir('var').DS.'[module_name]'.DS.'import');
It will create the folder with 777
permissions.
Best Answer
The problem is that both the admin router and the frontend routers have the same node. Even if they have different
frontNames
. If you update your admin xml to the following:And then when you call
Mage::getUrl('testimonial/index/check/');
you will get the frontend url andMage::getUrl('testimonial_admin/index/check/');
will give you the admin urls.