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:



Before Changes



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:



After Changes



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





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




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.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)