Tom Muck

Alpha Dog Blues Band
Home page
All articles
All Extensions | Extension News | Extension FAQs | Customer Login
Books authored or co-authored by Tom Muck
Extensions, books, and other products | Customer Login
Your current cart contents
Tom-Muck.com Blog | CMXTraneous Blog | Flash Remoting Blog
About the site

Importing Products

Importing Existing Products/Categories tables

First, import your products table as is into the Cartweaver database. Name it "Products". Don't worry about matching fields at this point. Make sure you have a product ID field, and if not create one before proceding.

Next, write an INSERT statement to match fields from Products to tbl_products, for example the following (make sure you map all required fields, such as product_Sort and product_Archive):

INSERT tbl_products
(product_ID,
product_MerchantProductID,
product_Name,
product_ShortDescription,
product_Description,
product_Sort,
product_Archive )

SELECT
productid as product_ID,
ccode as product_MerchantProductID,
productname as product_Name,
shortdescription as product_ShortDescription,
extendeddesc as product_Description,
0 as product_Sort,
0 as product_Archive
FROM dbo.products

Next, insert rows into the tbl_skus table. If your existing products table did not use skus, simply import Products into tbl_skus matching one product per sku:

INSERT INTO tbl_skus
(SKU_ID,
SKU_MerchSKUID,
SKU_ProductID,
SKU_Price,
SKU_Weight,
SKU_Stock,
SKU_ShowWeb,
SKU_Sort)
VALUES

SELECT
productid as SKU_ID,
ccode as SKU_MerchSKUID,
price as SKU_Price,
0 as SKU_Weight,
0 as SKU_Stock,
1 as SKU_ShowWeb,
0 as SKU_Sort
FROM dbo.products

To fill the product images, copy data to the tbl_prdtimages for both thumbnail and large images:

INSERT tbl_prdtimages

(prdctImage_ProductID,
prdctImage_ImgTypeID,
prdctImage_FileName,
prdctImage_SortOrder)

SELECT productid as prdctImage_ProductID,
1 as prdctImage_ImgTypeID,
smallimage as prdctImage_FileName,
0 as prdctImage_SortOrder
FROM Products

INSERT tbl_prdtimages

(prdctImage_ProductID,
prdctImage_ImgTypeID,
prdctImage_FileName,
prdctImage_SortOrder)

SELECT productid as prdctImage_ProductID,
2 as prdctImage_ImgTypeID,
largeimage as prdctImage_FileName,
0 as prdctImage_SortOrder
FROM Products

To use categories, import the existing categories table if on exists and insert the data into tbl_prdtcategories:

INSERT dbo.tbl_prdtcategories
(category_ID, category_Name, category_Archive, category_sortorder)

SELECT categoryid as category_ID,
catdescription as category_Name,
0 as category_Archive,
0 as category_Sortorder
FROM categories

Finally, match the products/categories in the tbl_prdtcat_rel:

INSERT tbl_prdtcat_rel
(prdt_cat_rel_Product_ID, prdt_cat_rel_Cat_ID)

SELECT productid as prdt_cat_rel_Product_ID,
categoryid as prdt_cat_rel_Cat_ID
FROM Products

Do this on a test database first so that you can test out the results.

Back to Cartweaver PHP FAQ, code changes, and samples

Pay me securely with your Visa, MasterCard, Discover, or American Express card through PayPal!
Pay me securely with your Visa, MasterCard, Discover, or American Express card through PayPal!
About | Privacy Policy | Contact | License Agreement | ©2002-2025 Tom Muck | Dreamweaver Extensions