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 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛