Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prestashop - Controller Not Found in admin

I'm developing a simple module, but I'm unable to successfully make the admin controller work.

This is the directory structure for my module: enter image description here

And this is the AdminPaymentsController.php file:

<?php

class AdminPaymentsController extends  ModuleAdminController {

}

I created a tab on my module installation using this function:

public function installTab($parent, $class_name, $name) {
    $tab = new Tab();
    $tab->id_parent = (int)Tab::getIdFromClassName($parent);
    $tab->name = array();

    foreach (Language::getLanguages(true) as $lang) {
        $tab->name[$lang['id_lang']]  = $name;
    }

    $tab->class_name = $class_name;
    $this->module = $this->name;
    $tab->active = 1;

    return $tab->add();
}

And calling it like this:

    if (!$this->installTab('AdminCatalog', 'AdminPayments', 'Payments Management')) return false;

The tab seems to be installed correctly:

enter image description here

But when I open it, it show an error message:

enter image description here

http://dev.prestashop.com/admin123asdf/index.php?controller=AdminPayments&token=52dbfa9a1a6c3935fd3cbb1276bcbedb

Why is this happening? How can I debug this?

like image 553
danielrvt Avatar asked Jun 10 '26 13:06

danielrvt


1 Answers

Your controller file name should be AdminPayments.php.

And change this line: $this->module = $this->name; for this one: $tab->module = $this->name;

Good luck.

like image 124
PrestaAlba Avatar answered Jun 12 '26 10:06

PrestaAlba



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!