Prestashop add new item in Admin Panel Sidebar Menu
Prestashop add new item in Admin Panel Sidebar Menu
I have small problem on create a custom item inside Admin Panel Sidebar Menu.
Prestashop Version: 1.7.4.2
This is the currently sidebar menu in my prestashop:
I would like to add new item that links to external website. As I have researched I found out that, this need to be a controller
in order to be placed inside there as shown here.
controller
As example shown above, they need to create a new controller for that specific purpose. What I need is a hardcoded fixed external url address, so in the end this would be the result:
What I did is put paint inside the jpg that I had screenshot to illustrate my point. And when they clicked the text, it will redirect to external page (not controller, etc)
like http://www.google.com.
external page (not controller, etc)
Is there a Form that I can hardcoded specific url
and show it so that user can redirect when needed.
hardcoded specific url
Sorry as this is only concept no php code provided, as I didn't know how to accomplish it.
Thank You.
2 Answers
2
All items that are shown in the sidebar menu have to be an AdminController class
and added in the tab
of PrestaShop.
AdminController class
tab
Then, in your AdminController, you make the redirection:
<?php
class AdminMyModuleRedirectController extends ModuleAdminController
public function init()
Tools::redirect('https://www.google.com');
You still can manually modify the template that shows the sidebar menu, but it's not recommended.
Good luck
You have two simple ways that don't needed to deep scan PrestaShop codes.
1- On your module => admin controller:
public function init()
Tools::redirect('https://google.com');
2- on your module main php file:
-- add "back office header" hook
-- load jQuery file in this hook
-- change URL of your controller by jquery
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Hi, thanks for the response, where should i put the php file that only contains that code? I have tried put it in /classes folder. Where is the sidebar menu template that I can add new row
– liejoes1
Sep 5 '18 at 7:52