to add a field to your backoffice, you need to override the AdminCategoriesController, exactly the renderForm () function and add a new field to it. To do this, create a new AdminCategoriesController file under / override / controller / admin /, then declare the extension of the source controller in it and copy it to the renderForm function (completely) from the kernel source file.
class AdminCategoriesController extends AdminCategoriesControllerCore { public function renderForm() { ... } }
now we have to edit it in a couple, first we need to add a new field to the description, so in the declaration 'name' => 'description' inside your renderForm (), you will see that this is a list of the array, and each of them describes a form field . Immediately after the description array adds a new field:
array( 'type' => 'textarea', 'label' => $this->l('Description long'), 'name' => 'description_long', 'lang' => true, 'autoload_rte' => true, 'hint' => $this->l('Invalid characters:').' <>;=#{}', ),
this ad asks Prestashop to create a new field with the following specification:
By declaring the field in this way, we allow pretashop to process it in the same way as any other class property, so our part will not need any work to add and update the field in the database.
Now there is one more thing worth doing in our renderForm () function, now the last instruction is parent::renderForm() , which in the original class called AdminController to ask it to make forms, but right now, as we extend the class, the command our parent calls AdminCategoriesControllerCore, overriding all of our work and displaying the default form. To avoid this change, from parent::renderForm to AdminController::renderForm() , specifying a call to the class of interest.