annaarun Posted October 21, 2016 Share Posted October 21, 2016 Hello, I was trying to list only the products whose id is there in an array. Say productIds, a protected variable in my controller in my new module. So in my controller constructor, added following code : $this->_where = 'a.id_product IN ('.implode(",", $this->productIds).')'; In the query, the condition was appended as below : WHERE 1 a.id_product IN (1,2) Due to the 1 after where I was getting the sql sytax error. I modified the getList function in file prestashop/classes/controller/AdminController.php that is to append 1 only if there is no condition. It worked fine then. Is this a bug or did I used it incorrectly? Link to comment Share on other sites More sharing options...
annaarun Posted November 17, 2016 Author Share Posted November 17, 2016 Hello.. No one have got this error? Is there a particular syntax for this? Link to comment Share on other sites More sharing options...
annaarun Posted December 20, 2016 Author Share Posted December 20, 2016 Hello, Do like this instead set as $this->_where = ' AND a.id_product IN (1,2)'; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now