1 | SELECT `Category`.`id`, `Category`.`parent_id`, `Category`.`lft`, `Category`.`rght`, `Category`.`friendly`, `Category`.`meta_description`, `Category`.`meta_keywords`, `Category`.`name`, `Category`.`description`, `Category`.`image`, `Category`.`template`, `Category`.`hidden`, `Category`.`created`, `Category`.`modified` FROM `test_terrace`.`categories` AS `Category` WHERE `Category`.`friendly` = ('t-shirts') ORDER BY `Category`.`lft` ASC | | 1 | 1 | 1 |
2 | SELECT `Category`.`id`, `Category`.`parent_id`, `Category`.`lft`, `Category`.`rght`, `Category`.`friendly`, `Category`.`meta_description`, `Category`.`meta_keywords`, `Category`.`name`, `Category`.`description`, `Category`.`image`, `Category`.`template`, `Category`.`hidden`, `Category`.`created`, `Category`.`modified` FROM `test_terrace`.`categories` AS `Category` WHERE `Category`.`lft` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18) AND `Category`.`hidden` = '0' ORDER BY `Category`.`lft` ASC | | 4 | 4 | 1 |
3 | SELECT `CategoriesProduct`.`product_id` FROM `test_terrace`.`categories_products` AS `CategoriesProduct` INNER JOIN `test_terrace`.`products` AS `Product` ON (`CategoriesProduct`.`product_id` = `Product`.`id` AND `Product`.`parent_id` is null AND `Product`.`hidden` = 0 AND `Product`.`deleted` = 0 AND `Product`.`is_stock_base` = 0) WHERE `CategoriesProduct`.`category_id` IN (1, 1, 5, 9, 15) | | 78 | 78 | 1 |
4 | select colour_id, colour_name, colour_swatch, stock_level from (
select
c.id colour_id,
c.name colour_name,
c.swatch colour_swatch,
pssl.stock_level
from (
select
cp.colour_id,
sum(ifnull(psacp.stock_level, ifnull(psasbp.stock_level, 1))) stock_level
from products pp
inner join products cp on pp.id = cp.parent_id and cp.deleted = 0 and cp.hidden = 0
left join product_stock_audits psacp on cp.id = psacp.product_id and psacp.current = 1
left join product_stock_audits psasbp on cp.stock_base_id = psasbp.product_id and psasbp.current = 1
where
pp.deleted = 0
and pp.hidden = 0
and pp.id in ('11098','12166','12204','12491','12853','13062','13079','13326','13405','13418','13562','13634','14251','14302','14361','14462','14546','14553','14560','14744','14769','14911','14940','14953','15051','15064','15093','15113','15141','15253','15260','15278','15314','15386','15410','15514','15532','15567','15604','15661','15799','15816','15840','15936','15960','15967','16006','16029','16053','16093','16111','16144','16167','16173','16185','16205','16212','16244','16257','16270','16283','16296','16320','16335','16372','16385','16398','16512','16533','16546','16559','16572','16585','16598','16611','16636','16649','16674')
and (
pp.control_stock = 0 and cp.stock_base_id is null
or pp.control_stock = 1 and psacp.stock_level > 0
or cp.stock_base_id is not null and psasbp.stock_level > 0
)
group by cp.colour_id
) pssl
inner join colours c on pssl.colour_id = c.id
) ColourFilterOption; | | 12 | 12 | 10 |
5 | select size_id, size_name, stock_level, size_group_id, size_group_name from (
select
s.id size_id,
s.name size_name,
pssl.stock_level,
sg.id size_group_id,
sg.name size_group_name
from (
select
cp.size_id,
sum(ifnull(psacp.stock_level, ifnull(psasbp.stock_level, 1))) stock_level
from products pp
inner join products cp on pp.id = cp.parent_id and cp.deleted = 0 and cp.hidden = 0
left join product_stock_audits psacp on cp.id = psacp.product_id and psacp.current = 1
left join product_stock_audits psasbp on cp.stock_base_id = psasbp.product_id and psasbp.current = 1
where
pp.deleted = 0
and pp.hidden = 0
and pp.id in ('11098','12166','12204','12491','12853','13062','13079','13326','13405','13418','13562','13634','14251','14302','14361','14462','14546','14553','14560','14744','14769','14911','14940','14953','15051','15064','15093','15113','15141','15253','15260','15278','15314','15386','15410','15514','15532','15567','15604','15661','15799','15816','15840','15936','15960','15967','16006','16029','16053','16093','16111','16144','16167','16173','16185','16205','16212','16244','16257','16270','16283','16296','16320','16335','16372','16385','16398','16512','16533','16546','16559','16572','16585','16598','16611','16636','16649','16674')
and (
pp.control_stock = 0 and cp.stock_base_id is null
or pp.control_stock = 1 and psacp.stock_level > 0
or cp.stock_base_id is not null and psasbp.stock_level > 0
)
group by cp.size_id
) pssl
inner join sizes s on pssl.size_id = s.id
inner join size_groups sg on s.size_group_id = sg.id
) SizeFilterOption; | | 6 | 6 | 9 |
6 | SELECT `Product`.`parent_id` FROM `test_terrace`.`products` AS `Product` LEFT JOIN `test_terrace`.`products` AS `pp` ON (`Product`.`parent_id` = `pp`.`id`) LEFT JOIN `test_terrace`.`product_stock_audits` AS `cpsa` ON (`Product`.`id` = `cpsa`.`product_id` and `cpsa`.`current` = 1) LEFT JOIN `test_terrace`.`product_stock_audits` AS `bpsa` ON (`Product`.`stock_base_id` = `bpsa`.`product_id` and `bpsa`.`current` = 1) WHERE `Product`.`parent_id` IN (11098, 12166, 12204, 12491, 12853, 13062, 13079, 13326, 13405, 13418, 13562, 13634, 14251, 14302, 14361, 14462, 14546, 14553, 14560, 14744, 14769, 14911, 14940, 14953, 15051, 15064, 15093, 15113, 15141, 15253, 15260, 15278, 15314, 15386, 15410, 15514, 15532, 15567, 15604, 15661, 15799, 15816, 15840, 15936, 15960, 15967, 16006, 16029, 16053, 16093, 16111, 16144, 16167, 16173, 16185, 16205, 16212, 16244, 16257, 16270, 16283, 16296, 16320, 16335, 16372, 16385, 16398, 16512, 16533, 16546, 16559, 16572, 16585, 16598, 16611, 16636, 16649, 16674) AND `Product`.`hidden` = '0' AND `Product`.`deleted` = '0' AND ((`pp`.`control_stock` = 0 and `Product`.`stock_base_id` is null) OR (`pp`.`control_stock` = 1 and `cpsa`.`stock_level` > 0) OR (`Product`.`stock_base_id` is not null and `bpsa`.`stock_level` > 0)) GROUP BY `Product`.`parent_id` | | 76 | 76 | 10 |
7 | SELECT `Colour`.`id`, `Colour`.`parent_id`, `Colour`.`lft`, `Colour`.`rght`, `Colour`.`name`, `Colour`.`description`, `Colour`.`swatch`, `Colour`.`code`, `Colour`.`deleted`, `Colour`.`created`, `Colour`.`modified` FROM `test_terrace`.`colours` AS `Colour` WHERE 1 = 1 ORDER BY `Colour`.`lft` ASC | | 23 | 23 | 1 |
8 | SELECT `Size`.`id`, `Size`.`size_group_id`, `Size`.`parent_id`, `Size`.`lft`, `Size`.`rght`, `Size`.`name`, `Size`.`description`, `Size`.`deleted`, `Size`.`created`, `Size`.`modified` FROM `test_terrace`.`sizes` AS `Size` WHERE 1 = 1 ORDER BY `Size`.`lft` ASC | | 18 | 18 | 1 |
9 | SELECT `TaxClass`.`id`, `TaxClass`.`name`, `TaxClass`.`created`, `TaxClass`.`modified` FROM `test_terrace`.`tax_classes` AS `TaxClass` WHERE 1 = 1 | | 3 | 3 | 0 |
10 | SELECT `EffectiveTaxRate`.`id`, `EffectiveTaxRate`.`tax_class_id`, `EffectiveTaxRate`.`effective_date`, `EffectiveTaxRate`.`rate`, `EffectiveTaxRate`.`created` FROM `test_terrace`.`tax_rates` AS `EffectiveTaxRate` WHERE `EffectiveTaxRate`.`effective_date` < NOW() AND `EffectiveTaxRate`.`tax_class_id` = (1) ORDER BY `EffectiveTaxRate`.`effective_date` DESC LIMIT 1 | | 1 | 1 | 1 |
11 | SELECT `EffectiveTaxRate`.`id`, `EffectiveTaxRate`.`tax_class_id`, `EffectiveTaxRate`.`effective_date`, `EffectiveTaxRate`.`rate`, `EffectiveTaxRate`.`created` FROM `test_terrace`.`tax_rates` AS `EffectiveTaxRate` WHERE `EffectiveTaxRate`.`effective_date` < NOW() AND `EffectiveTaxRate`.`tax_class_id` = (2) ORDER BY `EffectiveTaxRate`.`effective_date` DESC LIMIT 1 | | 1 | 1 | 1 |
12 | SELECT `EffectiveTaxRate`.`id`, `EffectiveTaxRate`.`tax_class_id`, `EffectiveTaxRate`.`effective_date`, `EffectiveTaxRate`.`rate`, `EffectiveTaxRate`.`created` FROM `test_terrace`.`tax_rates` AS `EffectiveTaxRate` WHERE `EffectiveTaxRate`.`effective_date` < NOW() AND `EffectiveTaxRate`.`tax_class_id` = (3) ORDER BY `EffectiveTaxRate`.`effective_date` DESC LIMIT 1 | | 1 | 1 | 1 |
13 | SELECT `Product`.`id`, `Product`.`parent_id`, `Product`.`friendly`, `Product`.`name`, `Product`.`purchase_price`, `Product`.`sale_price`, `Product`.`tax_class_id`, `Product`.`default_colour_id`, `Product`.`deleted`, `Product`.`hidden`, `Product`.`control_stock`, `Product`.`low_stock_threshold` FROM `test_terrace`.`products` AS `Product` WHERE `Product`.`parent_id` IS NULL AND `Product`.`hidden` = '0' AND `Product`.`deleted` = '0' AND `Product`.`is_stock_base` = '0' AND `Product`.`id` IN (11098, 12166, 12204, 12491, 12853, 13062, 13079, 13326, 13405, 13418, 13562, 13634, 14251, 14302, 14361, 14462, 14546, 14553, 14560, 14744, 14769, 14911, 14953, 15051, 15064, 15093, 15113, 15141, 15253, 15260, 15278, 15314, 15386, 15410, 15514, 15532, 15567, 15661, 15799, 15816, 15840, 15936, 15960, 15967, 16006, 16029, 16053, 16093, 16111, 16144, 16167, 16173, 16185, 16205, 16212, 16244, 16257, 16270, 16283, 16296, 16320, 16335, 16372, 16385, 16398, 16512, 16533, 16546, 16559, 16572, 16585, 16598, 16611, 16636, 16649, 16674) ORDER BY `Product`.`created` DESC | | 76 | 76 | 2 |
14 | SELECT `ChildProduct`.`id`, `ChildProduct`.`parent_id`, `ChildProduct`.`colour_id`, `ChildProduct`.`size_id`, `ChildProduct`.`deleted` FROM `test_terrace`.`products` AS `ChildProduct` WHERE `ChildProduct`.`deleted` = '0' AND `ChildProduct`.`parent_id` IN (16674, 16649, 16636, 16611, 16598, 16585, 16572, 16559, 16546, 16533, 16512, 16398, 16385, 16372, 16335, 16320, 16296, 16283, 16270, 16257, 16244, 16212, 16205, 16185, 16173, 16167, 16144, 16111, 16093, 16053, 16029, 16006, 15967, 15960, 15936, 15840, 15816, 15799, 15661, 15567, 15532, 15514, 15410, 15386, 15314, 15278, 15260, 15253, 15141, 15113, 15093, 15064, 15051, 14953, 14911, 14769, 14744, 14560, 14553, 14546, 14462, 14361, 14302, 14251, 13634, 13562, 13418, 13405, 13326, 13079, 13062, 12853, 12491, 12204, 12166, 11098) | | 1183 | 1183 | 4 |
15 | SELECT `ProductImage`.`id`, `ProductImage`.`product_id`, `ProductImage`.`colour_id`, `ProductImage`.`image`, `ProductImage`.`full_image`, `ProductImage`.`alternate_text`, `ProductImage`.`title_text` FROM `test_terrace`.`product_images` AS `ProductImage` WHERE `ProductImage`.`product_id` IN (16674, 16649, 16636, 16611, 16598, 16585, 16572, 16559, 16546, 16533, 16512, 16398, 16385, 16372, 16335, 16320, 16296, 16283, 16270, 16257, 16244, 16212, 16205, 16185, 16173, 16167, 16144, 16111, 16093, 16053, 16029, 16006, 15967, 15960, 15936, 15840, 15816, 15799, 15661, 15567, 15532, 15514, 15410, 15386, 15314, 15278, 15260, 15253, 15141, 15113, 15093, 15064, 15051, 14953, 14911, 14769, 14744, 14560, 14553, 14546, 14462, 14361, 14302, 14251, 13634, 13562, 13418, 13405, 13326, 13079, 13062, 12853, 12491, 12204, 12166, 11098) ORDER BY `ProductImage`.`id` ASC | | 216 | 216 | 2 |
16 | SELECT `Discount`.`id`, `Discount`.`description`, `Discount`.`is_percentage`, `Discount`.`value`, `Discount`.`start_date`, `Discount`.`end_date`, `Discount`.`revoked`, `Discount`.`created`, `Discount`.`modified`, `DiscountsProduct`.`discount_id`, `DiscountsProduct`.`product_id` FROM `test_terrace`.`discounts` AS `Discount` JOIN `test_terrace`.`discounts_products` AS `DiscountsProduct` ON (`DiscountsProduct`.`product_id` IN (16674, 16649, 16636, 16611, 16598, 16585, 16572, 16559, 16546, 16533, 16512, 16398, 16385, 16372, 16335, 16320, 16296, 16283, 16270, 16257, 16244, 16212, 16205, 16185, 16173, 16167, 16144, 16111, 16093, 16053, 16029, 16006, 15967, 15960, 15936, 15840, 15816, 15799, 15661, 15567, 15532, 15514, 15410, 15386, 15314, 15278, 15260, 15253, 15141, 15113, 15093, 15064, 15051, 14953, 14911, 14769, 14744, 14560, 14553, 14546, 14462, 14361, 14302, 14251, 13634, 13562, 13418, 13405, 13326, 13079, 13062, 12853, 12491, 12204, 12166, 11098) AND `DiscountsProduct`.`discount_id` = `Discount`.`id`) WHERE NOW() between `Discount`.`start_date` AND `Discount`.`end_date` AND `Discount`.`revoked` = '0' | | 0 | 0 | 1 |
17 | SELECT `Category`.`id`, `Category`.`parent_id`, `Category`.`lft`, `Category`.`rght`, `Category`.`friendly`, `Category`.`meta_description`, `Category`.`meta_keywords`, `Category`.`name`, `Category`.`description`, `Category`.`image`, `Category`.`template`, `Category`.`hidden`, `Category`.`created`, `Category`.`modified` FROM `test_terrace`.`categories` AS `Category` WHERE `Category`.`parent_id` IS NULL AND `Category`.`hidden` = '0' ORDER BY `Category`.`lft` ASC | | 6 | 6 | 1 |