Jump to content

Can anyone tell me what this sql statement does?


Recommended Posts

SELECT pa.id_product_attribute as variant_id, p.id_product as product_id, replace(l.language_code,'nl', 'nl_BE') as 'locale'

FROM ps_product p

inner JOIN ps_product_lang pl ON ( p.id_product = pl.id_product )

inner JOIN ps_product_attribute pa ON ( p.id_product = pa.id_product )

inner JOIN ps_lang l ON (pl.id_lang = l.id_lang)

WHERE l.language_code in('nl')

and p.active=1

-- and pa.active=1





SELECT concat('dv_',cp.id_product) as variant_id,cp.id_product as product_id, 'nl_BE' as 'locale'


ps_category_product cp

inner join ps_category c on (c.id_category = cp.id_category)

inner join ps_category_lang cl on (cp.id_category = cl.id_category)

inner join ps_product p on (cp.id_product = p.id_product)




and c.active = true

and p.active = 1


and not exists (

select child_cp.id_category

from ps_category_product child_cp

inner join ps_category child_c on ( child_cp.id_category = child_c.id_category)

inner join ps_product child_p on ( child_cp.id_product = child_p.id_product)


child_cp.id_product = cp.id_product

and child_c.nleft > c.nleft

and child_c.nright < c.nright

and child_c.active=true

and child_p.active=1)


group by variant_id



ORDER by product_id, variant_id

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...