Error Number: 1064

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 'AND p.merchant_id = 40 AND ( ( ' at line 3

SELECT COUNT(1) as total FROM product p WHERE p.category_id = AND p.merchant_id = 40 AND ( ( p.status = 1 AND p.stock > 0 ) OR EXISTS ( SELECT * FROM product_version pv WHERE pv.product_id = p.id AND pv.status = 1 AND pv.stock > 0 ) )

Filename: models/DbService.php

Line Number: 55