Jump to content

Edit History

Florian644

Florian644

40 minutes ago, 4you.software said:

Yes, it must exist in the database,
yes, you can change the type to HTML.

self::$definition['fields']['my_custom_field'] = array('type' => self::TYPE_HTML, 'validate' => 'isCleanHtml');

 

It doesn't work.

Here's my override in ../override/classes : 

<?php 

class Cart extends CartCore

{

    public $my_custom_field;

    public function __construct($id_product = null){

        self::$definition['fields']['my_custom_field'] = array('type' => self::TYPE_STRING);

        parent::__construct();

    }

}

(I put back TYPE_STRING to first test with a simple word)

When I var_dump($cart->my_custom_field) after adding to cart, it works, I have the word in the my_custom_field.

I show you a screenshot of my database new field.

It stays NULL even when my var_dump() show me the field. Is the override not working ?

Capture d’écran 2022-09-22 à 10.40.17.png

 

 

EDIT: OK I just forgot to empty the cache..

Florian644

Florian644

11 minutes ago, 4you.software said:

Yes, it must exist in the database,
yes, you can change the type to HTML.

self::$definition['fields']['my_custom_field'] = array('type' => self::TYPE_HTML, 'validate' => 'isCleanHtml');

 

It doesn't work.

Here's my override in ../override/classes : 

<?php 

class Cart extends CartCore

{

    public $my_custom_field;

    public function __construct($id_product = null){

        self::$definition['fields']['my_custom_field'] = array('type' => self::TYPE_STRING);

        parent::__construct();

    }

}

(I put back TYPE_STRING to first test with a simple word)

When I var_dump($cart->my_custom_field) after adding to cart, it works, I have the word in the my_custom_field.

I show you a screenshot of my database new field.

It stays NULL even when my var_dump() show me the field. Is the override not working ?

Capture d’écran 2022-09-22 à 10.40.17.png

×
×
  • Create New...