Export PrestaShop products to CSV

SQL to export categories and products:

select p.id_product,
           pl.name as product_name,
           pl.description as product_description,
           concat('http://', ifnull(conf.value,'example.com'), '/img/p/', p.id_product, '-' , pi.id_image, '.jpg') as product_image,
           cl.name as category_name,
           cl.description as category_description,
           concat('http://', ifnull(conf.value,'example.com'), '/img/c/', cl.id_category, '.jpg') as category_image
from ps_product p
left join ps_image pi on p.id_product = pi.id_product
left join ps_product_lang pl on p.id_product = pl.id_product
left join ps_category_lang cl on p.id_category_default = cl.id_category
left join ps_configuration conf on conf.name = 'PS_SHOP_DOMAIN'
group by p.id_product

SQL to export just categories:

select cl.id_category,
           cl2.name as parent_name,
           concat('http://', ifnull(conf.value,'example.com'), '/img/c/', c.id_category, '.jpg') as url_image,
from ps_category c
inner join ps_category_lang cl on cl.id_category = c.id_category
inner join ps_category_lang cl2 on cl2.id_category = c.id_parent and cl2.id_lang = cl.id_lang
left join ps_configuration conf on conf.name = 'PS_SHOP_DOMAIN'
order by cl.id_lang, c.level_depth

SQL to export just products:

select cl.id_product,
           concat('http://', ifnull(conf.value,'example.com'), '/img/p/', c.id_product, '-' , i.id_image, '.jpg') as url_image,
from ps_product c
left join ps_image i on c.id_product = i.id_product
left join ps_product_lang cl on cl.id_product = c.id_product
left join ps_configuration conf on conf.name = 'PS_SHOP_DOMAIN'
group by cl.id_product
order by cl.id_lang

enjoy 😛

11 thoughts on “Export PrestaShop products to CSV

Leave a Reply

Your email address will not be published.