We build custom web applications
to grow your business.

Migrating MySql tables from Volusion to Opencart - Ten Steps Convert

volusion to opencart conversionBoth Volusion and Opencart are wonderful tools for e-commerce. Both give you many shipping and check-out options. However, while Volusion provides technical support (because it is a paid service) and Opencart does not (because it is a open source platform) Opencart provides greater flexibility in rewrite some of the codes in order to tailor the sites functionality to your fancy. And although Opencart is written in OOP via the MVC approach (a little more difficult to grasp at first glance) it does affords the experience developer a great platform to integrate other elements into an e-commerce site. So here is a simple way to get started migrating from Volusion to Opencart 1. First, do an export from the product table using Volusion's export option in admin 2. Upload the file to the MySql table. Name it product_volusion 3. Copy productprice and productweight columns from product_volusion table to Opencart price and weight columns in the product table

INSERT INTO product (product_id, model, image, price, weight) SELECT id, productcode, productprice, productweight FROM product_volusion
4. Next, copy the product_volusion table columns: id, productname, productdesction, productdescription_abovepricing, metatag_description, metatag_keywords into Opencart's product_description table
INSERT INTO product_description (product_id, name, description, meta_description, meta_keyword) SELECT id, productname, CONCAT (productdescription,' ',productdescription_abovepricing), metatag_description, metatag_keywords FROM product_volusion
5.Add your categories from the Opencart admin area. Then go back to your table and update the product_volusion table with the new category_ids
update product_volusion, category_description set product_volusion.category_id = category_description.category_id WHERE product_volusion.categorytree = category_description.name Insert the new categories into the product_to_category table insert into`product_to_category` (product_id, category_id) SELECT id, category_id FROM product_volusion
6. If language is set to 0 product may not populate on the categories menu
update `product_description` set language_id = 1
7. Make all products be assigned to the default store
insert into product_to_store (product_to_store.product_id) SELECT product.product_id from product
8. Change all products quantity to more than one and status to '1'
update `product` set quantity = 100 update `product` set status = 1
9. Images will not show on the webpage unless the product id is inserted into this table
insert into product_to_store (product_id) SELECT product.id from product
10. By this stage your content should populate. Create folders in the data folder in the image directory. Add you images there, then log into admin and assign the images to the products

Getting all your images from Volusion

Here is a script that will scrap all your secondary images from Volusion. You have the name of the primary product image in your product table, extracted from your volusion table in step 3. Use a similar technique to get the primary image // first get the model number from each row. The model number is part of the image name // add a number 3 plus to image name to create subsequent images
$query = $db->query("SELECT model FROM product"); if ($query->num_rows) { foreach ($query->rows as $result) { $model = trim($result['model']); for($pid = 3; $pid <= $numb; $pid++): $row .= "http://www.yourwebsite.com/v/vspfiles/photos/$model-$pid.jpg |"; endfor; } } //echo $row; // save image function // this function will save the images to a folder function save_image($sourcePath,$targetPath) { $in = fopen($sourcePath, "rb"); $out = fopen($targetPath, "wb"); while ($chunk = fread($in,8192)) { fwrite($out, $chunk, 8192); } fclose($in); fclose($out); } // check for 404 // if the image url is 404 do not use function check404($url, $db) { $handle = curl_init($url); curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE); /* Get the HTML or whatever is linked in $url. */ $response = curl_exec($handle); /* Check for 404 (file not found). */ $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE); if($httpCode == 404) { echo 'this is 404'.$url; } else { // URL image old name number preg_match('/[0-9]{5}/', $url, $match); // url image number preg_match('/-[0-9]{1}/', $url, $num); $imageNumber = str_replace('-', '', $num[0]); $query = $db->query("SELECT product_id, model, image FROM product WHERE model LIKE '%$match[0]%'"); if ($query->num_rows) { foreach ($query->rows as $result) { $image = $result['image']; // new image preg_match('/[^.]+/', $image, $newimage); $newimage= str_replace('data/', '', $newimage[0]); $newimage .= "-$imageNumber"; echo $newimage.' '; // update table $query = $db->query("INSERT INTO product_image SET image = 'data/product-images/".$newimage.".jpg', product_id = '".$result['product_id']."'"); } } $target = dirname(__FILE__)."/folder-to-save-images/$newimage.jpg"; //where to save images with new name save_image($url,$target); $url = ''; curl_close($handle); } } // the array of image url are split up into strings $rows = explode('|', $row); foreach($rows as $row): check404($row, $db); endforeach;
Once this is done, move the images into the data folder in the image directory