Jump to content

Kombinációk listázása SQL Managerrel


KöveZoli

Recommended Posts

Sziasztok,

 

Nem tudom, volt-e már, de íme egy lekérdezés a kombinációkhoz:

 

SELECT
p.id_product,
pa.reference,
pl.name,
GROUP_CONCAT(DISTINCT(pal.name) SEPARATOR ", ") as combination,
p.price,
pq.quantity
FROM ps_product_attribute pa
LEFT JOIN ps_product p ON (p.id_product = pa.id_product)
LEFT JOIN ps_stock_available pq ON (p.id_product = pq.id_product AND pa.id_product_attribute = pq.id_product_attribute)
LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product)
LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute)
LEFT JOIN ps_attribute_lang pal ON (pac.id_attribute = pal.id_attribute)
WHERE pl.id_lang = 2
AND pal.id_lang = 2
GROUP BY pa.reference
ORDER BY p.id_product, pac.id_attribute

 

A szülő termék (én csak így hívom a termék alapot) ID-ját, a kombináció nevét, cikkszámát, a kombinációt(pl: fekete,XS), az árat és a mennyiséget listázza ki.

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...