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 ') ORDER BY coll.ordering DESC, `available` DESC, `sketch` ASC, catalog_order ASC' at line 1 SQL=SELECT i.*, IF(i.catid IN (31,32,33),'1',IF(i.catid IN (35),'2',IF(i.catid IN (36,40),'3',IF(i.catid IN (52,65,64),'4',IF(i.catid IN (34,38,63),'5',IF(i.catid IN(44,45,67),'6',IF(i.catid IN(50,54),'7',IF(i.catid IN(53),'8','9')))))))) AS catalog_order, IF(CHAR_LENGTH(i.size_range)=CHAR_LENGTH(i.sizes) OR CHAR_LENGTH(i.size_range)=CHAR_LENGTH(i.sizes) -1,'1','2') AS fullrange, coll.filter_value as collection_name, st.text AS saletext, st.amount AS saleamount,  IF(i.sizes != '',1,0) AS `available`,  i.price_retail * ( 100 - IFNULL(i.discount, 0) )/100 AS realprice, c.name as categoryname,c.id as categoryid, c.alias as categoryalias, c.params as categoryparams, c.retail AS for_retail FROM #__k2_items as i RIGHT JOIN #__k2_categories AS c ON c.id = i.catid LEFT JOIN #__sales_types AS st ON i.active_sale = st.name  LEFT JOIN #__filters AS coll ON i.collection_id = coll.id  WHERE i.published = 1 AND i.sizes != '' AND i.size_range !='' AND i.access IN(1,1,5) AND i.trash = 0 AND c.published = 1 AND c.access IN(1,1,5) AND c.trash = 0 AND ( i.publish_up = '0000-00-00 00:00:00' OR i.publish_up <= '2021-08-04 16:03:51' ) AND ( i.publish_down = '0000-00-00 00:00:00' OR i.publish_down >= '2021-08-04 16:03:51' ) AND c.id IN (28,31,34,36,44,50,52) AND i.material IN () ORDER BY coll.ordering DESC, `available` DESC, `sketch` ASC, catalog_order ASC,  fullrange, CHAR_LENGTH(i.sizes) DESC,  `newopt` DESC,  i.hits DESC, i.id DESC LIMIT 0, 10000
Call stack
# Function Location
1 JApplicationCms->execute() /index.php:57
2 JApplicationSite->doExecute() /libraries/cms/application/cms.php:261
3 JApplicationSite->dispatch() /libraries/cms/application/site.php:230
4 JComponentHelper::renderComponent() /libraries/cms/application/site.php:191
5 JComponentHelper::executeComponent() /libraries/cms/component/helper.php:380
6 require_once() /libraries/cms/component/helper.php:405
7 JControllerLegacy->execute() /components/com_k2/k2.php:63
8 K2ControllerItemlist->display() /libraries/legacy/controller/legacy.php:703
9 K2Controller->display() /components/com_k2/controllers/itemlist.php:49
10 JControllerLegacy->display() /components/com_k2/controllers/controller.php:20
11 K2ViewItemlist->display() /libraries/legacy/controller/legacy.php:665
12 K2ModelItemlist->getFilterValues() /components/com_k2/views/itemlist/view.html.php:56
13 K2ModelItemlist->getData() /components/com_k2/models/itemlist.php:856
14 JDatabaseDriver->loadObjectList() /components/com_k2/models/itemlist.php:1848
15 JDatabaseDriverMysqli->execute() /libraries/joomla/database/driver.php:1689