Last active
April 27, 2019 16:36
-
-
Save deniscsz/9cfc7ffa97e7024f9376b86950e66b25 to your computer and use it in GitHub Desktop.
Export products from Prestashop 1.6 with categories and filtering by shop_id (no-images)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT ps_product.id_product AS 'product_id', | |
ps_product.upc, | |
ps_product.reference AS 'sku', | |
ps_product.price, | |
ps_product.weight, | |
ps_product.width, | |
ps_product.height, | |
ps_product.depth, | |
ps_product.active AS 'status', | |
ps_product.date_add AS 'created_at', | |
ps_stock_available.quantity AS 'qty', | |
' ' as description_short, | |
REPLACE(ps_product_lang.description, '"', "''") as description, | |
REPLACE(ps_product_lang.name, '"', "''") as name, | |
" " AS 'short_description', | |
ps_product_lang.link_rewrite AS 'url_key', | |
ps_product_lang.meta_title, | |
ps_product_lang.meta_description, | |
'simple' AS 'product_type', | |
'Default' AS | |
attribute_set_code, | |
GROUP_CONCAT(DISTINCT(cl.id_category) SEPARATOR ",") as categories, | |
ps_product.id_shop_default as 'store_id' | |
FROM ps_product | |
LEFT JOIN ps_product_lang | |
ON ps_product.id_product = ps_product_lang.id_product | |
LEFT JOIN ps_stock_available | |
ON ps_product.id_product = ps_stock_available.id_product | |
LEFT JOIN ps_image pi | |
ON ps_product.id_product = pi.id_product | |
AND pi.cover = 1 | |
LEFT JOIN ps_image pi2 | |
ON ps_product.id_product = pi2.id_product | |
AND pi2.position > 2 | |
LEFT JOIN ps_category_product cp | |
ON (ps_product.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) | |
WHERE ps_product.id_shop_default = 3 | |
GROUP BY ps_product.id_product | |
ORDER BY ps_product.id_product | |
LIMIT 100000; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment