mysql - Prestashop - 在 adminController 中使用 $this->_select 时出现错误

标签 mysql sql controller prestashop prestashop-1.6

当我扩展 adminController 并定义要在 $this->_select 变量中显示的属性时,Prestashop 显示此错误:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' a.store_name, a.id_product FROM ps_selstock_product a ' at line 3

      SELECT SQL_CALC_FOUND_ROWS
                  , 
    a.store_name,
    a.id_product          FROM `ps_selstock_product` a


                  WHERE 1 

                  ORDER BY a.`id_selstock_product` ASC LIMIT 0,50

我的 $this->_select 变量包含:

$this->_select = '
        a.store_name,
        a.id_product';

我知道查询应该是这样的,删除',':

SELECT SQL_CALC_FOUND_ROWS

    a.store_name,
    a.id_product          FROM `ps_selstock_product` a


                  WHERE 1 

                  ORDER BY a.`id_selstock_product` ASC LIMIT 0,50

但我不知道如何处理,因为查询是由 prestashop 构建的,我只定义了要显示的属性

最佳答案

你试过吗?

$this->_select = 'a.store_name,a.id_product';

关于mysql - Prestashop - 在 adminController 中使用 $this->_select 时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35201100/

相关文章:

c# - 展平具有未知列数的子/父数据

php - 具有多个 COUNT() 的多个 LEFT JOINS

Angularjs 选择多个选项不起作用

php - CodeIgniter View 页面为空

mysql - 设置MySQL ODBC时出现错误

python - SQL 从临时表添加到现有表

mysql - 运行mysql时清空unix终端

MySQL Select, Join, and Set a key as Column Name——SQL AS

ruby-on-rails - Controller Action 被调用两次

asp.net-mvc - 如何在 ASP.NET MVC 中处理请求式数据库事务?