Can not execute database query. Please contact site administrator.
2017-07-28T04:01:23-05:00

SELECT
orders_content.pid, orders.status,
SUM(orders_content.admin_price * orders_content.admin_quantity) AS product_amount,
SUM(orders_content.admin_quantity) AS product_quantity,
products.*,
IF(products.url_custom='',products.url_default,products.url_custom) AS product_url,
catalog.name AS cat_name,
IF(catalog.url_custom='',catalog.url_default,catalog.url_custom) AS cat_url
FROM orders_content
INNER JOIN orders ON orders.oid=orders_content.oid
INNER JOIN products ON products.pid = orders_content.pid

INNER JOIN catalog ON catalog.cid = products.cid
WHERE
catalog.key_name <> 'gift_cert' AND
products.is_visible='Yes' AND
DATE_ADD(orders.placed_date, INTERVAL 2 MONTH)>NOW() AND
orders.status='Completed' AND
orders.payment_status='Received'
AND (
orders_content.pid not in (select pgp.pid from products_groups_products pgp where pgp.group_id <> 0)
OR
orders_content.pid in ()
)
GROUP BY orders_content.pid
ORDER BY product_quantity DESC
LIMIT 18


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 ')
)
GROUP BY orders_content.pid
ORDER BY product_quantity DESC
' at line 23