Question

how to create a new page in prestashop admin panel? I tried using creating a new admin controller file and in that set the template path and i created a menu using admin panel and there i mentioned the controller class name for that menu. when i try to open that menu it always shows that controller not found. can anyone help me, how to create a new page in prestashop admin panel? am using PS 1.5 version.

 <?php
class AdminPageController extends AdminController {
public function __construct()
{
    parent::__construct();
}

public function initContent()
{
    parent::initContent();
 $this->setTemplate(_PS_THEME_DIR_.'mypage.tpl');
}
}
Was it helpful?

Solution

create controllers/admin/AdminPageController.php with the follwing content:

    class AdminPageController extends AdminController
    {
        public function initContent()
        {
            parent::initContent();
            $smarty = $this->context->smarty;

            $smarty->assign('test', 'test1');

        }
    }

Delete: /cache/class_index.php

Create: admin\themes\default\template\controllers\page\content.tpl

zzz{$test}zzz

At BackOffice -> Administration -> Menus -> [Add New]:

Name: Page
Class: AdminPage
Parent: Catalog

Click the [Save] button and the menu item should appear at the "Catalog" menu.

OTHER TIPS

it will be like this

class AdminPageController extends AdminController
{
    public function __construct()    
    {    
         parent::__construct();        
    }

    public function initContent()    
    {
        parent::initContent();       
        $this->setTemplate(_PS_THEME_DIR_.'mypage.tpl');   
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top