2017-05-17 46 views
0

我正在使用Prestashop 1.6模塊,我遇到了一個似乎無法識別的字段問題。在控制器中我使用的是renderForm()方法獲取的形式和我在這樣的形式定義字段:Prestashop:not saving field

 array(
      'type' => 'text', 
      'label' => $this->l('Message'), 
      'name' => 'message', 
      'required' => true, 
      'hint' => $this->l('Message to be shown when the customer exceeds the quota '), 
     ), 

和模型類我定義它是這樣的:

'message' => array(
     'type' => self::TYPE_STRING, 
     'validate' => 'isString', 
     'required' => true, 
     'size' => 4000, 
     'db_type' => 'varchar' 
    ), 

然後當我嘗試保存記錄時,我收到以下消息:Property QuotaModel->message is empty

我是否在其他位置缺少定義?你能看到我在這裏錯過了什麼嗎?

感謝您的幫助

+0

您是否在類中定義了它的公共屬性以及'public $ message;'? – TheDrot

+0

@TheDrot不,我很確定這就是我忘了!再次感謝!請張貼你的答案,以便我能得到你的觀點。當我回家時我會進行測試 –

回答

1

在對象模型類中將該字段定義爲公共屬性。

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