select p.products_model, p.products_image, pd.products_name, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id,
case
when s1.specials_new_products_price is not null then
s1.specials_new_products_price
when s.specials_new_products_price is not null then
case when s.specials_new_products_price < p.products_price then s.specials_new_products_price else p.products_price end
else
case when p.products_price < p.products_price then p.products_price else null end
end as specials_new_products_price,
case
when s1.specials_new_products_price is not null then
s1.specials_new_products_price
when s.specials_new_products_price is not null then
case when s.specials_new_products_price < p.products_price then s.specials_new_products_price else p.products_price end
else p.products_price
end as final_price
from products_description pd
left join products p on p.products_id = pd.products_id
left join manufacturers m on p.manufacturers_id = m.manufacturers_id
left join products_to_categories p2c on p2c.products_id = pd.products_id
left join specials s on p.products_id = s.products_id and s.customers_id = 0 and s.status
left join specials s1 on p.products_id = s1.products_id and s1.customers_id = '' and s1.status
where display_datatek = 1
and p2c.categories_id = '295'
and p.products_id = p2c.products_id
and pd.products_id = p2c.products_id
order by p2c.sort_orderpd.products_name limit 0, 20