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 'JOIN jos_jshopping_product_ordering AS ord ON p.category_id = ord.category_id AN' at line 20 SQL=SELECT x.query AS `xQuery`,p.product_id,p.option_name,p.hide_on_list,p.hide_option_in_list,p.tax_action,p.product_width,p.product_length,p.product_height,p.product_weight,p.product_date_added,p.category_id,p.product_parent_id,p.product_manufacturer_id,p.product_thumb_image,p.product_name_image,p.product_old_price,p.product_quantity,p.product_tax_id as tax_id,p.product_old_price_percent,p.product_category_type,p.product_publish,p.product_showcard,pt.sale_offer,pt.price_unit,pt.modular_colors,p.name,p.alias,p.short_description,p.label_id,p.label_id_2,p.label_id_3,p.tv_width,p.tv_height,p.sleep_width,p.sleep_length,p.average_rating,p.reviews_count,p.`extra_field_72`,p.`extra_field_76`,CASE WHEN IFNULL(p.r_price, 0) > 0 THEN p.r_price ELSE ROUND(p.product_price * (1 + IF(IFNULL(t.tax_value, 0) = 0, 50, t.tax_value) / 100)) END AS product_price,p.instock OR IFNULL(pA.instock, 0) AS instock,IF(m.priority_issue > 0, m.priority_issue, p.priority_issue) AS priority_issue,ord.priority,CASE
WHEN p.instock OR IFNULL(pA.instock, 0) THEN 1
WHEN p.product_parent_id = 0 OR p.hide_on_list = 0 THEN 2
ELSE 7
END AS instock_sort
FROM (
SELECT p.product_id,p.category_id,'A' AS query
FROM view_region_products AS p
WHERE region_id = 368 AND p.category_id = 12 AND p.product_publish > 0
UNION (
SELECT p.product_id,p.category_id,'B' AS query
FROM view_region_products AS p
WHERE region_id = 368 AND p.category_id = 12 AND p.product_publish = 0 AND p.product_showcard = 1)) AS x
INNER JOIN view_region_products AS p ON x.product_id = p.product_id AND p.category_id = x.category_id AND p.region_id = 368
LEFT JOIN jos_jshopping_products AS pt ON p.product_id = pt.product_id
LEFT JOIN jos_jshopping_manufacturers AS m ON p.product_manufacturer_id = m.manufacturer_id
LEFT JOIN jos_jshopping_taxes AS t ON p.product_tax_id = t.tax_id
LEFT JOIN view_region_products AS pA ON pA.product_parent_id = p.product_id AND p.region_id = pA.region_id AND pA.instock = 1
LEFT JOIN jos_jshopping_product_feature AS `f` ON `f`.product_id = p.product_id AND `f`.feature_id =
LEFT JOIN jos_jshopping_product_ordering AS ord ON p.category_id = ord.category_id AND ord.product_id = p.product_id AND ord.region_id = 0
WHERE pt.special_offer AND `f`.option_id IN (38136)
GROUP BY p.product_id
ORDER BY xQuery,ord.priority DESC,instock_sort,product_price,p.product_parent_id
Мягкая мебель
Мягкая мебель
Мебель для прихожей
Мебель для прихожей
Кровати и тахты
Кровати и тахты
Мебель как в ИКЕА
Мебель как в ИКЕА
Условия покупки
Условия покупки