mojtaba6485 Posted August 26, 2015 Share Posted August 26, 2015 Hi everybody Excuse me for my bad english. I add two fields multi_value and id_categry to feature table and feature class and feature controller. and put related files to override folder. When I add new feature this added fields work and save to table but when I want edit them new fields do not chane in table. Please help me. Thanks in advance. Feature Class class Feature extends FeatureCore { public $id_category; public $multi_value; /** * @see ObjectModel::$definition */ public static $definition = array( 'table' => 'feature', 'primary' => 'id_feature', 'multilang' => true, 'fields' => array( 'position' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), // Category ID 'id_category' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'multi_value' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), // Lang fields 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128), ) ); } AdminFeatureController class AdminFeaturesController extends AdminFeaturesControllerCore { public function __construct() { $this->table = 'feature'; $this->className = 'Feature'; $this->list_id = 'feature'; $this->identifier = 'id_feature'; $this->lang = true; $this->fields_list = array( 'id_feature' => array( 'title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs' ), 'name' => array( 'title' => $this->l('Name'), 'width' => 'auto', 'filter_key' => 'b!name' ), 'value' => array( 'title' => $this->l('Values'), 'orderby' => false, 'search' => false, 'align' => 'center', 'class' => 'fixed-width-xs' ), 'id_category' => array( 'title' => $this->l('Category ID'), 'align' => 'center', 'class' => 'fixed-width-xs' ), 'multi_value' => array( 'title' => $this->l('Multiple Value'), 'align' => 'center', 'class' => 'fixed-width-xs' ), 'position' => array( 'title' => $this->l('Position'), 'filter_key' => 'a!position', 'align' => 'center', 'class' => 'fixed-width-xs', 'position' => 'position' ) ); $this->bulk_actions = array( 'delete' => array( 'text' => $this->l('Delete selected'), 'icon' => 'icon-trash', 'confirm' => $this->l('Delete selected items?') ) ); AdminController::__construct(); //parent::__construct(); } /** * AdminController::renderForm() override * @see AdminController::renderForm() */ public function renderForm() { $obj = $this->loadObject(true); $selected_categories = array(isset($obj->id_category) ? (int)$obj->id_category : (int)Category::getRootCategory()->id); $this->toolbar_title = $this->l('Add a new feature'); $this->fields_form = array( 'legend' => array( 'title' => $this->l('Feature'), 'icon' => 'icon-info-sign' ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'lang' => true, 'size' => 33, 'hint' => $this->l('Invalid characters:').' <>;=#{}', 'required' => true ), array( 'type' => 'categories', 'label' => $this->l('Associate category'), 'name' => 'id_category', 'tree' => array( 'id' => 'categories-tree', 'selected_categories' => $selected_categories, //'disabled_categories' => null, 'required' => true ) ), array( 'type' => 'switch', 'label' => $this->l('Multiple Value'), 'name' => 'multi_value', 'required' => true, 'is_bool' => true, 'values' => array( array( 'id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled') ), array( 'id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled') ) ) ) ) ); if (Shop::isFeatureActive()) { $this->fields_form['input'][] = array( 'type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso', ); } $this->fields_form['submit'] = array( 'title' => $this->l('Save'), ); return AdminController::renderForm(); } } Link to comment Share on other sites More sharing options...
vekia Posted August 27, 2015 Share Posted August 27, 2015 you modified something else in this controller ? 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