Chapter 7. Migrating from osCommerce to Zen Cart

For several reasons, you may think of migrating from osCommerce to Zen Cart. In fact, people often install osCommerce when start their business. After some time, they discover Zen Cart and find that it has more features to offer than osCommerce. This chapter will show you how to migrate from osCommerce to Zen Cart.

On completion of this chapter, you will learn:

  • Why you need to migrate from osCommerce to Zen Cart.

  • What points you need to consider before migrating to Zen Cart.

  • How to migrate the database, the product catalogue, the product images, and other files in addition to the look and feel of the site.

  • How to minimize interruption to service during migration.

  • How to convert an osCommerce module to a Zen Cart module.

  • What the common problems during migration are, and how to overcome them.

This chapter will show you a step-by-step migration process from osCommerce to Zen Cart.

The Need for Migrating to Zen Cart

Most of the time, the first-time online entrepreneur starts their shops using osCommerce. They choose it because osCommerce has been around for a long time, and is widely used. But after some time, administrators of osCommerce find that it is difficult to customize and lacks so many essential features. They often need to install contributed modules for osCommerce.

osCommerce administrators face the greatest difficulties in customizing its look and feel. As discussed in Chapter 1, osCommerce does not follow an easy to understand template system. Conversely, Zen Cart has improved on its templating system. In Zen Cart, you can apply a new template without modifying the original core files.

osCommerce templates also use extensive HTML which is difficult to edit. The tables are buried in PHP codes. The CSS also needs refining. Zen Cart's HTML is more up-to-date, and easier to edit. Considering this, many developers prefer Zen Cart to osCommerce.

One may migrate to Zen Cart after observing the differences between osCommerce and Zen Cart. The features of Zen Cart and osCommerce are discussed in Chapter 1, Introduction to Zen Cart. You may revisit those and find out why many online shop owners want to migrate to Zen Cart.

Note

Migrating data from one database to another needs some experience in database systems. In the case of migrating osCommerce to Zen Cart, we assume that you are familiar with MySQL and phpMyAdmin. You know how to connect to a database, create/modify tables, and insert data into the tables. Knowledge of relational database management system concepts is a must before attempting the procedures explained in this chapter.

Points to Consider Before Migration

Every migration is complicated. Before migrating data to a new shopping cart, you have to consider the following points:

  • Ensure that your product data is migrated in its original form (as it was in the osCommerce shop).

  • Ensure that critical data, for example, customers, orders, products, product options, prices, and so on are retained as in the original.

  • Ensure that no data is lost during the migration.

Note

Always backup your database before you attempt to modify any tables. As this exercise will deal with two of them, we recommend backing up both databases before proceeding to migration.

Depending on the types of shops you are using, you may fall into one of the following cases:

  1. Migrating from a live osCommerce shop to new Zen Cart shop: You have an osCommerce shop online. You have been using it for years or months, and now you want to migrate to Zen Cart (maybe after reading this book and knowing about Zen Cart's advantages). In this case, migration will be simple. Once you extract data from an osCommerce shop, you can insert it to a new Zen Cart shop database. There will be no issues of conflicting data for the two databases, as the Zen Cart database will have no existing data.

  2. Migrating from a live osCommerce shop to a live Zen Cart shop: Suppose you have two shops running: one on osCommerce, and another on Zen Cart. Now you want to merge these two shops and want to continue with the Zen Cart shop only. In this case, you have to migrate osCommerce data to Zen Cart and at the same time ensure that the Zen Cart shop has minimum interruption. You also have to consider existing data items in Zen Cart. Conflicts may arise during exporting data from osCommerce to Zen Cart as there are some data items already. Problems of duplicate IDs are prominent in this case. You have to resolve these conflicts in order to migrate successfully.

You have to consider some other aspects of migration, depending on what you are migrating - only products and categories, or other data as well. The more data you are trying to migrate, the more complex the process will be. The following sections discuss some other aspects which need to be considered before migration.

Product Catalogue

Zen Cart product catalogue includes product categories and product information including descriptions for the products. osCommerce also follow the same database structure, but product tables in osCommerce have fewer fields than in Zen Cart. This structural difference should be taken into consideration while migrating from osCommerce.

While migrating the product catalogue from osCommerce to Zen Cart, you should also be aware that besides migrating the database we also need to migrate the product images to appropriate folders from osCommerce to Zen Cart.

osCommerce does not support product types. So the default value for the products type field will be used for products imported to Zen Cart. This means that all products will belong to the Product—General type.

If you are migrating other data, such as customers, orders, and so on, besides product catalogues, you have to consider interrelations among these tables. Remember that products are related to orders and orders are also related to customers. Thus, customers are related to some products. These interrelations must be understood beforehand and planned accordingly to decide which tables need to be migrated.

Database Structure

You have to remember that Zen Cart and osCommerce databases are not identical. Some of the tables in Zen Cart database have more fields. However, the fields available in osCommerce tables are mostly available in Zen Cart tables with similar names. For some fields, the data type or length is different. However, this will not create a problem while migrating data from osCommerce to Zen Cart, as new field types and their length in Zen Cart tables can accommodate the original data types and the length of the osCommerce table fields.

Considering the differences in both the databases, you have to understand that all fields in Zen Cart tables will not have values except the default values for those fields. For example, osCommerce categories have no descriptions, but Zen Cart categories have. While exporting osCommerce categories data to Zen Cart, the description field will remain blank. You have to add the descriptions to these fields manually.

Look and Feel

The general look and feel will not be exported to the Zen Cart shop. Usually, Zen Cart shops have their own look and feel, and you can adapt their look and feel to the old osCommerce shop by modifying the Zen Cart template. Customizing the Zen Cart template has been discussed in detail in Chapter 4 , Customizing Look and Feel.

Some other elements of look and feel are the display of product categories, display of product images, and so on. osCommerce cannot have images for categories. Therefore, in Zen Cart, you need to assign icons for categories manually after migration. You also need to transfer the product images to the images directory of Zen Cart installation.

Uninterrupted Service

While migrating your osCommerce products to Zen Cart, you have to ensure that service on both shops remains uninterrupted. If you are migrating from a live shop, ensure that the interruption to the shop is minimal. And also for migrating to a live shop, you have to pay special attention to ensure minimum interruption to services.

It is best to do all preparatory work beforehand and then make the shop offline for some time to complete the migration. Before the actual migration, do some testing on your local server.

As taking the shop offline will not be possible all of the time, you can run the shop in its original location and make a copy in another folder. Then, try to migrate to the new instance of Zen Cart. This will allow you more time to migrate data from osCommerce. Once the instance works fine after migration, make this instance the main shop.

osCommerce versus Zen Cart Database Structure

By now, you will have understood that migration from osCommerce to Zen Cart mainly involves migration of osCommerce categories and products data to the Zen Cart database. Generally, exporting osCommerce data and importing that to Zen Cart database will work if the structures of both the databases are similar, or compatible to each other. In this section, we are going to explore the similarities and differences of the data structure of Zen Cart and osCommerce tables for categories and products.

You can explore the database structure by exporting the structure of both the databases into a .sql file. For this, you can use phpMyAdmin. To export the Zen Cart data structure, login to cPanel (if applicable) and open phpMyAdmin. Then, select the Zen Cart database. Click on the Export tab. Now, select all the tables beginning with:

  • categories_*

  • products_*

In Zen Cart, you have to select the following tables:

  • categories

  • categories_description

  • products

  • products_attributes

  • products_attributes_download

  • products_description

  • products_discount_quantity

  • products_notifications

  • products_options

  • products_options_types

  • products_options_values

  • products_options_values_to_products_options

  • products_to_categories

In the Options section to the right-hand side, check only the Structure. Uncheck all the other options. At the bottom of the page, check Save as File. Now, click on the Go button and save the file with a name such as zendb_structure.sql.

Exporting the osCommerce data structure is similar to exporting the osCommerce data structure. Similarly, you can do it from phpMyAdmin. Select the existing osCommerce database that you want to extract the information from. Click on the Export tab. Under the Export section, highlight all the tables that begin with:

  • Categories_*

  • Products_*

Under the Options section, select the Structure options. At the bottom of the page, check Save as File. Uncheck all other options. Click on Go, save the file with some name, say osc_structure.sql.

Now, open the files in a text editor and compare the tables. An analysis of the tables will show the differences as discussed in the following sections.

Note

You can also use a file comparison utility such as WinMerge or Kompare. Another commercial file comparison tool is Beyond Compare. Use any of these tools, or just open it in text editor and compare manually.

I have used WinMerge to compare Zen Cart v.1.3.8 and the osCommerce MS2.2 database structures. The following sections are based on these findings. Please remember that you may get different results when comparing different versions (different from those I have used).

Tables for Categories

First, compare the categories tables for osCommerce and Zen Cart. The tables are almost similar, except for one field. Zen Cart's categories table has an extra field named categories_status. So, while migrating data from the osc_categories table, you will not get data for this categories_status field. However, this will not create a problem as it takes a default value of 1 (meaning active).

The categories_descriptions table contains descriptions of each category. Both zc_categories_descriptions and osc_categories_descriptions tables are identical. So, migrating data from osc_categories_descriptions table to zc_categories_descriptions will be straightforward.

Tables for Products and Attributes

There are many differences between the zc_products and the osc_products tables. There are at least 22 extra fields in the zc_products table. Fields available in the osc_products table are also available in the zc_products table, although, there are differences amongst common fields. For example, the products_model field in zc_products table is varchar(32) whereas same field in osc_products table is varchar(12). This means that exporting data from osc_products to zc_products is not a problem for this field, but exporting from zc_products to osc_products may create a problem as the zc_products.products_model field is larger than the osc_products.products_model field. On the otherhand, zc_products.product_weight is of float type which is decimal in osc_products. As a float type can accommodate a decimal type, it will not be a problem. Analyzing the structure of both the tables, you can see that exporting data from osc_products to zc_products will be not a problem, but the reverse may be.

Similarly, zc_products_attributes table has 27 fields, whereas the osc_products_attributes table has only 6 fields. These 6 fields are also available in the zc_products_attributes table in an identical form. So, there will be no problem exporting data from osc_products_attributes to the zc_products_attributes table.

Product options are stored in the product_options table. Zc_product_options table has 11 fields while the osc_product_options table has only 3 fields, which are identical to the 3 fields available in the zc_product_options table.

Regarding product options, Zen Cart has an extra table—products_options_types. This table contains three fields: products_options_values_id, language_id, and products_options_values_name. osCommerce has no such table and you will not get these fields.

The Zc_products_options_values table has one extra field - products_options_values_sort_order. The other two fields are identical to osc_products_options_values.

The following tables in both Zen Cart and osCommerce are identical:

  • products_attributes_download

  • products_description

  • products_notifications

  • products_options_values_to_products_options

  • products_to_categories tables are identical

Product types are not supported in osCommerce. So, you will not find the product_music_extra, product_types, product_types_to_category, and product_type_layout tables in osCommerce.

Migrating Databases

First, you have to migrate categories and product data from osCommerce to Zen Cart. We assume that you have installed both osCommerce and Zen Cart, and both are in operation. Now, you want to migrate the product data to Zen Cart. The following is a step-by-step guide for migrating categories and product data from osCommerce to Zen Cart.

Step 1: Backup Existing Data

Back up both the osCommerce and Zen Cart databases. It is always recommended that whenever you make any change manually to the database, you back it up first. Once the data is lost you cannot get it back unless you have a recent backup. For both the databases, backup at least the categories and the products tables. You can do it easily from phpMyAdmin tool by exporting the whole database.

Step 2: Export osCommerce Data

Login to cPanel (if applicable), and open phpMyAdmin. Select the existing osCommerce database that you want to extract information from. Now, click on the Export tab.

Under the Export section, highlight all tables that start with categories_ and products_. You have to select at least the following tables:

  • categories

  • categories_description

  • products

  • products_attributes

  • products_attributes_download

  • products_description

  • products_notifications

  • products_options

  • products_options_values

  • products_options_values_to_products_options

  • products_to_categories

Under the SQL options on the right hand side of the page, check Data and Complete Insert options.

Now, at the bottom of the page, check Save as File. Click on Go, save the file on your hard disk and name it something like osc_data.sql.

Step 3: Import osCommerce Data to Zen Cart

You have already extracted information from the osCommerce database, which needs to be imported to the Zen Cart database. Now, importing to Zen Cart can be simple or complex depending upon your situation:

  1. You may want to migrate osCommerce product data to a new Zen Cart shop. In that case, the Zen Cart shop has no product data. This makes the import from osCommerce simple, as there will be no conflict between the existing and imported categories_id and products_id.

  2. You may want to migrate from an osCommerce store to another Zen Cart shop which already has some categories and products. In that case, importing osCommerce data adds some complexities as you have to consider unique id issues for categories_id and products_id. As there are categories and products already in the Zen Cart shop, some of the ids used by osCommerce categories and products may already be used by the Zen Cart categories and products. You have to ensure that all categories and products have unique ids and the ids are appropriately changed in all related tables.

We will discuss importing data for both cases, but start with the simple migration process.

Migrating to a Zen Cart Shop that does Not have Products

First, let us suppose that we are migrating our osCommerce categories and products to a new Zen Cart shop which has been installed and configured, but no categories or products have yet been added to it. In that case, the categories_* and products_* tables are empty. It may also happen that you have installed sample data, and these tables are populated with the data. In that case, just delete the records from these tables and make them empty.

Once you find the tables empty, you are ready to import the osCommerce data. Start phpMyAdmin, and go to the Import tab. In the File to Import section, click on the browse button and select the osc_data.sql file on your hard disk (which you have saved in Step 2). Then, click on the Go button. Your data will be imported if everything is alright. Otherwise, some error messages will be thrown up, and from those messages, you will get clues to look into the problems.

On the successful completion of the import of the osCommerce product data into the Zen Cart database, you need to import product images from osCommerce. Generally, product images in osCommerce are stored in the /images directory under osCommerce installation root. Copy the images and sub-directories (e.g. dvd, matrox, sierra, and so on) to the /images directory under the Zen Cart installation root. Both the images for categories and for products need to be imported.

You can download two contributions from the Zen Cart website. The first one is osCommerce Data importer contribution by Albert Savage, available for download from http://www.zen-cart.com/index.php?main_page=product_contrib_info& cPath=40_41& products_id=918. This package includes three separate scripts which import customers, products, product description, categories, category descriptions, category structure, specials and reviews. You have to extract the zip file and upload these three scripts to the Zen Cart installation directory. For all the three scripts, you have to configure the following variables:

//Source Database with OSC records
$source_db_host = 'localhost';
$source_db = 'database';
$source_db_username = 'user';
$source_db_password = 'password';
$source_db_table_prefix = '';

The above variables are for the source database, that is, the osCommerce database from which data will be imported. Then, you have to configure variables for the destination database, that is the Zen Cart database to which you want to import the data.

//Target Database with ZEN records
$target_db_host = 'localhost';
$target_db = 'database';
$target_db_username = 'user';
$target_db_password = 'password';
$target_db_table_prefix = '';

After changing the configurations and saving the file, point your browser to one of the above files, for example, http://yourdomain.com/import_osc_customers.php to run the script.

The script will display the progress of exporting and importing data, and finally notify you of its success. You have to run the other two scripts: import_osc_products.php, and import_osc_orders.php as well.

Note

Warning

Remember that running these scripts will erase all product data in the target database. Therefore, use these scripts in a new store only when no product or category data is available.

The second contribution that can be used for importing data from osCommerce to Zen Cart is osCommerce to Zen Cart Conversion Script by Michael Morris, available from http://www.zen-cart.com/index.php?main_page=product_contrib_info& cPath=40_41&products_id=946. This package contains a single script named oscommerceimport.php. Once downloaded, extract the zip package and upload the oscommerceimport.php file in your admin directory. Now, point your browser to the file, that is, http://yourdomain.com/admin/oscommerceimport.php. The page will ask you for the osCommerce database name and the table prefix. Enter this information and click on the Go button. The data from osCommerce will be imported to the Zen Cart database. Like the other script, it will destroy all the product, category, and order data in Zen Cart. As you need to use this script only once, delete the file once the data import is complete.

Migrating to a Zen Cart Shop that has Products

We have already mentioned that when your Zen Cart shop has existing categories and products, importing categories and products from osCommerce database becomes more complex. This is because the Zen Cart categories and products use the same category and product IDs, which results in conflicts of uniqueness of these primary keys. Before importing osCommerce data, we have to modify them in osCommerce to avoid conflict with the Zen Cart table IDs.

First, check the highest ID assigned to categories and products. For example, your existing Zen Cart shop has 66 categories, and the highest value of the categories_id field is 66. You can determine this by running the following query in the Zen Cart database:

SELECT MAX( categories_id )
FROM categories;

This will return the highest value for the categories_id field. Similarly you can get highest value for products_id field:

SELECT MAX(products_id )
FROM products;

It may return something like 181. Now, we have got the values which we cannot have in osCommerce data. In our osCommerce data file, we must not have any category whose categories_id is less than 67, and any product whose products_id is less than 182.

Note

Backup your osCommerce database tables before trying any of the following methods. As the following instructions are going to change the primary keys of some tables, it is crucial that you back up your entire database so that you can get the original data if something goes wrong.

Changing the values of the categories_id and products_id fields is tricky, as these are also used to link to the other tables. The following tables we have selected from the osCommerce database use the categories_id field (as the primary or foreign key):

  • categories (Primary key)

  • categories_description (foreign key)

  • products_to_categories (foreign key)

So, if we change the value of the categories_id for one category, we have to change that value in all these three tables simultaneously. We can use the UPDATE statement for this. As a rule, we may increase the value of all category ids by 100. So we will add 100 to the value of the categories_id field. We can do this by running the following query in the osCommerce database:

UPDATE categories SET categories_id = categories_id + 100;
UPDATE categories_description SET categories_id = categories_id + 100;
UPDATE products_to_categories SET categories_id = categories_id + 100;

These three UPDATE statements will add 100 to the value of the categories_id field.

Note

Warning

Run the above queries only once. Running any of the queries above more than once will give unexpected results, and the relationship between tables will be lost or misleading.

Now, we will update the values of the products_id field. The following tables use the products_id as the primary/foreign key:

  • orders_products (Foreign Key)

  • products (Primary Key)

  • products_attributes (Foreign Key)

  • products_description (Foreign Key)

  • products_notifications (Foreign Key)

Similar to the categories_id, we will change the products_id in these tables by executing the following queries:

UPDATE orders_products SET products_id = products_id + 200;
UPDATE products SET products_id = products_id + 200;
UPDATE products_attributes SET products_id = products_id + 200;
UPDATE products_description SET products_id = products_id + 200;
UPDATE products_notifications SET products_id = products_id + 200;
UPDATE products_to_categories SET products_id = products_id + 200;

These queries will update the products_id values in related tables.

Note

Warning

Run the above queries only once. Running any of the queries more than once will produce unexpected results, and the relationship between tables will be lost or misleading.

There is another thing that we have to update in the categories table. The parent_id field in the categories table indicates the parent category ids. If the value of parent_id is 0, it is the root category, and if it has a value, it is under some category. As we are changing the category's id, we must also change the value of the parent_id to reflect the exact category id. But for root categories, we will not change the parent_id. So, we have to run the following UPDATE statement:

UPDATE categories SET parent_id = parent_id + 100 WHERE parent_id > 0;

We also need to update the products_options_* tables. As the product_options_id field may have duplicate values with Zen Cart the products_options_* tables, we need to increment the values in osCommerce first. Similar to categories and products, determine the highest value of products_options_id in Zen Cart, say 90. Then increment the value of products_options_id in osCommerce tables as follows:

UPDATE products_options SET products_options_id = products_options_id + 100;
UPDATE products_options_values_to_products_options SET products_options_id = products_options_id + 100;

And for updating products_options_values_id, run the following queries (assuming that existing highest value of this field is 95):

UPDATE products_options_values SET products_options_values_id = products_options_values_id + 100;
UPDATE products_options_values_to_products_options SET products_options_values_id = products_options_values_id + 100;

After these updates, you are ready to export data from the osCommerce database. Follow the procedures described in Step 2 to export data from osCommerce. Save the exported data file as osc_data2.sql.

Now, it is time to import osc_data2.sql into the Zen Cart database. Start phpMyAdmin and go to the Import section. In the File to Import section, click on Browse and select the osc_data2.sql file. Then click on the Go button. All data will be imported to the Zen Cart database.

Migrating to a Zen Cart Shop that has Products

Adjusting the Look and Feel

During migration from osCommerce to Zen Cart, you are actually migrating the product, category, order and customer data only, not any .php files from osCommerce. The Zen Cart shop will use its own templates for look and feel. However, you may customize the Zen Cart template to have the same look and feel of the osCommerce store. Customizing of Zen Cart templates has been discussed in Chapter 4, Customizing Look and Feel.

Another thing about look and feel is that osCommerce categories do not use images, but in Zen Cart, you can use images for categories. Assign these icon images for categories.

When you import categories from osCommerce, they do not have images assigned. For a consistent look with other Zen Cart categories, you need to add the category images manually. The following picture shows that only the Fisher Price category shows an image, which has been added manually. But other categories shown have no images, as they have not been imported from osCommerce.

Adjusting the Look and Feel

Also, you have to move the product images to the appropriate directories. In Zen Cart, product images can be stored in separate sub-directories. But in osCommerce, no subdirectory can be used. You have to put all osCommerce product images into your Zen Cart product image folder's root that is, in the images directory. So, move the images from the osCommerce's images directory to Zen Cart's images directory. Then the products will display pictures as shown in the following screenshot:

Adjusting the Look and Feel

Converting osCommerce Modules

In Chapter 1, Introduction to Zen Cart, we discussed some programmatic differences between osCommerce and Zen Cart. These programmatic differences prevent osCommerce modules from working with Zen Cart. If you want to use a osCommerce module in Zen Cart, you need to modify that module first. There are a few general rules for converting osCommerce code to Zen Cart code. You must follow the rules of conversion.

Note

Most of the essential modules are available on the Zen Cart website for your download. Before trying to convert any osCommerce module, first check the Zen Cart website and search for equivalent or alternative modules. Converting an osCommerce module may be your last resort. However, you are always encouraged to do so if you really want to learn how Zen Cart modules work, and if you have enough time to invest in it.

First, osCommerce uses the tep_db_query() and tep_db_fetch_array() functions to run queries on a database and assign the query results to some variable or array. You will find some codes like this:

$my_var_query = tep_db_query("query stuff");
$my_var = tep_db_fetch_array($my_var_query);

In the first line, the query result has been assigned to the $my_var_query variable. It seems that the query result will be a scalar variable. But for the second line, the result is expected to be an array and will be assigned to $my_var. For running queries in Zen Cart, the $db->Execute() function is used. So, whenever you see lines like the above code, replace them with something like the following:

$my_var = $db->Execute("query stuff");

Remember that in Zen Cart, one statement is enough for both scalar and array variables. You do not need to use different functions such as tep_db_fetch_array() just for the arrays.

In osCommerce, both the tep_db_query() and tep_db_fetch_array()functions are used with if and while statements to loop through the results. You will often find the following codes in osCommerce:

$my_var_query = tep_db_query("query stuff"); if ($my_var = tep_db_fetch_array($my_var_query)) {
do_stuff;
}

and

$my_var_query = tep_db_query("query stuff");
while ($my_var = tep_db_fetch_array($my_var_query)) { do_stuff;
}

As Zen Cart does not use those functions, you have to rewrite the above codes as follows:

$my_var = $db->Execute("query stuff");
if (!$my_var->EOF) {
do_stuff;
}

and

$my_var = $db->Execute("query stuff");
while (!$my_var->EOF)
{ do_stuff; $my_var->MoveNext();
}

Note that, in both cases, you have used !$my_var->EOF, which means that until you reach the end of the variable, you have to execute the following instructions.

There is also a difference in referencing query fields. In osCommerce, query fields are referenced as follows:

$my_var_query = tep_db_query("query stuff");
$my_var = tep_db_fetch_array($my_var_query);
$i = $my_var['db_key'];

In Zen Cart, you have to reference the query field as follows:

$i = $my_var->fields['db_key'];

In osCommerce, the number of rows is returned by the tep_db_num_rows($my_var) function. In Zen Cart, you simply use $my_var->RecordCount(). For a new insert id, osCommerce uses the tep_db_insert_id() function, whereas Zen Cart uses a simple $db->Insert_ID() function. Another difference is in declaring $db. In Zen Cart, for every function you have to declare global $db, as all functions refer to $db.

In osCommerce, the session id is referenced by $osCid, which must be changed to $zen_session_id() in Zen Cart. Also, change all the tep_ prefixes in the remaining functions to the zen_ prefixes in Zen Cart.

osCommerce uses registered globals which Zen Cart does not. Instead, Zen Cart uses $_SESSION superglobal. For every registered globals $var, replace it with $_SESSION['var']. Also replace all $HTTP_x_VARS with $_x in Zen Cart. For example, $HTTP_POST_VARS will be $_POST, and $HTTP_GET_VARS will be $_GET. You also need to remove any global $HTTP_x_VARS declaration inside the functions, because new superglobals do not need a global declaration.

These are the changes you need to make to an osCommerce module port into Zen Cart. However, simply importing products from osCommerce to Zen Cart will not need conversion of modules, as Zen Cart has most of the essential modules needed for the online store.

Common Problems during Migration

You may face some problems during migration, most of which are related to the export/import of data. These problems occur when there is a mismatch in your data fields, or there is some existing data with the same primary keys.

As we have discussed earlier, it is more difficult to import data from osCommerce to a Zen Cart shop when it has some categories and products. In this case, you have to ensure that the primary keys for the categories and products tables are unique. Otherwise, conflicts will arise during import. Possible ways to avoid these unique id conflicts are discussed earlier in this chapter.

There may be a problem in displaying products in the appropriate categories. Products in categories may be misplaced if products_id are not appropriately updated in the products_to_categories table. Entries in this table maintain relationships with the products and categories table. So be careful about maintaining these relationships while migrating from osCommerce to Zen Cart.

Summary

In this chapter, you have learned about migrating from osCommerce to Zen Cart. First, you learned about the various scenarios in which you may need to migrate, and points to be considered before migration. Then, you learned the differences between the osCommerce and Zen Cart database structures. Finally, we discussed the actual data migration from osCommerce to Zen Cart, converting osCommerce modules for Zen Cart, and common problems during migration. This chapter discussed only the migration of categories and products data, but other data on customers and orders can also be migrated similarly.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset