First of all your manufacturers must be already in your Prestashop store, with the same name as exists in your OSCommerce store.
Data columns to export:
'p' is products table alias, 'pd' is products_description alias
- p.products_id
- p.products_code
- pd.products_name
- pd.products_description
- p.products_price
- p.products_quantity
- p.products_image
The data is ordered by Manufacturer name, product code and product name columns in Ascending order.
-
Execute the query on your OSCommerce Database
SELECT m.manufacturers_name, p.products_id, p.products_code, pd.products_name, pd.products_description, p.products_price, p.products_quantity, p.products_image FROM products p LEFT JOIN products_description pd ON pd.products_id = p.products_id LEFT JOIN manufacturers m ON m.manufacturers_id = p.manufacturers_id WHERE p.products_status <> 0 ORDER BY m.manufacturers_name, p.products_code, pd.products_name ASC
-
Save the result as CSV with name
products.csv
inside the import_from_oscommerce script folder.IMPORTANT Export in CSV with the colum names on first row, use (options from phpmyadmin):
Columns separated with: ; Columns enclosed with: " Columns escaped with: \ Replace NULL with: NULL
Import steps executed by script import.php or import-web.php:
- Creates a multi dimensional array with key = manufacturer name and value as an array with all products from that manufacturer;
- Traverse the created array, find the Manufacturer from Prestashop base, save its ID for futher use
- For each product of the manufacturer found Create the Prestashop Product instance, persist it; Load the image from OSCommerce url that points to products_image value; Persist the image to Prestashop base relative to the persisted product;
- Run
import.php
via SSH or, if no SSH session, runimport-web.php
from your browser - Run
categorize.php
via SSH or, if no SSJ session, runcategorize-web.php
from your browser
- Remove all products using the prestashop backend
- Truncate poducts table in MySQL DB
TRUNCATE
ps_product
; TRUNCATEps_product_attachment
; TRUNCATEps_product_attribute
; TRUNCATEps_product_attribute_combination
; TRUNCATEps_product_attribute_image
; TRUNCATEps_product_attribute_shop
; TRUNCATEps_product_carrier
; TRUNCATEps_product_comment
; TRUNCATEps_product_comment_criterion_product
; TRUNCATEps_product_comment_grade
; TRUNCATEps_product_comment_report
; TRUNCATEps_product_comment_usefulness
; TRUNCATEps_product_country_tax
; TRUNCATEps_product_download
; TRUNCATEps_product_group_reduction_cache
; TRUNCATEps_product_lang
; TRUNCATEps_product_sale
; TRUNCATEps_product_shop
; TRUNCATEps_product_supplier
; TRUNCATEps_product_tag
; - Delete only the folders on /img/p (folders named with numbers)
This will only generate a list with all products to import, no data will be imported.
- Run
import-confirmar.php
in your browser.