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 ')' at line 4
SELECT COUNT(DISTINCT p.productID) as cnt FROM SC_products p LEFT JOIN SC_product_pictures pics ON p.default_picture = pics.photoID LEFT JOIN SC_product_time_discounts AS time_discnt_tbl ON p.productID = time_discnt_tbl.productID LEFT JOIN SC_iteamo_products ip ON ip.productID = p.productID WHERE ( (p.productID IN (1,4,5,14,15,16,18,20,24,28,30,31,34,35,40,41,42,43,45,48,49,50,68,86,89,92,119,120,121,122,123,124,135,137,139,142,143,148,151,152,154,155,156,157,158,173,174,175,177,184,187,188,190,193,194,195,203,204,205,207,208,209,210,213,215,216,217,218,219,235,260,264,266,267,268,269,270,276,277,279,280,281,282,283,404,417,418,419,420,421,422,423,424,425,444,445,446,576,744,786,789,856,862,877,878,927,964,995,997,998,1016,1059,1065,1077,1279,1300,1301,1379,1382,1483,1484,1487,1494,1495,1514,1552,1553,1554,1563,1564,1568,1569,1570,1571,1583,1585,1587,1603,1660,1662,1666,1667,1897,1911,1914,1924,1927,1928,1943,1957,1960,1963,1965,1968,1969,1970,1971,1973,1983,2011,2013,2014,2015,2016,2017,2021,2024,2025,2026,2028,2029,2030,2034,2035,2036,2037,2038,2039,2041,2042,2043,2044,2045,2046,2047,2048,2049,2050,2053,2054,2055,2056,2057,2058,2059,2061,2108,2110,2112,2241,2268,2300,2301,2313,2315,2317,2320,2328,2329,2330,2332,2333,2335,2336,2337,2338,2339,2340,2341,2343,2344,2345,2346,2347,2348,2349,2350,2351,2352,2353,2354,2355,2356,2358,2370,2372,2373,2374,2383,2390,2392,2393,2394,2396,2397,2398,2400,2401,2402,2407,2417,2427,2428,2429,2431,2432,2433,2436,2437,2438,2439,2440,2441,2442,2443,2444,2449,2450,2451,2452,2453,2454,2455,2456,2458,2459,2463,2464,2465,2466,2467,2468,2471,2472,2474,2475,2477,2479,2489,2526,2530,2581,2593,2594,2595,2597,2607,2623,2667,2671,11574,11678,11680,11878,11896,11899,11973,11974,11981,11985,11994,11997,12003,12017,12021,12022,12023,12040,12043,12044,12045,12048,12049,12050,12057,12060,12062,12063,12064,12065,12066,12067,12068,12069,12072,12073,12075,12076,12078,12080,12082,12084,12085,12086,12087,12093,12094,12095,12096,12097,12098,12104,12105,12106,12107,12108,12109,12110,12111,12117,12149,12152,12154,12158,12159,12161,12162,12164,12170,12171,12173,12174,12177,12178,12179,12180,12181,12182,12183,12191,12193,12194,12195,12265,12266,12274,12276,12282,12290,12302,12303,12312,12320,12321,12324,12328,12332,12335,12344,12345,12348,12351,12352,12354,12355,12356,12357,12358,12359,12360,12361,12362,12364,12366,12373,12376,12377,12385,12402,12405,12409,12412,12413,12414,12437,12498,12499,12500,12501,12518,12519,12537,12538,12540,12560,12562,12566,12570,12587,12588,12589,12591,12592,12593,12600,12605,12608,12609,12651,12661,12662,12709,12722,12723,12724,12725,12728,12729,12730,12731,12732,12734,12735,12736,12737,12738,12739,12740,12741,12742,12743,12744,12745,12746,12747,12748,12749,12750,12751,12752,12753,12754,12755,12756,12757,12758,12759,12760,12761,12762,12763,12765,12766,12767,12768,12769,12770,12771,12772,12773,12774,12775,12778,12779,12780,12782,12784,12785,12788,12789,12791,12792,12793,12794,12795,12796,12797,12798,12799,12800,12801,12802,12803,12804,12842,12846,12847,12857,12865,12866,12891,12892,12893,12906,12907,12917,12922,12923,12927,12948,13004,13005,13006,13007,13008,13009,13010,13025,13027,13031,13032,13033,13039,13041,13042,13073,13076,13077,13078,13079,13080,13120,13121,13125,13127,13151,13152,13154,13155,13156,13157,13158,13159,13160,13161,13163,13164,13165,13262,13263,13264,13265,13266,13268,13334,13337,13349,13358,13367,13368,13370,13371,13414,13415,13416,13417,13418,13419,13420,13421,13422,13423,13424,13425,13426,13427,13428,13429,13430,13431,13432,13433,13434,13435,13436,13438,13439,13440,13451,13487,13546,13547,13548,13549,13550,13560,13570,13574,13579,13582,13583,13589,13594,13595,13603,13647,13799,13811,13813,13817,13818,13821,13835,13840,13841,13842,13843,13844,13845,13846,13847,13848,13849,13850,13851,13852,13853,13856,13859,13902,13903,13904,13906,13907,13908,13909,13910,13911,13912,13913,13914,13918,13919,13922,13929,13930,13931,13932,13948,13949,13951,13952,13985,13992,14025,14132,14133,14134,14135,14136,14142,14187,14188,14189,14191,14192,14193,14194,14199,14200,14201,14204,14211,14213,14214,14215,14289,14291,14324,14342,14344,14346,14348,14350,14353,14432,14484,14485,14486,14487,14576,14577,14578,14579,14580,14581,14582,14603,14678,14777,14780,14849,14866,14867,14868,14958,15068,15069,15070,15074,15075,15076,15077,15078,15079,15082,15105,15107,15153,15338,15341,15385,15386,15387,15388,15389,15390,15391,15396,15397,15409,15420,15428,15502,15539,15571,15591,15592,15593,15597,15598,15599,15600,15632,15736)) OR (categoryID IN (292)) ) AND ( enabled=1) AND ( (p.list_price > 0 && p.list_price > p.Price) OR (time_discnt_tbl.discount > 0 && time_discnt_tbl.date_from < 1561528553 && 1561528553 < time_discnt_tbl.date_to) ) AND p.categoryID IN ()