Reputation: 1528
In a Prestashop 1.6 store, how can I add a new admin/backoffice menu entry for an existing/installed module (for example, bankwire or blocktopmenu modules)?
Upvotes: 0
Views: 1488
Reputation: 314
If you try to add the item menu in "Administration" -> "Menus" with the class of the module and the name, probably you get an error that says that it's impossible to find the controller. Then you need to create this controller in the module.
You need to create a file in /moudles/[name-of-the-module]/controllers/admin/ with the name of the principal class.
For example, to the blocklayered module you need to create a file called "blockLayered.php", and you need to put this code inside the file:
<?php
class BlockLayeredController extends AdminController {
public function __construct() {
$module_name = "blocklayered";
Tools::redirectAdmin('index.php?controller=AdminModules&configure=' . $module_name . '&token=' . Tools::getAdminTokenLite('AdminModules'));
}
}
Explanation:
Class name: Name of the principal class of the module followed by "Controller".
$module_name: Name of the directory of the module.
Then, you go to "Administration" -> "Menus" and create a new item with this data:
"Class: BlockLayered" -> Principal class.
"Module: blocklayered" -> Name of the directory.
I hope it has been helpful for you.
Upvotes: 2