SELECT `e`.*, `cat_index`.`position` AS `cat_index_position`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, `stock_status_index`.`stock_status` AS `is_salable` FROM `catalog_product_entity` AS `e` INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id='249' AND cat_index.is_parent=1 INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0 LEFT JOIN `cataloginventory_stock_status` AS `stock_status_index` ON e.entity_id = stock_status_index.product_id AND stock_status_index.website_id = 0 AND stock_status_index.stock_id = 1 INNER JOIN `search_tmp_5ceae43c50bb97_02402414` AS `search_result` ON e.entity_id = search_result.entity_id WHERE (`e`.`entity_id` IN(NULL)) ORDER BY CASE e.entity_id END 2 exception(s): Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42000]: Syntax error or access violation: 1064 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 'END' at line 5, query was: SELECT `e`.*, `cat_index`.`position` AS `cat_index_position`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, `stock_status_index`.`stock_status` AS `is_salable` FROM `catalog_product_entity` AS `e` INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id='249' AND cat_index.is_parent=1 INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0 LEFT JOIN `cataloginventory_stock_status` AS `stock_status_index` ON e.entity_id = stock_status_index.product_id AND stock_status_index.website_id = 0 AND stock_status_index.stock_id = 1 INNER JOIN `search_tmp_5ceae43c50bb97_02402414` AS `search_result` ON e.entity_id = search_result.entity_id WHERE (`e`.`entity_id` IN(NULL)) ORDER BY CASE e.entity_id END Exception #1 (PDOException): SQLSTATE[42000]: Syntax error or access violation: 1064 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 'END' at line 5 Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42000]: Syntax error or access violation: 1064 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 'END' at line 5, query was: SELECT `e`.*, `cat_index`.`position` AS `cat_index_position`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, `stock_status_index`.`stock_status` AS `is_salable` FROM `catalog_product_entity` AS `e` INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id='249' AND cat_index.is_parent=1 INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0 LEFT JOIN `cataloginventory_stock_status` AS `stock_status_index` ON e.entity_id = stock_status_index.product_id AND stock_status_index.website_id = 0 AND stock_status_index.stock_id = 1 INNER JOIN `search_tmp_5ceae43c50bb97_02402414` AS `search_result` ON e.entity_id = search_result.entity_id WHERE (`e`.`entity_id` IN(NULL)) ORDER BY CASE e.entity_id END #0 /home/wolverinegt/public_html/vendor/magento/framework/DB/Statement/Pdo/Mysql.php(95): Zend_Db_Statement_Pdo->_execute(Array) #1 /home/wolverinegt/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement.php(303): Magento\Framework\DB\Statement\Pdo\Mysql->_execute(Array) #2 /home/wolverinegt/public_html/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array) #3 /home/wolverinegt/public_html/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `e`.*, `...', Array) #4 /home/wolverinegt/public_html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(465): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `e`.*, `...', Array) #5 /home/wolverinegt/public_html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(520): Magento\Framework\DB\Adapter\Pdo\Mysql->_query('SELECT `e`.*, `...', Array) #6 /home/wolverinegt/public_html/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(737): Magento\Framework\DB\Adapter\Pdo\Mysql->query(Object(Magento\Framework\DB\Select), Array) #7 /home/wolverinegt/public_html/vendor/magento/framework/Data/Collection/Db/FetchStrategy/Query.php(21): Zend_Db_Adapter_Abstract->fetchAll(Object(Magento\Framework\DB\Select), Array) #8 /home/wolverinegt/public_html/vendor/magento/framework/Data/Collection/AbstractDb.php(772): Magento\Framework\Data\Collection\Db\FetchStrategy\Query->fetchAll(Object(Magento\Framework\DB\Select), Array) #9 /home/wolverinegt/public_html/vendor/magento/module-eav/Model/Entity/Collection/AbstractCollection.php(1111): Magento\Framework\Data\Collection\AbstractDb->_fetchAll(Object(Magento\Framework\DB\Select)) #10 /home/wolverinegt/public_html/var/generation/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection/Interceptor.php(1181): Magento\Eav\Model\Entity\Collection\AbstractCollection->_loadEntities(false, false) #11 /home/wolverinegt/public_html/vendor/magento/module-eav/Model/Entity/Collection/AbstractCollection.php(910): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\Interceptor->_loadEntities(false, false) #12 /home/wolverinegt/public_html/vendor/magento/module-catalog/Model/ResourceModel/Product/Collection.php(727): Magento\Eav\Model\Entity\Collection\AbstractCollection->load(false, false) #13 /home/wolverinegt/public_html/vendor/magento/framework/Interception/Interceptor.php(146): Magento\Catalog\Model\ResourceModel\Product\Collection->load(false, false) #14 /home/wolverinegt/public_html/var/generation/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection/Interceptor.php(325): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\Interceptor->___callPlugins('load', Array, Array) #15 /home/wolverinegt/public_html/vendor/magento/framework/Data/Collection.php(820): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\Interceptor->load() #16 /home/wolverinegt/public_html/var/generation/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection/Interceptor.php(1818): Magento\Framework\Data\Collection->getIterator() #17 /home/wolverinegt/public_html/vendor/magento/module-catalog/Block/Product/ListProduct.php(321): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\Interceptor->getIterator() #18 /home/wolverinegt/public_html/var/generation/Igorludgero/Outofstocklast/Block/Product/ListProduct/Interceptor.php(154): Magento\Catalog\Block\Product\ListProduct->getIdentities() #19 /home/wolverinegt/public_html/vendor/magento/module-page-cache/Model/Layout/LayoutPlugin.php(71): Igorludgero\Outofstocklast\Block\Product\ListProduct\Interceptor->getIdentities() #20 /home/wolverinegt/public_html/vendor/magento/framework/Interception/Interceptor.php(152): Magento\PageCache\Model\Layout\LayoutPlugin->afterGetOutput(Object(Magento\Framework\View\Layout\Interceptor), '