Jump to content

Bad query error in abandoned carts query when filtering by 'Online' in Shopping Carts module, when guest checkout is enabled.


D. Alexandre

Recommended Posts

Hello,

As the title says, we found a bug in the query made after using the dropdown filter 'Online', an option that only appears when guest checkout is enabled.

If you search for abandoned carts without filter, everything is fine. However, if you apply the Online filter, either Yes or No, you get the error:

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'status = 'Abandoned carts' ORDER BY a.id_cart DESC LIMIT 0, 50' at line 20

 

Looking through the file at /home/MYSTORE/public_html/controllers/admin/AdminCartsController.php, we found this bit of code:

if (Tools::getValue('action') && Tools::getValue('action') == 'filterOnlyAbandonedCarts') {
	$this->_having = 'status = \'' . $this->trans('Abandoned cart', array(), 'Admin.Orderscustomers.Feature') . '\'';
} else {
	$this->_use_found_rows = false;
}

This code appears to be missing something, if I put 'AND' before status, it appears to fix this bug.

We have found this to be happening in multiple versions of Prestashop, all the way up to 1.7.7.8

Link to comment
Share on other sites

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...