select count(p.products_id) as total from (products p, products_description pd, manufacturers m)
left join specials s on p.products_id = s.products_id
where p.products_status = '1'
and pd.products_id = p.products_id
and pd.language_id = '1'
and p.manufacturers_id = m.manufacturers_id
and m.manufacturers_id = '77'
and (p.products_quantity > 0 or p.products_date_available >= (now() - interval 1 day)) and p.paypal_blocked = 0
select p.products_image, pd.products_name, p.products_id, p.manufacturers_id, p.products_price, p.products_base_price,
p.products_quantity, p.products_tax_class_id, p.products_sort_order, p.products_date_available,
if(s.status, s.specials_new_products_price, null) as specials_new_products_price,
if(s.status, s.specials_new_products_price, p.products_price) as final_price
from (products p, products_description pd, manufacturers m)
left join specials s on p.products_id = s.products_id
where p.products_status = '1'
and pd.products_id = p.products_id
and pd.language_id = '1'
and p.manufacturers_id = m.manufacturers_id
and m.manufacturers_id = '77'
and (p.products_quantity > 0 or p.products_date_available >= (now() - interval 1 day)) and p.paypal_blocked = 0 order by p.products_date_added desc, pd.products_name, p.products_id