我正在 prestashop 1.7 中创建一个模块来保存我的设置。
我还创建了一个表单来显示我的设置。表单示例如下所示:-
//display form function
public function renderCustomerForm()
{
$this->fields_form = array(
'legend' => array(
'title' => $this->l('Customer Settings'),
'icon' => 'icon-time'
),
'input'=>array(
array(
'type' => 'text',
'label' => $this->l('BusinessCustomerFlag'),
'name' => 'C_BUSINESS_FLAG',
'lang' => false,
'required' => true
),
),
'submit' => array(
'title' => $this->l('Save'),
'name' => 'submitCustomer',
'icon' => 'process-icon-save'
)
);
我使用配置类函数将这些值保存在配置表中。
我知道如何检索它,但不知道如何在表单中显示。请一些关于这方面的指南将非常有帮助。
最佳答案
将此行添加到模块的帮助器中(在 generateForm 之前):
$helper->fields_value = $this->getFormValues();
并添加函数来定义值:
public function getFormValues()
{
$fields_value = array();
$fields_value['C_BUSINESS_FLAG'] = "some data or retrieved data";
return $fields_value;
}
关于php - 在 prestashop 1.7 的表单文本字段中显示配置值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52982157/