SELECT tr1.tax_class_id, tr2.tax_rate_id, tr2.name, tr2.rate, tr2.type, tr1.priority FROM oc_tax_rule tr1 LEFT JOIN oc_tax_rate tr2 ON (tr1.tax_rate_id = tr2.tax_rate_id) INNER JOIN oc_tax_rate_to_customer_group tr2cg ON (tr2.tax_rate_id = tr2cg.tax_rate_id) LEFT JOIN oc_zone_to_geo_zone z2gz ON (tr2.geo_zone_id = z2gz.geo_zone_id) LEFT JOIN oc_geo_zone gz ON (tr2.geo_zone_id = gz.geo_zone_id) WHERE tr1.based = 'store' AND tr2cg.customer_group_id = '1' AND z2gz.country_id = '117' AND (z2gz.zone_id = '0' OR z2gz.zone_id = '0') ORDER BY tr1.priority ASC
SELECT DISTINCT c.*, cd.*, GROUP_CONCAT(cep.parent_id ORDER BY cep.sort_order ASC) as parent_ids FROM oc_category c LEFT JOIN oc_category_description cd ON (c.category_id = cd.category_id) LEFT JOIN oc_category_extra_parents cep ON (c.category_id = cep.category_id) WHERE c.category_id = '0' AND cd.language_id = '1' AND c.status = '1' GROUP BY c.category_id
SELECT cp.path_id AS category_id, cd.name, cd.seo_keyword
FROM oc_category_path cp
INNER JOIN oc_category c ON (cp.path_id = c.category_id)
INNER JOIN oc_category_description cd ON (cp.path_id = cd.category_id)
WHERE cp.category_id = '0'
AND cd.language_id = '1' ORDER BY cp.level
SELECTCOUNT(*) AS total FROM ( WITH cgd AS ( SELECT cgd.percentage FROM `oc_customer_group_discount` AS cgd WHERE cgd.status = '1' AND cgd.customer_group_id = '0' AND (cgd.date_start = '0000-00-00' OR cgd.date_start < NOW()) ORDER BY cgd.priority ASC, cgd.percentage ASCLIMIT 0, 1) SELECT /*+ MAX_EXECUTION_TIME(10000) */ p.product_id, p.sort_order, "1" AS match_filters FROM `oc_product` AS p LEFT JOIN cgd ON (1) INNER JOIN `oc_bf_filter_guest` AS f ON (p.product_id = f.product_id) WHERE p.date_available <= NOW() AND p.type NOT LIKE 'option' AND IF(f.filter_group LIKE 'o%', f.out_of_stock = 0, 1 = 1) GROUP BY p.product_id HAVING match_filters = 1) AS t
WITH cgd AS ( SELECT cgd.percentage FROM `oc_customer_group_discount` AS cgd WHERE cgd.status = '1' AND cgd.customer_group_id = '0' AND (cgd.date_start = '0000-00-00' OR cgd.date_start < NOW()) ORDER BY cgd.priority ASC, cgd.percentage ASCLIMIT 0, 1) SELECT /*+ MAX_EXECUTION_TIME(10000) */ p.product_id, p.sort_order, "1" AS match_filters, pr_restricted.value AS restrict_customer_group, pr_blocked.value AS block_customer_group, pp.image, pp.model FROM `oc_product` AS p LEFT JOIN cgd ON (1) INNER JOIN `oc_bf_filter_guest` AS f ON (p.product_id = f.product_id) INNER JOIN `oc_product_description` AS pd ON (pd.product_id = p.product_id) LEFT JOIN `oc_product_rule` AS pr_restricted ON (pr_restricted.product_id = p.product_id AND pr_restricted.type = 'restrict_customer_group') LEFT JOIN `oc_product_rule` AS pr_blocked ON (pr_blocked.product_id = p.product_id AND pr_blocked.type = 'block_customer_group') INNER JOIN `oc_product` AS pp ON (pp.product_id = p.product_id) WHERE p.date_available <= NOW() AND p.type NOT LIKE 'option' AND IF(f.filter_group LIKE 'o%', f.out_of_stock = 0, 1 = 1) AND pd.language_id = '1' GROUP BY p.product_id, product_id HAVING match_filters = 1 ORDER BY LCASE(pp.image) ASC, LCASE(pp.model) ASCLIMIT 40, 40
WITH cgd AS ( SELECT cgd.percentage FROM `oc_customer_group_discount` AS cgd WHERE cgd.status = '1' AND cgd.customer_group_id = '0' AND (cgd.date_start = '0000-00-00' OR cgd.date_start < NOW()) ORDER BY cgd.priority ASC, cgd.percentage ASCLIMIT 0, 1) SELECT p.product_id, CASE WHEN psf.price IS NOT NULL THEN p.price WHEN psp.percentage IS NOT NULL THEN p.price WHEN pdf.price IS NOT NULL THEN pdf.price WHEN pdp.percentage IS NOT NULL THEN (100 - pdp.percentage) * p.price / 100 ELSE p.price END AS `before`, (CASE WHEN psf.price IS NOT NULL THEN psf.price WHEN psp.percentage IS NOT NULL THEN (100 - psp.percentage) * p.price / 100 WHEN pdf.price IS NOT NULL THEN pdf.price WHEN pdp.percentage IS NOT NULL THEN (100 - pdp.percentage) * p.price / 100 ELSE p.price END) AS discount, (CASE WHEN psf.price IS NOT NULL THEN psf.price WHEN psp.percentage IS NOT NULL THEN (100 - psp.percentage) * p.price / 100 WHEN pdf.price IS NOT NULL THEN pdf.price WHEN pdp.percentage IS NOT NULL THEN (100 - pdp.percentage) * p.price / 100 ELSE p.price END * IF(psf.price IS NULL AND psp.percentage IS NULL AND (MAX(IFNULL(cgd.percentage, 0)) + MAX(IFNULL(cd.percentage, 0))) < 100, (100 - (MAX(IFNULL(cgd.percentage, 0)) + MAX(IFNULL(cd.percentage, 0)))) / 100, 1)) AS final FROM `oc_product` AS p LEFT JOIN cgd ON (1) LEFT JOIN `oc_product_special` AS psf ON (psf.product_id = p.product_id
AND psf.discount_type = 'F'
AND psf.price > 0
AND (psf.date_start = '0000-00-00' OR psf.date_start < NOW())
AND psf.customer_group_id = '1') LEFT JOIN `oc_product_special` AS psp ON (psp.product_id = p.product_id
AND psp.discount_type = 'P'
AND psp.percentage > 0
AND (psp.date_start = '0000-00-00' OR psp.date_start < NOW())
AND psp.customer_group_id = '1') LEFT JOIN `oc_product_discount` AS pdf ON (pdf.product_id = p.product_id
AND pdf.quantity <= p.minimum
AND pdf.discount_type = 'F'
AND pdf.price > 0
AND (pdf.date_start = '0000-00-00' OR pdf.date_start < NOW())
AND pdf.customer_group_id = '1') LEFT JOIN `oc_product_discount` AS pdp ON (pdp.product_id = p.product_id
AND pdp.quantity <= p.minimum
AND pdp.discount_type = 'P'
AND pdp.percentage > 0
AND (pdp.date_start = '0000-00-00' OR pdp.date_start < NOW())
AND pdp.customer_group_id = '1') LEFT JOIN `oc_product_to_category` AS ptc ON (ptc.product_id = p.product_id) LEFT JOIN `oc_category` AS c ON (c.category_id = ptc.category_id) LEFT JOIN `oc_category_discount` AS cd ON ((cd.category_id = ptc.category_id OR (cd.category_id = c.parent_id AND cd.affect = '1'))
AND cd.status = '1'
AND cd.customer_group_id = '1'
AND cd.qty <= p.minimum
AND cd.qty IS NOT NULL
AND (cd.date_start = '0000-00-00' OR cd.date_start < NOW())) WHERE p.status = '1' AND p.date_available <= NOW() AND p.product_id IN ('10','9') GROUP BY p.product_id ORDER BY psf.priority ASC, psp.priority ASC, psf.price ASC, psp.percentage DESC, pdf.priority ASC, pdp.priority ASC, pdf.price ASC, pdp.percentage DESC, cd.priority ASC, cd.percentage DESC
SELECT p.*, pd.*, m.*, pd.name AS name, p.image, m.name AS manufacturer, md.seo_keyword AS manufacturer_seo_keyword, prw.points AS reward, wcd.unit AS weight_class, lcd.unit AS length_class, AVG(r.rating) AS rating, COUNT(DISTINCT r.review_id) AS reviews, p.sort_order FROM oc_product p LEFT JOIN oc_product_description pd ON (p.product_id = pd.product_id) LEFT JOIN oc_manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN oc_manufacturer_description md ON (p.manufacturer_id = md.manufacturer_id AND md.language_id = '1') LEFT JOIN oc_product_reward prw ON (prw.product_id = p.product_id AND prw.customer_group_id = '1') LEFT JOIN oc_weight_class_description wcd ON (p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '1') LEFT JOIN oc_length_class_description lcd ON (p.length_class_id = lcd.length_class_id AND lcd.language_id = '1') LEFT JOIN oc_review r ON (r.product_id = p.product_id AND r.status = '1') WHERE p.product_id IN (10,9) AND pd.language_id = '1' AND p.status = '1' AND p.date_available <= NOW() GROUP BY p.product_id ORDER BY FIELD(p.product_id,10,9)
WITH cgd AS ( SELECT cgd.percentage FROM `oc_customer_group_discount` AS cgd WHERE cgd.status = '1' AND cgd.customer_group_id = '11' AND (cgd.date_start = '0000-00-00' OR cgd.date_start < NOW()) ORDER BY cgd.priority ASC, cgd.percentage ASCLIMIT 0, 1) SELECT p.product_id, CASE WHEN psf.price IS NOT NULL THEN p.price WHEN psp.percentage IS NOT NULL THEN p.price WHEN pdf.price IS NOT NULL THEN pdf.price WHEN pdp.percentage IS NOT NULL THEN (100 - pdp.percentage) * p.price / 100 ELSE p.price END AS `before`, (CASE WHEN psf.price IS NOT NULL THEN psf.price WHEN psp.percentage IS NOT NULL THEN (100 - psp.percentage) * p.price / 100 WHEN pdf.price IS NOT NULL THEN pdf.price WHEN pdp.percentage IS NOT NULL THEN (100 - pdp.percentage) * p.price / 100 ELSE p.price END) AS discount, (CASE WHEN psf.price IS NOT NULL THEN psf.price WHEN psp.percentage IS NOT NULL THEN (100 - psp.percentage) * p.price / 100 WHEN pdf.price IS NOT NULL THEN pdf.price WHEN pdp.percentage IS NOT NULL THEN (100 - pdp.percentage) * p.price / 100 ELSE p.price END * IF(psf.price IS NULL AND psp.percentage IS NULL AND (MAX(IFNULL(cgd.percentage, 0)) + MAX(IFNULL(cd.percentage, 0))) < 100, (100 - (MAX(IFNULL(cgd.percentage, 0)) + MAX(IFNULL(cd.percentage, 0)))) / 100, 1)) AS final FROM `oc_product` AS p LEFT JOIN cgd ON (1) LEFT JOIN `oc_product_special` AS psf ON (psf.product_id = p.product_id
AND psf.discount_type = 'F'
AND psf.price > 0
AND (psf.date_start = '0000-00-00' OR psf.date_start < NOW())
AND psf.customer_group_id = '11') LEFT JOIN `oc_product_special` AS psp ON (psp.product_id = p.product_id
AND psp.discount_type = 'P'
AND psp.percentage > 0
AND (psp.date_start = '0000-00-00' OR psp.date_start < NOW())
AND psp.customer_group_id = '11') LEFT JOIN `oc_product_discount` AS pdf ON (pdf.product_id = p.product_id
AND pdf.quantity <= p.minimum
AND pdf.discount_type = 'F'
AND pdf.price > 0
AND (pdf.date_start = '0000-00-00' OR pdf.date_start < NOW())
AND pdf.customer_group_id = '11') LEFT JOIN `oc_product_discount` AS pdp ON (pdp.product_id = p.product_id
AND pdp.quantity <= p.minimum
AND pdp.discount_type = 'P'
AND pdp.percentage > 0
AND (pdp.date_start = '0000-00-00' OR pdp.date_start < NOW())
AND pdp.customer_group_id = '11') LEFT JOIN `oc_product_to_category` AS ptc ON (ptc.product_id = p.product_id) LEFT JOIN `oc_category` AS c ON (c.category_id = ptc.category_id) LEFT JOIN `oc_category_discount` AS cd ON ((cd.category_id = ptc.category_id OR (cd.category_id = c.parent_id AND cd.affect = '1'))
AND cd.status = '1'
AND cd.customer_group_id = '11'
AND cd.qty <= p.minimum
AND cd.qty IS NOT NULL
AND (cd.date_start = '0000-00-00' OR cd.date_start < NOW())) WHERE p.status = '1' AND p.date_available <= NOW() AND p.product_id IN ('9','10') GROUP BY p.product_id ORDER BY psf.priority ASC, psp.priority ASC, psf.price ASC, psp.percentage DESC, pdf.priority ASC, pdp.priority ASC, pdf.price ASC, pdp.percentage DESC, cd.priority ASC, cd.percentage DESC
SELECT po.product_id, COUNT(*) AS total FROM oc_product_option po LEFT JOIN `oc_option` o ON (po.option_id = o.option_id) LEFT JOIN oc_option_description od ON (o.option_id = od.option_id) WHERE po.product_id IN (10,9) AND od.language_id = '1' GROUP BY po.product_id