williamespindola Posted May 8, 2014 Share Posted May 8, 2014 (edited) Hello, I'm override a Combination class and adding an extra field for that. To do this I Create a new class on override/classes/Combination.php and create my necessary methods like this: <?php class Combination extends CombinationCore { public $commission; public function __construct() { $this->addCommissionField(); } public function addCommissionField() { parent::$definition['fields']['commission'] = array( 'type' => self::TYPE_FLOAT, 'validate' => 'isGenericName', 'required' => false, 'size' => 10 ); } } For this time this work better. Another featured, is a field for that. But when I save the combination, this field is not save on database. I debug The Object model in this point: public function __construct($id = null, $id_lang = null, $id_shop = null) { if (!ObjectModel::$db) ObjectModel::$db = Db::getInstance(); $this->def = ObjectModel::getDefinition($this); // debut it p($this->def); $this->setDefinitionRetrocompatibility(); And the new field not exists on this point. Someone can help to understand? My prestashop is 1.6 Edited May 8, 2014 by williamespindola (see edit history) Link to comment Share on other sites More sharing options...
cochet Posted May 21, 2014 Share Posted May 21, 2014 Hello, I have the same problem... Have you found a solution? What code do you have inserted in the file "combinations.tpl" ? Thank's for your reply Link to comment Share on other sites More sharing options...
NemoPS Posted May 21, 2014 Share Posted May 21, 2014 You have to call parent::__construct() as well after adding your field. Also make sure you clean the class_index.php file after adding the override Link to comment Share on other sites More sharing options...
williamespindola Posted May 21, 2014 Author Share Posted May 21, 2014 Nemo1 in this case the problem is not this. To do what I needed is necessary overrate tree classes: Combination.php, Product.php, AdminProductsController.php and a lot of methods, a very sad job. Link to comment Share on other sites More sharing options...
NemoPS Posted May 22, 2014 Share Posted May 22, 2014 ...ok, so what is the problem supposed to be? I think I am didn't get your question Link to comment Share on other sites More sharing options...
williamespindola Posted May 22, 2014 Author Share Posted May 22, 2014 My latest replay is the solution. My initial problem was to create the extra field. Link to comment Share on other sites More sharing options...
Ibrahim.Da Posted December 4, 2014 Share Posted December 4, 2014 Nemo1 in this case the problem is not this. To do what I needed is necessary overrate tree classes: Combination.php, Product.php, AdminProductsController.php and a lot of methods, a very sad job. Hi Williame, Can you give me the solution please..? Link to comment Share on other sites More sharing options...
redactuk Posted January 9, 2015 Share Posted January 9, 2015 Hi williamespindola I amd be interested in this also. Would you kind sharing your override code files? Regards 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