du2986 2018-10-25 05:49
浏览 80
已采纳

在prestashop 1.7中显示表单文本字段中的配置值

I am creating a module in prestashop 1.7 to save my settings.

Also I created a form to display my settings. Form sample is shown below:-

//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'  
            )
        );

I am saving this values in configuration table using configuration class functions.

I know how to retrieve it but don't know how to show in the form. Please some one guide on this will be really helpful.

  • 写回答

1条回答 默认 最新

  • donglian1523 2018-10-25 08:35
    关注

    Add this line to helper on your module (before generateForm):

    $helper->fields_value = $this->getFormValues();
    

    and add function to define values:

    public function getFormValues()
    {
        $fields_value = array();
        $fields_value['C_BUSINESS_FLAG'] = "some data or retrieved data";
    
        return $fields_value;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?