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`, IF(at_bestseller.value_id > 0, at_bestseller.value, at_bestseller_default.value) AS `bestseller`, ( SELECT SUM(order_item.qty_ordered) FROM sales_order_item AS order_item LEFT JOIN sales_order AS flat_orders ON (flat_orders.entity_id = order_item.order_id) WHERE order_item.product_id = e.entity_id AND flat_orders.status NOT IN ('canceled','closed','complete','fraud','holded','payment_review','paypal_canceled_reversal','paypal_reversed','pending','pending_payment','pending_paypal','processing') AND order_item.store_id = 1) AS `bestsellers`, `stock_status_index`.`stock_status` AS `is_salable`, ( SELECT SUM(order_item.qty_ordered) FROM sales_order_item AS order_item LEFT JOIN sales_order AS flat_orders ON (flat_orders.entity_id = order_item.order_id) WHERE order_item.product_id = e.entity_id AND flat_orders.status NOT IN ('canceled','closed','complete','fraud','holded','payment_review','paypal_canceled_reversal','paypal_reversed','pending','pending_payment','pending_paypal','processing') AND order_item.store_id = 1) AS `bestsellers` 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='302' 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 `catalog_product_entity_varchar` AS `at_bestseller_default` ON (`at_bestseller_default`.`entity_id` = `e`.`entity_id`) AND (`at_bestseller_default`.`attribute_id` = '166') AND `at_bestseller_default`.`store_id` = 0 LEFT JOIN `catalog_product_entity_varchar` AS `at_bestseller` ON (`at_bestseller`.`entity_id` = `e`.`entity_id`) AND (`at_bestseller`.`attribute_id` = '166') AND (`at_bestseller`.`store_id` = 1) 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_5c1274f0be57c5_75108969` AS `search_result` ON e.entity_id = search_result.entity_id ORDER BY `stock_status_index`.`stock_status` DESC, `e`.`created_at` desc, ` CAST(IF(at_bestseller`.`value_id > 0` ASC, ` at_bestseller`.`value` ASC, `at_bestseller_default`.`value) AS SIGNED)` desc, `bestsellers` desc, `e`.`created_at` desc, `e`.`created_at` DESC, `e`.`entity_id` ASC, IF(at_bestseller.value_id > 0, at_bestseller.value, at_bestseller_default.value) desc, `bestsellers` desc, `e`.`created_at` desc, `e`.`created_at` DESC, `e`.`entity_id` ASC LIMIT 48SELECT `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`, IF(at_bestseller.value_id > 0, at_bestseller.value, at_bestseller_default.value) AS `bestseller`, ( SELECT SUM(order_item.qty_ordered) FROM sales_order_item AS order_item LEFT JOIN sales_order AS flat_orders ON (flat_orders.entity_id = order_item.order_id) WHERE order_item.product_id = e.entity_id AND flat_orders.status NOT IN ('canceled','closed','complete','fraud','holded','payment_review','paypal_canceled_reversal','paypal_reversed','pending','pending_payment','pending_paypal','processing') AND order_item.store_id = 1) AS `bestsellers`, `stock_status_index`.`stock_status` AS `is_salable`, ( SELECT SUM(order_item.qty_ordered) FROM sales_order_item AS order_item LEFT JOIN sales_order AS flat_orders ON (flat_orders.entity_id = order_item.order_id) WHERE order_item.product_id = e.entity_id AND flat_orders.status NOT IN ('canceled','closed','complete','fraud','holded','payment_review','paypal_canceled_reversal','paypal_reversed','pending','pending_payment','pending_paypal','processing') AND order_item.store_id = 1) AS `bestsellers`, ( SELECT SUM(order_item.qty_ordered) FROM sales_order_item AS order_item LEFT JOIN sales_order AS flat_orders ON (flat_orders.entity_id = order_item.order_id) WHERE order_item.product_id = e.entity_id AND flat_orders.status NOT IN ('canceled','closed','complete','fraud','holded','payment_review','paypal_canceled_reversal','paypal_reversed','pending','pending_payment','pending_paypal','processing') AND order_item.store_id = 1) AS `bestsellers` 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='302' 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 `catalog_product_entity_varchar` AS `at_bestseller_default` ON (`at_bestseller_default`.`entity_id` = `e`.`entity_id`) AND (`at_bestseller_default`.`attribute_id` = '166') AND `at_bestseller_default`.`store_id` = 0 LEFT JOIN `catalog_product_entity_varchar` AS `at_bestseller` ON (`at_bestseller`.`entity_id` = `e`.`entity_id`) AND (`at_bestseller`.`attribute_id` = '166') AND (`at_bestseller`.`store_id` = 1) 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_5c1274f0be57c5_75108969` AS `search_result` ON e.entity_id = search_result.entity_id ORDER BY `stock_status_index`.`stock_status` DESC, `e`.`created_at` desc, ` CAST(IF(at_bestseller`.`value_id > 0` ASC, ` at_bestseller`.`value` ASC, `at_bestseller_default`.`value) AS SIGNED)` desc, `bestsellers` desc, `e`.`created_at` desc, `e`.`created_at` DESC, `e`.`entity_id` ASC, IF(at_bestseller.value_id > 0, at_bestseller.value, at_bestseller_default.value) desc, `bestsellers` desc, `e`.`created_at` desc, `e`.`created_at` DESC, `e`.`entity_id` ASC, IF(at_bestseller.value_id > 0, at_bestseller.value, at_bestseller_default.value) desc, `bestsellers` desc, `e`.`created_at` desc, `e`.`created_at` DESC, `e`.`entity_id` ASC LIMIT 48