Prestashop:不保存字段 [英] Prestashop: not saving field
问题描述
我在 Prestashop 1.6 模块中工作,但我在一个似乎无法识别的字段中遇到了问题.在控制器中,我使用 renderForm()
方法获取表单,并在表单中定义字段,如下所示:
I'm working in a Prestashop 1.6 module and I'm having problem with one field that seems not to be recognized. In the controller I'm using the renderForm()
method to get the form and I define the field in the form like this:
array(
'type' => 'text',
'label' => $this->l('Message'),
'name' => 'message',
'required' => true,
'hint' => $this->l('Message to be shown when the customer exceeds the quota '),
),
在模型类中我这样定义它:
And in the model class I define it like this:
'message' => array(
'type' => self::TYPE_STRING,
'validate' => 'isString',
'required' => true,
'size' => 4000,
'db_type' => 'varchar'
),
然后当我尝试保存记录时,我收到此消息:Property QuotaModel->message is empty
And then when I try to save the record I get this message: Property QuotaModel->message is empty
我是否在其他地方遗漏了定义?你能看到我在这里遗漏了什么吗?
Am I missing a definition somewhere else? Can you see what I'm missing here?
感谢您的帮助
推荐答案
在对象模型类中将字段定义为公共属性.
Define the field as public property in your object model class.
class QuotaModel extends ObjectModel
{
...
public $message;
...
}
这篇关于Prestashop:不保存字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!