mitsi2011 Posted January 31, 2019 Share Posted January 31, 2019 Hello, How can I get the attribute for order's products please. I try this but it's not OK. My result is : Size Color product_attribute_id id_order product_name NULL Red 10 1 Blouse - Color : White, Size : M NULL Orange 13 1 Printed Dress - Color : Orange, Size : S But he mus't : M White 10 1 Blouse - Color : White, Size : M S Orange 13 1 Printed Dress - Color : Orange, Size : S Your help please. Thank you SELECT SQL_CALC_FOUND_ROWS al.`name` AS Size ,al3.`name` AS Color, product_attribute_id, a.id_order, a.product_name FROM `ps_order_detail` a LEFT JOIN `ps_product_lang` pl ON (pl.id_product = a.`product_id` AND pl.id_lang = 1) LEFT JOIN `ps_attribute` att ON (att.`id_attribute` = a.`product_attribute_id` AND att.`id_attribute_group`=1) LEFT JOIN `ps_attribute_group` ag ON (ag.`id_attribute_group` = att.`id_attribute_group` AND ag.`id_attribute_group`=1) LEFT JOIN `ps_attribute_lang` al ON (att.`id_attribute` = al.`id_attribute` AND al.`id_lang` = 1) LEFT JOIN `ps_attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = 1 AND agl.`id_attribute_group`=1) LEFT JOIN `ps_attribute` att3 ON (att3.`id_attribute` = a.`product_attribute_id` AND att3.`id_attribute_group`=3) LEFT JOIN `ps_attribute_group` ag3 ON (ag3.`id_attribute_group` = att3.`id_attribute_group` AND ag3.`id_attribute_group`=3) LEFT JOIN `ps_attribute_lang` al3 ON (att3.`id_attribute` = al3.`id_attribute` AND al3.`id_lang` = 1) LEFT JOIN `ps_attribute_group_lang` agl3 ON (ag3.`id_attribute_group` = agl3.`id_attribute_group` AND agl3.`id_lang` = 1 AND agl3.`id_attribute_group`=3) LEFT JOIN ps_orders o ON (a.id_order = o.id_order) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now