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 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题