I've created a module for Prestashop 1.7 in order to add a new field in the Admin Product page. Due to the lack of proper documentation, I want to ask the proper way to add my custom field, a select. I want to get saved and updated on product save.
I use the code below to add a tpl containing a form
public function hookDisplayAdminProductsExtra($params) {
$this->smarty;
$available_items = $this->getAvailableBadges();
$id_product = Tools::getValue('id_product');
$this->context->smarty->assign('items_number', $available_items);
return $this->display(__FILE__, '/views/templates/admin/admin_products.tpl');
}
The problem is that I don't know how to make to override the Product.php Class in order to have my $field and how to create the form element for the tpl.
The form I want to create I something like that
<select name="" id="">
{foreach from=$items_number item=option}
<option value="{$option}">
{$option}
</option>
{/foreach}
</select>
Sorry for the lack of information, but I find the new way of creating modules very confusing. Thanks in advance
src
folder. – Jannery