Jump to content

Edit History

Inform-All

Inform-All

20 hours ago, Ikoshop said:

Prestashop 8.2, trying to add a controller to a module.

File, called AdminYourCustomController.php in the controllers/admin directory of the module. Defined as 

class AdminYourCustomController extends ModuleAdminController{...}

called from my module

            $this->context->smarty->assign([
                'my_url' => $this->context->link->getAdminLink('AdminYourCustomController', true, [], ['action' => 'synchronizeProducts']),
            ]);

module uninstalled, reinstalled, cache cleared, read/write rights to the controller file checked and the controller is not recognised when called either by getAdminLink or a direct call to the URL of the controller.

I've seen on some old posts that a tab needed to be added and initialised in the install() method. I tried this but it didn't do anything.

Does anyone have a working solution for adding a controller in 8.2 ?

Make sure the controller is in the correct folder.
It should be as the following:  modules/your-module/src/Controller/AdminYourCustomController.php
It looks like you forgot the /src/ folder.

And maybe you could also share your namespacing and autloader config?

Inform-All

Inform-All

20 hours ago, Ikoshop said:

Prestashop 8.2, trying to add a controller to a module.

File, called AdminYourCustomController.php in the controllers/admin directory of the module. Defined as 

class AdminYourCustomController extends ModuleAdminController{...}

called from my module

            $this->context->smarty->assign([
                'my_url' => $this->context->link->getAdminLink('AdminYourCustomController', true, [], ['action' => 'synchronizeProducts']),
            ]);

module uninstalled, reinstalled, cache cleared, read/write rights to the controller file checked and the controller is not recognised when called either by getAdminLink or a direct call to the URL of the controller.

I've seen on some old posts that a tab needed to be added and initialised in the install() method. I tried this but it didn't do anything.

Does anyone have a working solution for adding a controller in 8.2 ?

Make sure the controller is in the correct folder.
It should be as the following:  modules/your-module/src/Controller/AdminYourCustomController.php
It looks like you forgot the /src/ folder.

×
×
  • Create New...