從Prestashop 1.7數據庫導出產品和類別數據包含圖像和說明

這次我需要從Prestashop 1.7產品目錄(產品ID,產品名稱,產品圖像陣列,產品類別,產品長描述,產品簡短描述)以及類別(類別ID,類別描述,類別圖像,類別名稱) 。

我不想使用一個模塊,所以我從phpMyAdmin開始。
我們提出了兩個查詢,第一個用于導出目錄中的所有產品,第二個用于導出類別。

對于產品:

SELECT p.id_product, p.active, pl.name, GROUP_CONCAT(DISTINCT(cl.name) SEPARATOR ",") as categories,GROUP_CONCAT(DISTINCT(im.id_image) SEPARATOR ",") as images, p.price, p.id_tax_rules_group, p.wholesale_price, p.reference, p.supplier_reference, p.id_supplier, p.id_manufacturer, p.upc, p.ecotax, p.weight, p.quantity, pl.description_short, pl.description, pl.meta_title, pl.meta_keywords, pl.meta_description,CONVERT(pl.meta_description USING utf8), pl.link_rewrite, pl.available_now, pl.available_later, p.available_for_order, p.date_add, p.show_price, p.online_only, p.condition, p.id_shop_default
FROM ps_product p
LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product)
LEFT JOIN ps_category_product cp ON (p.id_product = cp.id_product)
LEFT JOIN ps_category_lang cl ON (cp.id_category = cl.id_category)
LEFT JOIN ps_category c ON (cp.id_category = c.id_category)
LEFT JOIN ps_product_tag pt ON (p.id_product = pt.id_product)
LEFT JOIN ps_image im ON (im.id_product = p.id_product)
WHERE pl.id_lang = 1
AND cl.id_lang = 1
AND p.id_shop_default = 1 AND c.id_shop_default = 1
GROUP BY p.id_product

 

對于類別:


select cl.id_category,
cl2.name as parent_name,
cl.name,
cl.description,
cl.link_rewrite,
concat('http://', ifnull(conf.value,'example.com'), '/img/c/', c.id_category, '.jpg') as url_image,
cl.id_lang
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


上一篇:如何更改找回Prestashop 1.7中的管理員密碼 下一篇:prestashop1.6版本nginx偽靜態規則