Hi Jeremiezip,
Thank you for your comment, it was very useful.
First of all, I tried overriding product class and it worked. I declare a new variable and it works properly.
But when I try to visualize in the backend the new field I got some issues: I add the declared variable in the overriden file in the getFormData() method from the AdminModelAdapter.php file and I obtain it completely empty. It seems like the variable wasn’t declared. However, if I declare it in the product class it finally works. May it be because AdminModelAdapter.php file just loads parent class?
File src/PrestaShopBundle/Model/Product/AdminModelAdapter.php (onlye declare prent class)
public function __construct(
\ProductCore $product,
....
File override\classes\Product.php
class Product extends ProductCore
{
public $tablas_nutricionales;
public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null)
{
parent::$definition['fields']['tablas_nutricionales'] = array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml');
parent::__construct($id_product, $full, $id_lang, $id_shop);
}
}
In another hand, it would be really useful to override a budle for not losing information when updating the shop. Did you get how to do it?
Thank you.
Best regards,