{"id":554,"date":"2019-03-20T06:56:29","date_gmt":"2019-03-20T06:56:29","guid":{"rendered":"http:\/\/angelwings.net\/blog\/?p=554"},"modified":"2019-03-20T06:56:29","modified_gmt":"2019-03-20T06:56:29","slug":"prestashop-how-to-create-admin-controller-to-add-link-of-module-to-backoffice-menu","status":"publish","type":"post","link":"https:\/\/angelwings.net\/blog\/prestashop-how-to-create-admin-controller-to-add-link-of-module-to-backoffice-menu\/","title":{"rendered":"Prestashop: How to create admin controller to add link of module to backoffice menu"},"content":{"rendered":"<p>Troubleshoot: PrestaShop Admin Module Controller Not Found<\/p>\n<p>https:\/\/stackoverflow.com\/questions\/37984270\/prestashop-admin-module-controller-not-found<\/p>\n<p>Whenever this happened to me was because I hadn&#8217;t created a menu entry for my new controller.<\/p>\n<p>What I&#8217;d advise you to do is to go to Administration &gt; Menus then created a new entry.<\/p>\n<p>Fill in the form like this :<\/p>\n<p>Name: Productarticle<br \/>\nClass: AdminProductarticle<br \/>\nModule: productarticle (if that&#8217;s the name you gave your module)<br \/>\nActive: NO (this way you don&#8217;t have to have a menu entry that&#8217;s gonna be useless to you)<\/p>\n<p>On top of that you should have something like this in your __construct()<\/p>\n<p>E.g. filename modules\/module_name\/controllers\/admin\/AdminProductarticleController.php<\/p>\n<p>class AdminProductarticleController extends ModuleAdminController<br \/>\n{<br \/>\npublic function __construct()<br \/>\n{<br \/>\n$this-&gt;module = &#8216;productarticle&#8217;; \/\/refers to your module&#8217;s $this-&gt;name = &#8216;productarticle&#8217;;<br \/>\n$this-&gt;bootstrap = true;<br \/>\n\/\/$this-&gt;context = Context::getContext(); \/\/not necessary<br \/>\n\/\/The following 2 lines are useful if you have to link your controller to a certain table for data grids<br \/>\n$this-&gt;table = &#8216;contribution&#8217;;<br \/>\n$this-&gt;className = &#8216;Contribution&#8217;;<\/p>\n<p>parent::__construct();<\/p>\n<p>Tools::redirectAdmin(Context::getContext()-&gt;link-&gt;getAdminLink(&#8216;AdminModules&#8217;, true) . &#8216;&amp;configure=nameofmodule&amp;tab_module=front_office_features&amp;module_name=nameofmodule&#8217;);<br \/>\n}<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Troubleshoot: PrestaShop Admin Module Controller Not Found https:\/\/stackoverflow.com\/questions\/37984270\/prestashop-admin-module-controller-not-found Whenever this happened to me was because I hadn&#8217;t created a menu entry for my new controller. What I&#8217;d advise you to do is to go to Administration &gt; Menus then created a new entry. Fill in the form like this : Name: Productarticle Class: AdminProductarticle Module: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[105],"class_list":["post-554","post","type-post","status-publish","format-standard","hentry","category-troubleshoot","tag-prestashop-1-6"],"_links":{"self":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/posts\/554","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/comments?post=554"}],"version-history":[{"count":0,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/posts\/554\/revisions"}],"wp:attachment":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/media?parent=554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/categories?post=554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/tags?post=554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}