Ошибка SQL: 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 'AS IF( NULL IS NOT NULL, CONCAT( '' ), '' ) AS price_html AS IF( NULL IS NOT NULL, CONCAT( '
', (CASE WHEN product_enm_spec = 'YES' THEN '0' WHEN product_int_points > 0 THEN product_int_points ELSE (ROUND(product_dec_price1) - ROUND(product_dec_price1) * IF(folder_int_discount > 0, folder_int_discount, 0) / 100) END) ,' ₽ ', ROUND(product_dec_price1), ' ₽
' ), '' ) AS price_html, ( SELECT (CASE WHEN LOCATE('Шлем', COALESCE(b.product_chr_name,a.product_chr_name)) > 0 AND folder_chr_name = 'Детское' THEN ' (детская балаклава)' ELSE '' END) FROM account_folder WHERE folder_uid_id = ( SELECT folder_ref_parent FROM account_folder WHERE folder_uid_id = ( SELECT folder_ref_parent FROM account_folder WHERE folder_uid_id = a.product_mbr_member AND (folder_chr_name = 'Головные уборы' OR folder_chr_name = 'Шлемы') LIMIT 1 ) LIMIT 1 ) LIMIT 1 ) AS prod_cat2, a.product_chr_article AS product_chr_article, a.product_img_image AS product_img_image, COALESCE(b.product_txt_text,a.product_txt_text) AS product_txt_text, a.product_set_brand AS product_set_brand, COALESCE(b.product_set_color,a.product_set_color) AS product_set_color, a.product_set_size AS product_set_size, COALESCE(b.product_set_material,a.product_set_material) AS product_set_material, a.product_set_field1 AS product_set_field1, (CASE WHEN a.product_enm_spec = 'YES' THEN '' WHEN a.product_int_points > 0 THEN a.product_int_points ELSE IF(product_category.folder_int_discount > 0, product_category.folder_int_discount, '') END) AS product_dec_discount, (CASE WHEN a.product_enm_spec = 'YES' THEN '0' WHEN a.product_int_points > 0 THEN a.product_int_points ELSE (ROUND(a.product_dec_price1) - ROUND(a.product_dec_price1) * IF(product_category.folder_int_discount > 0, product_category.folder_int_discount, 0) / 100) END) AS product_dec_newprice, ROUND(a.product_dec_price1) AS product_dec_price1, ROUND(a.product_dec_price2) AS product_dec_price2, a.product_int_points AS product_int_points, a.product_int_quota AS product_int_quota, a.product_chk_kit AS product_chk_kit, a.product_chk_sex AS product_chk_sex, a.product_chk_status AS product_chk_status, a.product_chk_option AS product_chk_option, a.product_chk_format AS product_chk_format, MAKE_SET(a.product_chk_format, '28','30','32','34','36','38','40','50-52', '52-54', '54-56', '56-58', '46-48','48-50') AS product_chr_size, a.product_enm_new AS product_enm_new, a.product_enm_vip AS product_enm_vip, a.product_enm_action AS product_enm_action, a.product_enm_eco AS product_enm_eco, a.product_enm_exists AS product_enm_exists, a.product_lnk_style AS product_lnk_style, CONCAT('Купить ',COALESCE(b.product_chr_name,a.product_chr_name), ' оптом. Сторм Трейд, производство и продажа головных уборов, бейсболки, кепки, шапки, комплекты, перчатки, изготовление на заказ') AS product_txt_descr, COALESCE(b.product_txt_keywords,a.product_txt_keywords) AS product_txt_keywords, COALESCE(b.product_chr_title,a.product_chr_title) AS product_chr_title, COALESCE(b.product_ind_index,a.product_ind_index) AS product_ind_index, COALESCE(b.product_smp_create,a.product_smp_create) AS product_smp_create, COALESCE(b.product_smp_update,a.product_smp_update) AS product_smp_update, COALESCE(b.product_chr_article3d,a.product_chr_article3d) AS product_chr_article3d, COALESCE(b.product_set_collection,a.product_set_collection) AS product_set_collection, COALESCE(b.product_enm_top,a.product_enm_top) AS product_enm_top, (CASE WHEN style.list_img_image > '' AND style.list_chr_name <> 'Kotik' AND style.list_chr_name <> 'Totti' THEN style.list_img_image ELSE '' END) AS brand_img_image, (CASE WHEN a.product_set_group1 IN(194723, 190191, 01017910, 193153, 190136, 4670013545681, 01010462, 190177, 01010459) THEN 'limit' ELSE 'none-limit' END) AS input_limit, style.list_chr_link AS style_chr_link, style.list_chr_name AS style_chr_name, style.list_img_image AS style_img_image, (CASE WHEN a.product_mbr_member IN (39861,38309,38310,39315,39379,39407,39499,39061,38355,38356,38342,51005,44097,39861,44165,46121) THEN 'hide' WHEN 'YES'='NO' THEN 'hide' ELSE '' END) AS hide_nonmodal_sizes, (CASE WHEN a.product_mbr_member NOT IN (44165,38309,38310,39315,39379,39407,39499,39061,38355,38356,46121) THEN 'hide' ELSE '' END) AS hide_modal_sizes, (CASE WHEN a.product_mbr_member IN (38355, 38356) THEN '260164' WHEN a.product_mbr_member IN (39861, 38309, 38310, 39315, 39379, 39407, 39499, 39061) THEN '260161' ELSE '' END) AS helmet_modal_module, product_category.folder_int_count AS product_ind_folder, (SELECT folder_int_value FROM account_folder WHERE folder_cnt_account = 129 AND folder_uid_id = product_category.folder_ref_parent ) AS parent_value_folder, (39341 = 38298 OR 38298 = 38298) AS order_class, ( SELECT join_gender.join_that FROM reestr_join AS join_gender WHERE join_gender.join_account = 129 AND join_gender.join_this_holder = 10624 AND join_gender.join_this_table = 'account_product' AND join_gender.join_holder = 10995 AND join_gender.join_that_table = 'account_list' AND join_gender.join_this = COALESCE(a.product_ref_link, a.product_uid_id) LIMIT 1 ) AS product_int_gender, ( SELECT join_cat.join_that FROM reestr_join AS join_cat WHERE join_cat.join_account = 129 AND join_cat.join_this_holder = 10624 AND join_cat.join_this_table = 'account_product' AND join_cat.join_holder = 10992 AND join_cat.join_that_table = 'account_list' AND join_cat.join_this = COALESCE(a.product_ref_link, a.product_uid_id) LIMIT 1 ) AS product_int_type, join_season.join_that AS product_int_additional, additional_filter.join_that AS product_set_addit, IF( 160589 IN ( SELECT for_season.join_that FROM reestr_join for_season WHERE for_season.join_account = 129 AND for_season.join_this_holder = 10624 AND for_season.join_this_table = 'account_product' AND for_season.join_holder = 12518 AND for_season.join_that_table = 'account_list' AND for_season.join_this = COALESCE(a.product_ref_link, a.product_uid_id) ), 1, 0 ) AS season_sort, IF(INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'ШАПК') > 0, 3, IF(INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'ШЛЯП') > 0, 2, 1)) AS name_sort1, (CASE WHEN 39341 = 38266 OR 39341 = 44095 THEN (CASE WHEN INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'АМБРЕ') > 0 OR INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'ОНТРЭ') > 0 THEN -10 WHEN INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'БИНИ') > 0 OR INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'БАЛИ') > 0 OR INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'СТАЙЛ') > 0 THEN 100 WHEN INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'СОЛОД') > 0 OR INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'КАПРИЗ') > 0 OR INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'ЛЕКС') > 0 THEN 90 WHEN INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'ЛЕГЕНДА') > 0 THEN 80 WHEN INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'КАРТУЗ') > 0 THEN 70 WHEN INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'БЕРЕТ') > 0 THEN 60 WHEN INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'ШЛЯП') > 0 THEN 50 WHEN INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'БЕЙСБ') > 0 THEN 40 ELSE 1 END) ELSE IF(INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'ШАПК') > 0, 3, IF(INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'ШЛЯП') > 0, 2, 1)) END) AS name_sort, (CASE WHEN 39341 <> 38266 AND COALESCE(b.product_enm_new,a.product_enm_new) = 'YES' AND COALESCE(b.product_set_collection,a.product_set_collection) IN ('Кардиганы', 'Джемпера', 'Футболки', 'Платья', 'Юбки', 'Брюки') THEN 1 WHEN COALESCE(b.product_enm_new,a.product_enm_new) = 'YES' AND INSTR(UPPER(COALESCE(b.product_chr_name,a.product_chr_name)), 'СЕРТИФ') = 0 AND COALESCE(b.product_set_collection,a.product_set_collection) NOT IN ('Кардиганы', 'Джемпера', 'Футболки', 'Платья', 'Юбки', 'Брюки') THEN 1 ELSE 0 END) AS product_new, (CASE WHEN folder_chr_name = 'Sale' THEN ( SELECT COALESCE(b.product_mbr_member,a.product_mbr_member) FROM account_product WHERE COALESCE(b.product_mbr_member,a.product_mbr_member) NOT IN ( SELECT folder_uid_id FROM account_folder WHERE folder_ref_parent = 38295 ) AND COALESCE(b.product_chr_name,a.product_chr_name) = a.product_chr_name ) END) AS real_mbr_member FROM account_product a # Бренды LEFT JOIN account_list AS style ON a.product_lnk_style = style.list_uid_id AND style.list_cnt_account = 129 AND style.list_hld_holder = 7316 AND style.list_mbr_member = 0 # Дополнительно LEFT JOIN reestr_join AS additional_filter ON additional_filter.join_account = 129 AND additional_filter.join_this_holder=10624 AND additional_filter.join_this_table='account_product' AND additional_filter.join_holder=10992 AND additional_filter.join_that_table='account_list' AND additional_filter.join_this = COALESCE(a.product_ref_link, a.product_uid_id) # Для сортировки INNER JOIN account_folder AS product_category FORCE INDEX (PRIMARY) ON product_category.folder_cnt_account = 129 AND product_category.folder_hld_holder = 10624 AND product_category.folder_uid_id = product_mbr_member AND product_category.folder_ref_link IS NULL AND product_category.folder_lng_language IS NULL # Сезон LEFT JOIN reestr_join AS join_season ON join_season.join_account = 129 AND join_season.join_this_holder=10624 AND join_season.join_this_table='account_product' AND join_season.join_holder=12518 AND join_season.join_that_table='account_list' AND join_season.join_this = COALESCE(a.product_ref_link, a.product_uid_id) /*LEFT JOIN account_product AS f ON f.product_cnt_account = 129 AND f.product_hld_holder = 10624 AND f.product_mbr_member = 38295 AND f.product_set_collection='Фетровые шляпы' AND */ LEFT JOIN account_product b ON b.product_ref_link=a.product_uid_id AND b.product_lng_language = 'en' WHERE a.product_cnt_account = 129 AND a.product_hld_holder = 10624 AND a.product_mbr_member IN( SELECT 39341 UNION # Папки внутри папок SELECT folder_uid_id FROM account_folder WHERE folder_cnt_account = 129 AND folder_hld_holder=10624 AND folder_mbr_member=0 AND folder_ref_parent = 39341 AND folder_enm_show <> 'YES' UNION # Папки внутри папок внутри папок SELECT b.folder_uid_id FROM account_folder a INNER JOIN account_folder b ON b.folder_cnt_account=129 AND b.folder_hld_holder=10624 AND b.folder_mbr_member=0 AND b.folder_ref_parent = a.folder_uid_id WHERE a.folder_cnt_account=129 AND a.folder_hld_holder=10624 AND a.folder_mbr_member=0 AND a.folder_ref_parent = 39341 AND a.folder_enm_show <> 'YES' UNION # Если в фильтре выбрана подкатегория "Фетровые шляпы", то показываем еще товары из # папки с ID 51005 (Распродажа -> аксессуары) SELECT (CASE WHEN NULL = 'Фетровые шляпы' IS NOT NULL THEN 51005 ELSE TRUE END) ) AND (IFNULL(NULL, '') = '' OR COALESCE(b.product_dec_price1,a.product_dec_price1) >= NULL) AND (NULL IS NULL OR NULL = '' OR COALESCE(b.product_dec_price1,a.product_dec_price1) <= NULL) AND COALESCE(b.product_enm_eco,a.product_enm_eco) <> 'YES' AND a.product_lng_language IS NULL /* объединение языков, всегда выбираем сначала основной */ AND a.product_chr_link LIKE ? GROUP BY a.product_set_group1 ORDER BY season_sort DESC, product_new DESC, name_sort1 DESC LIMIT 1 /* module_id:229404 URN */]