add a field in edit product page of prestashop admin

后端 未结 5 1543
旧时难觅i
旧时难觅i 2020-12-30 18:03

I have add a field \"mystock\" in product table of prestashop database. Now i want to display/edit this filed in edit product page. It also be update when product will updat

5条回答
  •  温柔的废话
    2020-12-30 18:40

    The best comprehensive solution in four steps is:

    1) add a file Product.php to \override\classes containing:

     ObjectModel::TYPE_INT, 'validate' => 'isUnsignedInt');
    class Product extends ProductCore 
    { 
       public $mystock; 
    } 
    

    2) open adminFolder/themes/default/template/controllers/products/informations.tpl and place your field with the correct name and id in the appropriate place.

    3) delete file cache/class_index.php

    4) add your field to the DB, for number field:

    ALTER TABLE ps_product ADD mystock INT NOT NULL;
    

    [Thanks to Bell418 for 1) and 4) and to Altaf Hussain for 2)]

提交回复
热议问题