Reduceri de sezon / Pana la -50%
select sql_calc_found_rows
p.`id`, p.`id_brand`,pd.`code`,p.`is_best`,p.`price_promo`,p.`price`,p.`is_seller`,p.`is_seller`,p.`is_new`,p.`is_delivery`,p.`romanesc`,
if((select COUNT(id) from xp_products_variations where id_product=p.id and stock>0)>0,(select COUNT(id) from xp_products_variations where id_product=p.id and stock>0),p.stock) as stock,
pd.`name`, pd.`name_seo`,pd.`code`,p.min_quantity,pd.`short_description`,p.colectie,p.`price_bg`,p.`price_hu`,p.`price_el`,
c.`id_parent`,
cd.`name_seo` category,
pc.`id_category`
from
`xp_products` p
inner join `xp_products_data` pd
on p.`id`=pd.`id_product`
inner join `xp_products_to_categories` pc
on p.`id`=pc.`id_product`
left join `xp_brands` b
on b.`id`=p.`id_brand`
inner join `xp_categories` c
on c.`id`=pc.`id_category`
inner join `xp_currencies` currency
on p.`id_currency`=currency.`id`
inner join `xp_categories_data` cd
on c.`id`=cd.`_id`
where
p.`status`=1 and
pd.`lang`=? and
cd.`lang`=? and
c.`status`=1 and
pc.`id_category` in (108)
and p.`id` in (0,1353,1353,1464,1902,1936,1942,1942,1943,1943,1947,1947,1948,1949,1950,1950,2003,2009,2052,2053,2053,2053,2054,2055,2056,2056,2057,2057,2235,2268,2274,2284,2284,2284,2295,2295,2302,2302,2302,2302,2306,2920,2920,2920,1978,3012,3009,3004,2961,2960,2959,3079,3077)
group by p.id
order by
p.views desc, (stock > 0) desc, p.views desc
limit
0, 50
Reduceri de sezon / Pana la -50%