Toinou_74 Posted January 22, 2016 Share Posted January 22, 2016 Hi, I try to Add an extrafield in customer, in my case, associate employee to customer, all work in followin code, but id_employee is not update in Db. <?php class Customer extends CustomerCore { public $id_employee; public function __construct($id = null) { Customer::$definition['fields']['id_employee'] = array('type' => self::TYPE_STRING, 'validate' => 'isString'); parent::__construct($id); } } <?php class AdminCustomersController extends AdminCustomersControllerCore { public function __construct() { parent::__construct(); $this->fields_list['id_employee'] = array('title' => $this->l('id_employee')); } public function renderForm() { $this->fields_form_override = array( array( 'type' => 'text', 'label' => $this->l('Commercial'),'name' => 'id_employee', 'col' => '4' ) ); return parent::renderForm(); } Could you give me hand.. Thanks so much. Link to comment Share on other sites More sharing options...
Toinou_74 Posted January 22, 2016 Author Share Posted January 22, 2016 Hi, fresh news, when i add 'id_employee' in original Customer.php (override) that works well, so is not my controller but my classes Customer.php is wrong $this->fields_list = array_merge($this->fields_list, array( 'total_spent' => array( 'title' => $this->l('Sales'), 'type' => 'price', 'search' => false, 'havingFilter' => true, 'align' => 'text-right', 'badge_success' => true [ ...] 'id_employee' => array( 'title' => $this->l('employee'), 'width' => 70, 'align' => 'center', 'type' => 'text', 'orderby' => true ) )); if someone can help me... Link to comment Share on other sites More sharing options...
NemoPS Posted January 23, 2016 Share Posted January 23, 2016 You mean your customer class is not accepting the other field? Maybe you need to clear the class index Link to comment Share on other sites More sharing options...
Toinou_74 Posted January 23, 2016 Author Share Posted January 23, 2016 (edited) Yes i clear cache... when i override like that: <?php class Customer extends CustomerCore { public $id_employee; public function __construct($id = null) { Customer::$definition['fields']['id_employee'] = array('type' => self::TYPE_STRING, 'validate' => 'isString'); parent::__construct($id); } } id_employee is not registred in db, and when i override all the Customer Class and i add Id_employee, that works, strange... Edited January 23, 2016 by Toinou_74 (see edit history) Link to comment Share on other sites More sharing options...
Toinou_74 Posted January 25, 2016 Author Share Posted January 25, 2016 Good, That seem i forgot ?> at the end of my file... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now