在 prestashop 管理员的编辑产品页面中添加一个字段 [英] add a field in edit product page of prestashop admin

查看:36
本文介绍了在 prestashop 管理员的编辑产品页面中添加一个字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 prestashop 数据库的产品表中添加了一个字段mystock".现在我想在编辑产品页面中显示/编辑这个文件.产品更新时也会更新.

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 update.

推荐答案

这个过程需要一些步骤来解决.下面我列出了它们.

This process require some work around in steps. Below i have listed them.

1) 打开 classes/Product.php.将public $mystock;放在类属性列表中,在类启动后就可以看到了.

1) Open classes/Product.php. Place public $mystock; in the class properties list, which you can see after the class is started.

2) 在文件的下方,找到 public static $definition = array( ,它将是一个长数组.找到其中的 'fields' => array(,在那里您将看到放置了验证、数据类型等的所有数据库字段.将您的 mystock 作为另一个项目放置在该数组中,并放置正确的验证和数据类型,就像放置其他字段一样.

2) Down the file, find public static $definition = array( , it will be a long array. Find the 'fields' => array( in it, and there you will see all the database fields placed with validation, data types etc. Place your mystock there in that array as another item and place the correct validations and data types like placed for other fields.

3) 现在打开 adminFolder/themes/default/template/controllers/products/informations.tpl 并将具有正确名称和 ID 的字段放在适当的位置.请注意,字段名称/id 都应该与 db 字段名称和我们在 Products.php 类中添加的字段名称相同.

3) Now open adminFolder/themes/default/template/controllers/products/informations.tpl and place your field with the correct name and id in the appropriate place. Please note that the field name / id both should be same like the db field name and the one we added in the Products.php class.

就是这样,希望您了解该过程并使其发挥作用.

Thats it, Hope you understand the process and will make it work.

谢谢

这篇关于在 prestashop 管理员的编辑产品页面中添加一个字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆