我有一个问题,我找不到任何答案。我需要获得所有prestashop产品名称,描述和价格。有没有人有代码示例或只是知道如何做到这一点。
答案 0 :(得分:0)
转到高级参数 - > SQL管理器并添加并运行以下查询:
SELECT
a.`id_product`,
b.`name` AS `name`,
b.`description`,
`reference`,
a.`price` AS `price`
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_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`
AND pd.`active` = 1
)
WHERE
1
ORDER BY
a.`id_product` ASC
您也可以将其导出为CSV。它比你需要它复杂一点,因为它是由Prestashop"导出到SQL管理器"生成的。您可以在产品视图中找到的功能。