Jump to content

Write admin controller for module


o0ozinkyo0o

Recommended Posts

Hi all, 

I'm writing a module in prestashop, and i want this module contain front controller and admin controller too because i have manage this module with account admin. 
In the case create controller in front folder, i create file MyModuleFrontController.php in mymodule/controller/front and used path is mysite.com/index.php?fc=module&module=mymodule&controller=MyModuleFrontController and ofcouse it's work good.

But when i create controller in admin folder, and i do same above so it's not work, I don't find any way to run my admin controller of module. 

Can You help me. Thanks all and Have a nice day! 

Link to comment
Share on other sites

when you create front controller for your module you use this:

class MyModuleModuleFrontController extends ModuleFrontController{ 

and when you create admin controller you use this:

  class MyModuleController extends ModuleAdminController {

frontcontroller will not work with "extends ModuleAdminController"

 

so it's not possible to use adminController in Front

Link to comment
Share on other sites

Hi Vekia,

I found this link http://www.programmingtunes.com/prestashop-1-5-features-for-developers-part-1-modules/ talk about create admin module for module API, this is thing i need.

"Now lets consider we want to create a controller for the admin section. Lets say we want the controller to be AdminFaqController, , so place a file in the /faq/controllers/admin/ and name is AdminFaqController.php . So the class code will be like 

class AdminFaqController extends ModuleAdminController
 
{
 
......
 
.....
 
}"

I go this step but i don't know how to path this controller in URL...

I try mysite/index.php?fc=module&module=ptsmapi&controller=AdminFaq but it's not work... Can you check it to help me. Thanks so much.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...