Jump to content

How to create Back-End custom tabs in PrestaShop™ 1.4.0.17


Recommended Posts

I already found it. At the back-end area. Employees->Tabs.

Here is what i am going to develop.
I have a new tab named "Labels" under the Catalog Tab, by adding my AdminLabels. The problem is when i go to Catalog->Labels and click "Add new". The form is not displayed.

Is there anyone who can help? thanx.


Database table: ps_label

Fields Type
id_label int(10)
name varchar(255)
color varchar(255)
description varchar(255)
active tinyint(1)

my Label.php code


class LabelCore extends ObjectModel
{
   public         $id;

   /** @var integer label id */
   public         $id_label;

   /** @var string name */
   public         $name;

   /** @var string text */
   public         $description;

   /** @var string color */
   public         $color;

   /** @var boolean Status */
   public         $active = 1;

   protected     $fieldsRequired = array('name', 'color', 'active');
   protected     $fieldsSize = array('name' => 32, 'text' => 32, 'color' => 32);
   protected     $fieldsValidate = array('name' => 'isCatalogName');
   protected     $fieldsSizeLang = array('name' => 32);
    protected     $fieldsValidateLang = array('description' => 'isGenericName');    


   protected     $table = 'label';
   protected     $identifier = 'id_label';

   protected    $webserviceParameters = array(
       'fields' => array(
           'active' => array('sqlId' => 'active'),
           'name' => array('sqlId' => 'name')
       ),
   );


   public    function getFields()
   {
        parent::validateFields();

       $fields['id_label'] = (int)($this->id);
       $fields['name'] = pSQL($this->name);
       $fields['color'] = pSQL($this->color);
       $fields['active'] = (int)$this->active;

       return $fields;
   }
   public function getFields()
   {
       parent::validateFields();
       if (isset($this->id))
           $fields['id_supplier'] = (int)($this->id);
       $fields['name'] = pSQL($this->name);
       $fields['date_add'] = pSQL($this->date_add);
       $fields['date_upd'] = pSQL($this->date_upd);
       $fields['active'] = (int)($this->active);
       return $fields;
   }



}

AdminLabels.php

Link to comment
Share on other sites

×
×
  • Create New...