I am creating a back office module for Prestashop and searched everything except the best way to display the admin page is. Currently, I am using the renderview () method to display the contents of the view.tpl.
I would like to display a table with values and a new line. Can I make it just in view.tpl or better way? I have seen the Renderer () method, but did not know how it works so far.
I have the biggest question, how do I submit content to my controller in a specific method?
Module admin controller is for managing any type of record, which There is a list of Defauly pages for this controller, then you can edit each record individually, or you can see this whole data ( view ) for ObjectModel s. Are there.
If you want a settings page, then the best way to create a getContent () function for your module is to select Helper for this module configuration page is better than the helperform because it automatically launches the values. Define the form in this function and then add a to it (Tool :: isSubmit ('submit'. $ This- & gt; name)) - Submit button name Save your value to the Configuration table in the Configuration :: Set (...) .
Certainly it is possible to create some type of settings page in AdminController , but that does not mean for that. If you really want: found near HookCore.php and find the exec method. Then add error_log ($ hook_name) and all the hooks that you execute when you open / save / close a page / form. Maybe you will get your hook in this way better way parents You must inspect the class AdminControllerCore or even the controller code . They have special tasks often to override, where you should save your luggage. They are already a part of the execution process, but are empty.
EDIT: You should take a look at other AdminController classes, they are really simple; You only need to define certain properties to work:
public function __ composition () {// defined affiliate model $ the-> Table = 'eqa_category'; $ This- & gt; ClassName = 'EQACategory'; // Add some record actions $ this- & gt; AddRowAction ('edit'); $ This- & gt; AddRowAction ('deleted'); // defined list column $ this-> Fields_list = array ('id_eqa_category' = & gt; array ('title' = & gt; $ this- & gt; l ('id'), 'align =' gt; 'center'), 'title' = & Gt; array ('title' = & gt; $ this- & gt; l ('title'),));); // Define Fields to Define $ this- & gt; Fields_form = array ('input' = & gt; array (array ('name' = & gt; title ',' type '= & gt;' text ',' label '= & gt; $ this- & gt; L ('title'), 'desc' => (this '& gt; class title.'), 'Expected' => true, 'lang' = & gt; true), 'submit' '= & Gt; array (' title '= & gt; $ this- & gt; l (' save ');); // call original manufacturer creator: __ build ();} Transfer other people to the list and define the actual functions, which they present them:
Public function pervaded The form farm () {$ this-> fields_form = array (...); Return Parent :: ReaderForm ();} You do not really need to do anything The controller matches matches in your model, loads them, etc. and saves them.
Then, the best way to know about these controllers is by ook on other admin controllers. < / P>
No comments:
Post a Comment