Results 1 to 8 of 8

Thread: Importing Orders

  1. #1
    Member dmm2020's Avatar
    Join Date
    Apr 2010
    Posts
    45
    Thanks
    0
    Thanked 93 Times in 18 Posts

    Smile Importing Orders

    I need to import orders from the old database. I already have the products imported and made sure the product ID matches what I am going to import.

    How do you suggest I go about importing the orders over since they are multiple table laid out?

    What are the minimum fields I need to populate so that the import don't crash the cart?

    Essentially I am going to import everything based on username as the link (join).

    Do I also need to import the customer data over OR is that going to happen automatically as soon as the member enters our store?

  2. #2
    Developer Greystoke's Avatar
    Join Date
    Mar 2010
    Posts
    187
    Thanks
    2
    Thanked 499 Times in 113 Posts

    Default

    Is the old database from osCommerce or from vB Osc Shopping Cart Pro.

  3. #3
    Member dmm2020's Avatar
    Join Date
    Apr 2010
    Posts
    45
    Thanks
    0
    Thanked 93 Times in 18 Posts

    Default

    Neither:

    below is the table structure of existing orders table so far:

    CREATE TABLE IF NOT EXISTS `orders` (
    `primkey` int(11) NOT NULL auto_increment,
    `invoice` int(11) NOT NULL default '0',
    `product` int(11) NOT NULL default '0',
    `quantity` int(11) NOT NULL default '0',
    `coupon` varchar(32) NOT NULL default '',
    `status` varchar(255) NOT NULL default '',
    `user` int(11) NOT NULL default '0',
    `serial` varchar(255) NOT NULL default '',
    `agareskey` varchar(255) NOT NULL default '',
    `date` timestamp NOT NULL default CURRENT_TIMESTAMP,
    `username` varchar(100) default NULL,
    PRIMARY KEY (`primkey`)

    I am thinking it's WP-Cart but prefix is elgg_ for most of tables in database I drew the orders SQL from.

  4. #4
    Developer Greystoke's Avatar
    Join Date
    Mar 2010
    Posts
    187
    Thanks
    2
    Thanked 499 Times in 113 Posts

    Default

    So when a customer from the old database creates a new account, you want to add their orders from your old shop.
    This isn't going to be easy as fields and tables are more than likely going to be totally different as its not oscommerce.

    First off their old customer id is not going to be the same, so you will have to make sure that when you are importing their old orders that they get assigned to the new current customer id.

    If you send me the database, I will take a look.

  5. #5
    Member dmm2020's Avatar
    Join Date
    Apr 2010
    Posts
    45
    Thanks
    0
    Thanked 93 Times in 18 Posts

    Default

    The database is HUGE so sending the database will not work. I have to export it in bits and pieces. That's why I am linking the username when I do the SQL than the userid.

    I am a database programmer and do know how to export via SQL. I just need to know what has to be populated and how each of the customer and order tables are linked so that whole order is displayed online when done. I do know the order history will be non-existent as hold database does not provide for order history.

  6. #6
    Developer Greystoke's Avatar
    Join Date
    Mar 2010
    Posts
    187
    Thanks
    2
    Thanked 499 Times in 113 Posts

    Default

    When an order is placed, it is added to the tables:

    osc_orders
    osc_orders_products
    osc_orders_products_attributes (only that product has attributes)
    osc_orders_status_history
    osc_orders_total


    Here is an example of what got inserted into the database when a product was purchased:

    PHP Code:
    insert into osc_orders (orders_idcustomers_idcustomers_namecustomers_companycustomers_street_addresscustomers_suburbcustomers_citycustomers_postcodecustomers_statecustomers_countrycustomers_telephonecustomers_email_addresscustomers_address_format_iddelivery_namedelivery_companydelivery_street_addressdelivery_suburbdelivery_citydelivery_postcodedelivery_statedelivery_countrydelivery_address_format_idbilling_namebilling_companybilling_street_addressbilling_suburbbilling_citybilling_postcodebilling_statebilling_countrybilling_address_format_idpayment_methodcc_typecc_ownercc_numbercc_expireslast_modifieddate_purchasedorders_statusorders_date_finishedcurrencycurrency_valuevalues ('2''1''name''''street''suburb''city''postcode''state''country''tele no''email''1''name''''street''suburb''city''postcode''state''country''1''name''''street''suburb''city''postcode''state''country''1''Cash on Delivery'''''''''NULL'2010-06-04 03:35:34''1'NULL'USD''1.000000');
    insert into osc_orders_products (orders_products_idorders_idproducts_idproducts_modelproducts_nameproducts_pricefinal_priceproducts_taxproducts_quantityvendors_idvalues ('2''2''26''MSIMEXP''Microsoft IntelliMouse Explorer''64.9500''64.9500''0.0000''1''1');
    insert into osc_orders_products_attributes (orders_products_attributes_idorders_idorders_products_idproducts_optionsproducts_options_valuesoptions_values_priceprice_prefixvalues ('1''2''2''Model''PS/2''0.0000''+');
    insert into osc_orders_status_history (orders_status_history_idorders_idorders_status_iddate_addedcustomer_notifiedcommentsvalues ('2''2''1''2010-06-04 03:35:34''1''');
    insert into osc_orders_total (orders_total_idorders_idtitletextvalue, class, sort_ordervalues ('4''2''Sub-Total:''$64.95''64.9500''ot_subtotal''1');
    insert into osc_orders_total (orders_total_idorders_idtitletextvalue, class, sort_ordervalues ('5''2''Flat Rate (Best Way):''$5.00''5.0000''ot_shipping''2');
    insert into osc_orders_total (orders_total_idorders_idtitletextvalue, class, sort_ordervalues ('6''2''Total:''<b>$69.95</b>''69.9500''ot_total''4'); 

  7. #7
    Member dmm2020's Avatar
    Join Date
    Apr 2010
    Posts
    45
    Thanks
    0
    Thanked 93 Times in 18 Posts

    Default

    I think I can figure that part out...question I have is do I need to populate the customers table or is that done automatically when they log in and then enter the store?

    Eventually, I will have the orders table that I exported out of our old table link to the new customer ID and ready to import. Just want to be aware of all the relationships of each of the tables that have to be processed in this import.

  8. #8
    Developer Greystoke's Avatar
    Join Date
    Mar 2010
    Posts
    187
    Thanks
    2
    Thanked 499 Times in 113 Posts

    Default

    When the customer is logged in and then enters the store for the first time the Table osc_customers get populated like:

    PHP Code:
    insert into osc_customers (customers_idcustomers_usernamecustomers_gendercustomers_firstnamecustomers_lastnamecustomers_dobcustomers_email_addresscustomers_default_address_idcustomers_telephonecustomers_faxcustomers_passwordcustomers_newslettervalues ('2''Greystoke''m''Greystoke''''0000-00-00 00:00:00''example@example.com''0'''NULL'''1'); 
    Their first and last name, and telephone and fax will get updated when they add their name and address within their account on the store.

    The Table osc_address_book will need to be updated as well, as this only gets updated when they add their name and address within their account on the store.
    Last edited by Greystoke; 16-09-2012 at 21:22.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •