问题
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