Jump to content

Listing


annaarun

Recommended Posts

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

  • 4 weeks later...
  • 1 month later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...