Prestashop: not saving field

空扰寡人 提交于 2019-12-12 04:13:34

问题


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'
    ),

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?

Thanks for any help


回答1:


Define the field as public property in your object model class.

class QuotaModel extends ObjectModel
{
    ...
    public $message;
    ...
}


来源:https://stackoverflow.com/questions/44013569/prestashop-not-saving-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!