dongmei3869 2015-02-26 18:37
浏览 36
已采纳

Prestashop,自定义模块,使用$ helper-> fields_value获取配置表单的SQL值

I'm currently creating my first Prestashop module, and I use the native function $helper to generate my configuration forms.

I'm ok when using the basic fonction "Configuration::get" but because the limited size of the table ps_configuration, I use a new sql table, and I wish to load the data of this table in my form.

Actually my module contain that code when querying the ps_configuration table :

$helper->fields_value['ZC_PREFOOTERBAND_DATA'] = $ZC_PREFOOTERBAND_DATA;

And I tried to query my customtable like this :

$query='SELECT `data`
        FROM `'._DB_PREFIX_.'customtable`
        WHERE `option` = \'ZC_PREFOOTERBAND_DATA\';';
$sql = Db::getInstance()->ExecuteS($query);

But my form still blank, I can't get my sql data.

Any idea ?

Thanks

  • 写回答

1条回答 默认 最新

  • dua27031 2015-02-26 19:11
    关注

    I found the solution :)

    I did a misstake with my variables ... To many variables, that's don't help ^^'

    So the right solution to get the sql value is that one :

    $query='SELECT `data`
    FROM `'._DB_PREFIX_.'customtable`
    WHERE `option` = \'ZC_HEALTHBAND_DATA\';';
    $ZC_HEALTHBAND_DATA = Db::getInstance()->getValue($query);
    $helper->fields_value['ZC_HEALTHBAND_DATA'] = $ZC_HEALTHBAND_DATA;
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

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