Jump to content

Adding a field in catalog page back office


Recommended Posts

exmaple of adding field: myNewField

add new field to ps_category table myNewField Varchar(50) NULL

in classes/Category.hpp add MyNewFIeld to class definition

    /** @var string our new field*/
    public $myNewField;

and in objectModel::definition:
 

'fields' => array(
            'nleft' =>                array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
            'myNewField' =>           array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'),

then in category controller: controllers/adminCategoriesController.php to $this->fields_list add new array element:
 

        $this->fields_list = array(
            'id_category' => array(
                'title' => $this->l('ID'),
                'align' => 'center',
                'class' => 'fixed-width-xs'
            ),
            'name' => array(
                'title' => $this->l('Name')
            ),
            'myNewField' => array(
            'title' => $this->l('New Field')
            ),

 

Link to comment
Share on other sites

×
×
  • Create New...