Jump to content

How to add new tab in back office that link to an action in the controller


Recommended Posts

Hi Guys,

Since Prestashop 1.7.5 allow the usage of Symfony controllers and routing : https://devdocs.prestashop.com/1.7/modules/concepts/controllers/admin-controllers/.

My problem now is to link the controller action to a tab in the back office, unfortunately the Prestashop  docs does not really help in this area:   https://devdocs.prestashop.com/1.7/modules/concepts/controllers/admin-controllers/tabs/.

If any one has crossed this problem and has any kind of a solution i would really appreciate the help.

Share this post


Link to post
Share on other sites
  • 2 months later...
17 hours ago, Napolar said:

✌️ @ahmed_Rabii same problem... Did you find any solution ?

i just used the Prestashop tabs with redirect:

Prestashop Controller: mymodule\controllers\admin\AdminMyModuleConfigController.php

use PrestaShop\PrestaShop\Adapter\SymfonyContainer;

class AdminMyModuleConfigController extends ModuleAdminController
{
    public function init()
    {
        $sfContainer = SymfonyContainer::getInstance();
        if (!is_null($sfContainer)) {
            $sfRouter = $sfContainer->get('router');
            Tools::redirectAdmin($sfRouter->generate('edit_mymodule_config'));
        }
    }
}

Module Class: mymodule\mymodule.php

public $tabs = array(
        array(
            'name' => 'Configure',
            'class_name' => 'AdminMyModuleConfig',
            'visible' => true,
            'parent_class_name' => 'AdminMyModuleParent',
        )
    );

 

  • Thanks 1

Share this post


Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More