SELECT DISTINCT p.products_id, p.products_price_tax, pd.products_name, cu.value, cu.currencies_marza, (p.products_price_tax/cu.value)+(cu.value*cu.currencies_marza/100) AS cena
FROM products p
LEFT JOIN currencies cu ON cu.currencies_id = p.products_currencies_id
LEFT JOIN products_to_categories ptc ON ptc.products_id = p.products_id
LEFT JOIN products_description pd ON pd.products_id = p.products_id AND pd.language_id = '2'
WHERE ptc.categories_id in (1045,1145,1174,1176,1175,1144,1147,1170,1115,1146,1120,1116,1126,1128,1125,1148,1143,1149,1117,1142,1178,1181,1213,1141,1127,1122,1214,1215,1124,1119,1118,1173,1121) AND
p.products_status = '1' and p.listing_status = '0' and ( (p.customers_group_id = '0' or p.customers_group_id = '' ) )
ORDER BY p.sort_order desc, pd.products_name LIMIT 0,24