Fatal error: Uncaught Exception: Error: Table 'p' from one of the SELECTs cannot be used in ORDER clause<br />Error No: 1250<br /> SELECT p.product_id as product_id, p.sort_order as sort_order, LCASE(pd.name) as name, p.model as model, (SELECT AVG(rating) FROM oc_review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM oc_category_discount dm LEFT JOIN oc_product_to_category ptc ON (ptc.category_id = dm.category_id) LEFT JOIN oc_product p ON (ptc.product_id = p.product_id) LEFT JOIN oc_product_description pd ON (p.product_id = pd.product_id) LEFT JOIN oc_product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN oc_product_special ps ON (p.product_id = ps.product_id) WHERE p.status = '1' AND dm.status = '1' AND p.date_available <= NOW() AND dm.qty <= '1' AND p2s.store_id = '0' AND dm.customer_group_id = '1' AND ((dm.date_start = '0000-00-00' OR dm.date_start < NOW()) AND (dm.date_end = '0000-00-00' OR dm.date_end > NOW())) GROUP BY p.product_id UNION SELEC in /web/sites/ideyatextil.ru/system/library/db/mysqli.php on line 41