ebonit Posted February 12, 2013 Share Posted February 12, 2013 Hello there, I am developing a new ps1.5 module and get kinda stuck with the following: i want a button in the backend that when pressing it calls an admin controller. I have set the controller in /modules/mymodule/controllers/admin/ajax.php class MymoduleAjaxModuleAdminController extends ModuleAdminController{ } i want to do this with an admincontroller because I don't want people to be able to call the ajax.php without admin rights. Now what I cannot figure out is what the link to this controller is. The frontcontroller is not a problem (Link::getModuleLink() ) but i can find no solution for the admin controller link. any help is most appreciated regards, Eric Link to comment Share on other sites More sharing options...
ebonit Posted February 13, 2013 Author Share Posted February 13, 2013 any ideas? I found more people are looking for the answer.. Link to comment Share on other sites More sharing options...
NemoPS Posted February 13, 2013 Share Posted February 13, 2013 Hi, the link to the controller is only valid if you place it in controllers/admin/nameofthefile.php Furthermore, you need to create a table for it, too. If it's just for permission, why not checking if the current employee ($this->context->employee) has a profile which meets your needs? Link to comment Share on other sites More sharing options...
ebonit Posted February 13, 2013 Author Share Posted February 13, 2013 Hi Nemo1, thanks for your reply. my problem with $this->context->employee is that when i call ajax.php and then try to get the employee, that it returns NULL when I place the ajax.php my module path instead of the /admin path. And that I don't want because I want to keep everything inside my module directory and definately not spread alover. So it is better in my opinion to use an admincontroller instead. Unless i miss something. I finally figured it out though. I was just using the wrong naming convention and thus not consequent enough in the end my controller is now: /modules/mymodule/controllers/admin/AdminMymodule.php then, in the backend under in the administration tab/menus I added the menu like this: the class name is important.note that it is exactly the controller-filename without the .php extension. and now I can call the link with $link->getAdminLink('AdminMymodule'). Reading the help pages of the prestashop backend can be very enlightning!! 1 Link to comment Share on other sites More sharing options...
thilip.xandy Posted February 8, 2014 Share Posted February 8, 2014 HI ebonit & Nemo1 : I got solution from your thread thanks a lot. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now