在渲染表单PrestaShop中显示日期/时间字段



我在类别 lang 表中添加了一个额外的日期字段。所有数据都正确保存,但是当尝试在渲染表单中显示数据时,我没有得到任何值。如果我将类型更改为"文本",则值显示得很好。

任何帮助都值得赞赏,因为我现在已经搜索了很远的地方,但没有答案。我还尝试编辑数据库表中的字段类型。

这是我的渲染表单方法和我遇到问题的字段:

public function renderForm() {
$this->fields_form_override = array(
array(
'type' => 'datetime',
'label' => $this->l('Startdato'),
'name' => 'cat_start_date',
'lang' => true,
'autoload_rte' => true,
'hint' => 'Fx 14. september'
),

这是我的类别类覆盖:

public $cat_start_date;
public $cat_end_date;
public $cat_order_due_date;
public $cat_location;
public $cat_special_msg;
public function __construct($id_category = null, $id_lang = null, $id_shop = null) {
self::$definition['fields']['cat_start_date'] = array('type' => self::TYPE_DATE, 'lang' => true, 'validate' => 'isDate');
self::$definition['fields']['cat_end_date'] = array('type' => self::TYPE_DATE, 'lang' => true, 'validate' => 'isDate');
self::$definition['fields']['cat_order_due_date'] = array('type' => self::TYPE_DATE, 'lang' => true, 'validate' => 'isDate');
self::$definition['fields']['cat_location'] = array('type' => self::TYPE_STRING, 'lang' => true);
self::$definition['fields']['cat_special_msg'] = array('type' => self::TYPE_STRING, 'lang' => true);
parent::__construct($id_category, $id_lang, $id_shop);
}

您的datetime字段必须是:

lang => false

最新更新