You get a bonus - 1 coin for daily activity. Now you have 1 coin

Exporting products from PrestaShop to OpenCart

Practice




Exporting products from PrestaShop to OpenCart

how to export at least the products
you need to run several queries separately for products, categories, descriptions


INSERT INTO `opencart_product_description` (`product_id`, `name`, description, meta_description, meta_keyword, language_id)
SELECT
pp.id_product, pl.name, pl.description, pl.description, pl.description, 2
FROM
ps_product pp
JOIN ps_product_lang pl ON pp.id_product = pl.id_product AND id_lang = 2



INSERT INTO `opencart_product_to_category` (`product_id`, `category_id`)
SELECT
id_product,id_category
FROM ps_category_product



INSERT INTO `opencart_product_to_store` (`product_id`, `store_id`)
SELECT
id_product,id_shop
FROM ps_product_shop



UPDATE `opencart_product` SET STATUS =1



INSERT INTO `opencart_category_description` ( `category_id`, `name`, description, meta_description, meta_keyword, language_id)

SELECT
cl.id_category,cl.name,cl.description, cl.name, cl.name,2
FROM
ps_category_lang cl
JOIN ps_category cat ON cat.id_category = cl.id_category AND id_lang = 2


INSERT INTO `opencart_category` (`parent_id`, `category_id`, status)

SELECT
cat.id_parent, cl.id_category,1
FROM
ps_category_lang cl
JOIN ps_category cat ON cat.id_category = cl.id_category AND id_lang = 2



INSERT INTO `opencart_category_to_store` (`category_id`, `store_id`)
SELECT
id_category ,0
FROM ps_category

in order to save the product photos

run the query for the main photos

update opencart_product dd
left join ps_image ps on
dd.product_id=ps.id_product

set image=CON CAT('data/photo/',id_image,'.jpg') where position=1


and before that, from the folder
imgp
unpack all the images regardless of the directory into the folder /image/data/photo/

delete all the files whose names contain words, keep only the files whose names contain letters


query for matching additional prestashop photos from the database
INSERT INTO `opencart_product_image` (`product_id`, `image`,sort_order )
SELECT
id_product ,CON CAT('data/photo/',id_image,'.jpg'),0
FROM ps_image where position>1

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Databases - MySql (Maria DB)"

Terms: Databases - MySql (Maria DB)