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hdGVnb3JpZXNGaWx0ZXIuZmluZCgnLmNhdGVnb3J5LW1lbnUnKS5maXJzdCgpLmFkZENsYXNzKCdpbicpO1xyXG4gICAgICAgICAgICBjYXRlZ29yaWVzRmlsdGVyLmZpbmQoJy5tYWluRmlsdGVyIGknKS5maXJzdCgpLmFkZENsYXNzKCdmYS1hbmdsZS11cCcpLnJlbW92ZUNsYXNzKCdmYS1hbmdsZS1kb3duJyk7XHJcbiAgICAgICAgfVxyXG5cclxuICAgIH0pO1xyXG4iXQ==[/SCR_P]
1016 -
select count(1) as total from ( select * from (select distinct p.products_id, p.mg_rubro, IF(p.product_grouper_id, CONCAT("g_", p.product_grouper_id), p.products_id) as p_group_id, (p.products_quantity - IF(p.products_min_stock_to_sell IS NULL,0,p.products_min_stock_to_sell)) as products_quantity, p.products_quantity_future, CONCAT (c.categories_id) AS categories_id, (p.product_grouper_id IS NOT NULL) as is_grouped, IF(p.product_grouper_id && mpg.code != "" , mpg.code, p.products_model) as products_model , IF(p.product_grouper_id, mpg.name, pd.products_name) as products_name, p.products_date_added as pdate_added, tr.tax_priority from products p inner join products_description pd on p.products_id = pd.products_id and pd.language_id inner join categories c on c.categories_id = main_category_id left join specials s on p.products_id = s.products_id and s.status = 1 and (s.expires_date is null or DATE(s.expires_date) = "0000-00-00" or DATE(CURDATE()) <= DATE(s.expires_date) ) and ( s.start_date is null or DATE(CURDATE()) >= DATE(s.start_date) ) left join mods_configurable_products_prices mcpp on p.products_id = mcpp.products_id left join mods_product_groupers mpg on p.product_grouper_id = mpg.id AND mpg.is_rentable = 0 left join manufacturers m on p.manufacturers_id = m.manufacturers_id inner join (SELECT * FROM dummy_categories ORDER BY categories_order) as categories_ordered on main_category_id = categories_ordered.categories_id left join tax_rates tr on p.products_tax_class_id = tr.tax_class_id left join zones_to_geo_zones gz on tr.tax_zone_id = gz.geo_zone_id where c.categories_status = 1 and p.products_status = 1 and p.is_rentable = 0 and (p.products_price > 0 or p.show_priceless = 1) and p.configurable_products_only = 0 and ( gz.zone_country_id is null or gz.zone_country_id = 0 or gz.zone_country_id = 0) and ( gz.zone_id is null or gz.zone_id = 0 or gz.zone_id = 0) and p.manufacturers_id in (261) group by p.products_id, tr.tax_priority order by IF((p.products_quantity - IF(p.products_min_stock_to_sell IS NULL,0,p.products_min_stock_to_sell)) > 0, 1, 0) desc, p.order_in_grouper asc, p.products_price asc, CASE WHEN (p.products_quantity - IF(p.products_min_stock_to_sell IS NULL,0,p.products_min_stock_to_sell)) < 1 THEN -1 WHEN (p.products_quantity - IF(p.products_min_stock_to_sell IS NULL,0,p.products_min_stock_to_sell)) >= 0 THEN -2 ELSE 1 END asc, categories_ordered.categories_order asc, p.orden asc, products_name asc, p.products_model asc) as tabla group by p_group_id ) as aux_paging
[TEP STOP]