5

经过大量谷歌搜索并一遍又一遍地浏览 prestashop 的官方文档,我仍然找不到后台控制器的示例。我什至查看了 prestashop 安装的模块文件夹,但找不到。

我需要实现 3 个不同的后台页面,每个页面都由自己的控制器和视图提供服务。

任何人都可以给我任何提示,甚至是一个工作示例……只要你好世界就足够了。

提前致谢...

4

1 回答 1

7

notice:i write this article for prestashop1.5 and i don't check it for prestashop 1.6.perhaps it is works for 1.6 too. You should know every thing in this way have special structure.
step 1: Create a folder in your module folder call that 'controllers' (notice:this name is static)
step 2: Create a folder in controller folder call that 'admin' (notice:this name is static too)
step 3: Create a php class file call that AdminMyclassnameController (notice:in this name Admin at first and controller at last is the key word and thay are static but Myclassname is dynamic .attention to first words all of should be uppercase A for Admin, M for Mclass,... )
step 4: Then you should write your class in AdminMyclassnameController and this class should extent with AdminController or AdminControllerCore. for know how does it class work you can search about helper forums in internet.
step 5: When you create the class you want a tab to show that controller notice:when act to step 1,2,3,4 this controller take an automatic URL for access to this URL you should create a tab.in yourmodule.php in install() you should add this codes

        $tab = new Tab();
        $tab->class_name = 'AdminTest';
        $tab->module = 'test';
        $tab->id_parent = 9;
        $tab->position = 11;

then you can see the tab in admin office that redirect to your controller. i am tired to continue ... but if you want more send a message and i continue this article

best regards

于 2013-11-28T18:44:46.563 回答