Algirdas Posted April 12, 2015 Share Posted April 12, 2015 Hello, I'm trying to override faeture.php class and add custom field to it. I found tutorial how to add custom field to product class, but difference is that feature class don't have __constructor method and I don't know how to add custom field.Maybe someone could give me example how to do that?Also, when prestashop updates mysql database by overrided class? Thank you Link to comment Share on other sites More sharing options...
cristic Posted April 13, 2015 Share Posted April 13, 2015 (edited) The simplest example for your override: /* Place this in /override/classes/Feature.php */ Feature::$definition['fields']['custom'] = array('type' => ObjectModelCore::TYPE_STRING, 'size' => 100); class Feature extends FeatureCore { public $custom; } Similar, for a feature value, which depends on different languages, you can see bellow: /* Place this in /override/classes/FeatureValue.php */ FeatureValue::$definition['fields']['custom'] = array('type' => ObjectModelCore::TYPE_STRING, 'lang' = true, 'size' => 100); class FeatureValue extends FeatureValueCore { public $custom; } Don't forget to delete /cache/class_index.php file for changes to take effect. Edited April 13, 2015 by cristic (see edit history) 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