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 ' Price ASC LIMIT 16,51' at line 24
SELECT SQL_CALC_FOUND_ROWS p.*, pro_rating FROM SC_products p LEFT JOIN SC_categories cat ON p.categoryID = cat.categoryID JOIN SC_product_options_values pdv on p.productID = pdv.productID WHERE ( (p.productID IN (2879,2880,2881,2595,2596,2597,2598,2599,2600,2601,2602,2603,2604,2605,2606,2607,2608,2609,2692,2693,2780,2410,2411,2402,2673,2675,2864,2865,2409,2412,2671,2672,2390,2391,2400,2401,2862,2863,2380,2383,2408,2559,2670,2413,2688,2689,2690,2691,2389,2392,2399,2403,2860,2861,2379,2382,2668,2669,2405,2407,2684,2685,2686,2687,2388,2393,2398,2378,2381,2666,2667,2680,2682,2683,2681,2385,2386,2395,2396,2856,2857,2676,2677,2384,2387,2397,2678,2679,2394,2404,2406,2858,2859,2654,2653,2652,2651,2650,2569,2340,2566,2570,2576,2347,2341,2337,2338,2348,2565,2577,2339,2345,2349,2571,2578,2567,2572,2579,2346,2356,2568,2573,2580,2357,2581,2574,2352,2342,2343,2344,2350,2351,2353,2354,2355,2358,2359,2360,2323,2334,2336,2335,2878,2531,2697,2542,2530,2699,2717,2770,2765,2532,2533,2543,2700,2702,2718,2771,2766,2767,2544,2534,2535,2704,2705,2719,2772,2536,2768,2545,2537,2706,2707,2720,2773,2789,2788,2538,2541,2546,2540,2701,2703,2721,2769,2774,2716,2592,2593,2594,2582,2583,2584,2585,2639,2638,2636,2637,2640,2641,2547,2548,2552,2549,2550,2551,2553,2554,2555,2556,2557,2372,2373,2374,2320,2375,2376,2634,2633,2632,2635,2642,2643,2644,2416,2422,2415,2423,2432,2428,2433,2509,2438,2424,2429,2714,2876,2877,2425,2431,2434,2510,2715,2437,2426,2427,2435,2511,2695,2436,2694,2430,2762,2761,2763,2414,2361,2512,2362,2363,2513,2514,2722,2723,2730,2731,2812,2813,2364,2366,2515,2517,2365,2367,2516,2518,2724,2725,2368,2521,2523,2370,2726,2727,2369,2371,2522,2524,2728,2729,2816,2732,2733,2814,2815,2817,2439,2440,2441,2442,2443,2734,2738,2444,2445,2446,2447,2448,2449,2450,2451,2489,2490,2743,2452,2454,2455,2456,2491,2492,2453,2710,2479,2480,2483,2484,2485,2486,2708,2478,2481,2482,2487,2488,2477,2735,2712,2713,2736,2737,2739,2740,2741,2870,2871,2872,2873,2874,2875)) OR (p.categoryID IN (589,600,641,681,700,701,744,740,741,742,743,745,746,747,748,1048,796,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,787,788,789,790,791,792,794,795,797,798,799,800,801,802,803,834,835,836,837,838,839,840,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,884,882,883,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,967,968,969,970,971,972,973,974,975,976,977,978,979,1020,1021,1022,1023,1044,1046,1051,574)) ) AND ( p.enabled=1 AND hidden = 0 AND `p`.`categoryID` NOT IN (1) ) AND cat.enabled = 1 GROUP BY p.productID ORDER BY IF( expert_content_ru is not null AND expert_content_ru != '' AND expert_content_ru != 'null' AND expert_content_ru != '[]' AND in_stock > 0, 1, IF( in_stock > 0, 2, IF( expert_content_ru is not null AND expert_content_ru != '' AND expert_content_ru != 'null' AND expert_content_ru != '[]' AND in_stock = 0, 3, IF( in_stock = 0, 4, IF( expert_content_ru is not null AND expert_content_ru != '' AND expert_content_ru != 'null' AND expert_content_ru != '[]' AND in_stock < 0, 5, 6 ) ) ) ) ) ASC, , Price ASC LIMIT 16,51