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 '13/%', 1 , 0) + IF( LOWER(p.name_ru) LIKE '%t5x-06)%', 1 , 0) + IF( povt_width.o' at line 10
SELECT * FROM ( SELECT p.*, c.popular , povt_width.option_value_ru*1 as p_width, ABS(povt_width.option_value_ru*1 - 56) as p_width_diff, povt_engine.option_value_ru as p_engine, ABS(povt_engine.option_value_ru*1 - 5) as p_engine_diff, povt_speed.option_value_ru*1 as p_speed, ABS(povt_speed.option_value_ru*1 - - 24) as p_speed_diff, IF ( povt_naklon.option_value_ru = 'электронная' , 1, 0) as p_naklon, povt_naklon.option_value_ru as p_naklon_val, povt_display.option_value_ru as p_display_val , IF( LOWER(p.name_ru) LIKE '%matrix%', 1 , 0) + IF( LOWER(p.name_ru) LIKE '%t5x%', 1 , 0) + IF( LOWER(p.name_ru) LIKE '%(t5x'13/%', 1 , 0) + IF( LOWER(p.name_ru) LIKE '%t5x-06)%', 1 , 0) + IF( povt_width.option_value_ru*1 = 56, 1 , 0) + IF( povt_engine.option_value_ru = '5', 1 , 0) + IF( povt_speed.option_value_ru = 24, 1 , 0) + IF ( povt_naklon.option_value_ru = 'электронная' , 1, 0) as hits FROM SC_products as p JOIN SC_categories as c ON c.categoryID = p.categoryID JOIN SC_product_options_values as povt_width ON povt_width.productID = p.productID JOIN SC_product_options_values as povt_engine ON povt_engine.productID = p.productID JOIN SC_product_options_values as povt_speed ON povt_speed.productID = p.productID JOIN SC_product_options_values as povt_naklon ON povt_naklon.productID = p.productID JOIN SC_product_options_values as povt_display ON povt_display.productID = p.productID WHERE p.categoryID NOT IN (651,652,653) AND p.categoryID > 0 AND p.enabled AND p.name_ru != 'Matrix T5X (T5X'13/ T5X-06)' AND in_stock >=0 AND ( date_of_delivery IS NOT NULL OR in_stock > 0) AND ( povt_width.option_value_ru*1 >= 54 AND povt_width.option_value_ru*1 <= 58 ) AND povt_width.optionID = 82 AND ( povt_engine.option_value_ru*1 >= 4 AND povt_engine.option_value_ru*1 <= 6 ) AND povt_engine.optionID = 48 AND ( povt_speed.option_value_ru*1 >= 22 AND povt_speed.option_value_ru*1 <= 26 ) AND povt_speed.optionID = 49 AND povt_naklon.optionID = 86 AND povt_display.optionID = 28 AND p.productID != 2102 AND p.productID NOT IN (1271, 2193, 2194, 2200, 2196, 2228, 828, 728, 729, 730, 731, 1031, 2001, 2190, 2191, 2192, 2214, 759, 760, 761, 762, 763, 764, 765, 766, 767, 2363, 2360, 2361, 2364, 2365, 2366, 2367, 2369, 673, 674, 675, 676, 677, 678, 679, 687, 688, 686, 2370, 2372, 2371, 2373, 672, 864, 865, 867, 868, 869, 870, 871, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 1269, 1270, 2125, 2116, 2128, 2129, 2220, 2221, 2700, 2152, 2158, 2157, 2153, 2154, 2155, 2156, 2159) AND p.categoryID = 582 ) as tmp ORDER BY popular DESC , hits DESC LIMIT 1