Jump to content

Show the Product attribute values seperated by comma in Prestashop backend product list


Recommended Posts

Prestashop I want to display the product all combinations seperated by comma in admin product list, like (id, image, name, combinations) How to I get all combination and products list in One query

 

id  image     name            attributes

12               xxxxx             size 21, count 15 

13               xxxxx             size 15, count 18 

like this. 

 

I have tried to get attribute values following query But I want to get all details in single row. 

 

SELECT a.`id_product`, ml.`name` AS `brand`, b.`name` AS `name`, pal.`name` AS `size`, pal.`name` AS `count`, sl.`name` AS `supplier`, a.`price` AS `price`, sa.`active` AS `active`

, shop.`name` AS `shopname`, a.`id_shop_default`, ml.`name` As brandName, sl.`name` As supplierName, pac.`id_attribute` AS IDA,  pal.`name` AS atrib_name,  shop.`name` AS `shopname`, a.`id_shop_default`, image_shop.`id_image` AS `id_image`, cl.`name` AS `name_category`, sa.`price`, 0 AS `price_final`, a.`is_virtual`, pd.`nb_downloadable`, sav.`quantity` AS `sav_quantity`, sa.`active`, IF(sav.`quantity`<=0, 1, 0) AS `badge_danger`
FROM `ps_product` a 
LEFT JOIN `ps_product_lang` b ON (b.`id_product` = a.`id_product` AND b.`id_lang` = 1 AND b.`id_shop` = 1)
LEFT JOIN `ps_manufacturer` ml ON (a.`id_manufacturer` = ml.`id_manufacturer`)
LEFT JOIN `ps_supplier` sl ON (a.`id_supplier` = sl.`id_supplier`)
LEFT JOIN `ps_product_attribute_combination` pac ON (a.`cache_default_attribute` = pac.`id_product_attribute`)
LEFT JOIN `ps_attribute_lang` pal ON (pac.`id_attribute` = pal.`id_attribute` AND pal.id_lang = 1)
LEFT JOIN `ps_attribute` patz ON (pac.`id_attribute` = patz.`id_attribute` AND patz.id_attribute_group = 1 OR patz.id_attribute_group = 7)
LEFT JOIN `ps_attribute` patc ON (pac.`id_attribute` = patc.`id_attribute` AND patc.id_attribute_group = 7)
LEFT JOIN `ps_stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0
AND sav.id_shop = 1  AND sav.id_shop_group = 0 )  JOIN `ps_product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = a.id_shop_default)
LEFT JOIN `ps_category_lang` cl ON (sa.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = a.id_shop_default)
LEFT JOIN `ps_shop` shop ON (shop.id_shop = a.id_shop_default)
LEFT JOIN `ps_image_shop` image_shop ON (image_shop.`id_product` = a.`id_product` AND image_shop.`cover` = 1 AND image_shop.id_shop = a.id_shop_default)
LEFT JOIN `ps_image` i ON (i.`id_image` = image_shop.`id_image`)
LEFT JOIN `ps_product_download` pd ON (pd.`id_product` = a.`id_product`) 
WHERE 1  
 
ORDER BY a.`id_product` ASC  LIMIT 0, 50

 

Link to comment
Share on other sites

  • 6 months later...

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