Error Override the classes product and order

0

I have a problem in prestashop which I can not solve, and to see if someone can give me advice on how to solve it.

The error occurs when I try to override the product class to add a new custom attribute, in the banck end area it works correctly, however in the front office the description of the product stops coming out. To perform override I'm doing it in the following way for the product class:

class Product extends ProductCore
{
    /** @var float Additional cif cost product */
    public $cif_cost;

    public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null)
    {
        self::$definition['fields']['cif_cost'] = array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat');
        parent::__construct($id_product, $id_lang, $id_shop);
    }
}

For the controller:

class AdminProductsController extends AdminProductsControllerCore
{

    public function __construct()
    {

        parent::__construct();

        //Obtengo el objeto de contexto
        $context = Context::getContext();
        $profileAccess = $context->employee->id_profile;

        if (isset($context->employee) && $profileAccess == 1) 
        {
       //Add new field supplier reference in field list
       $this->fields_list['cif_cost'] = array(
           'title' => $this->l('cif cost'),
           'align' => 'left',
       );
     }
    }
}

There I create the Product class that inherits from ProductCore, I add the new custom field that in this case is cif_cost, and in the constructor, that same field I add it to the list of fields so that it can be shown in the backend view . The controller class if it's working well.

However, the product descriptions are no longer displayed in the front office, but when I delete this "Product" class from the override folder, it starts to work and if the product description is shown. In the order class when doing override something similar happens to me.

    
asked by Argez 31.08.2017 в 15:41
source

0 answers