Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement backoffice controller

Tags:

prestashop

after lot of google searches and going through prestashop's official documentation over and over again, I still couldn't find an example of backoffice controller. I even looked into the modules folder of prestashop's installation, but couldn't find any.

I need to implement 3 different back-office pages, each served by its own controller and view.

Can anyone provide me any hint, or even one working example...Just hello world is more than enough.

Thanks in advance...

like image 984
Nitin Bansal Avatar asked Sep 30 '13 06:09

Nitin Bansal


1 Answers

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

  • this is use full site really clear:
  • http://doc.prestashop.com/display/PS15/Using+helpers+to+overload+a+back-office+template
  • http://presthemes.com/prestashop-news/modules-classes-and-controller-override-by-julien-breux-4.html
  • http://doc.prestashop.com/display/PS15/Diving+into+PrestaShop+Core+development
  • http://www.prestashop.com/forums/topic/270177-solved-making-own-objectmodel-class-doesnt-work/
  • http://doc.prestashop.com/display/PS15/New+Developers+Features+In+PrestaShop+1.5
  • http://blog.belvg.com/how-to-implement-a-controller.html

best regards

like image 185
moein kh Avatar answered Jan 01 '23 11:01

moein kh