How to create a new page in prestashop admin panel?

Manik picture Manik · Oct 21, 2013 · Viewed 19k times · Source

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');
}
}

Answer

PrestaShopDeveloper picture PrestaShopDeveloper · Oct 21, 2013

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.