Sale items

  • Garment
  • Clear
SELECT COUNT(DISTINCT var.product_id) as `count` FROM shop_prices as prices INNER JOIN shop_product_variations AS var ON prices.variation_id = var.variation_id LEFT JOIN shop_product_categories_link ON shop_product_categories_link.product_id = var.product_id LEFT JOIN shop_product AS p ON p.product_id = var.product_id LEFT JOIN tbl_product_offer_link AS oLink ON oLink.product_id = p.product_id LEFT JOIN tbl_product_offer AS offer ON offer.offer_id = oLink.offer_id LEFT JOIN tbl_product_offer_ribbons AS ribbons ON ribbons.ribbon_id = offer.ribbon_id WHERE (var.short_description!='' OR var.long_description!='') && group_id='1' && ((prices.`price` >= '0' AND prices.`price` <= '5' AND prices.`offer_price`=0) OR (prices.`offer_price` >='0' AND prices.`offer_price` <='5' AND prices.`offer_price`!=0 AND ((prices.offer_starts>NOW() AND NOW()0 && p.sale = 1 && var.stock_level > 0 && `p`.`garment_category_id` IN ()