Hi,

I've taken Derek Wright's (@dww) code from http://drupal.org/node/272323 and http://drupal.org/node/626380, added some features and packaged it all into a module.

The module is working and has been tested against:

- Drupal 6.16
- Ubercart (ubercart) 6.x-2.2
- Migrate (migrate) 6.x-1.0
- Table Wizard (tw) 6.x-1.2

There are 3 potential homes for it:

1. Ubercart.
2. Migrate extras - you may want to ping them and ask what they think. I will ping the 2 unresolved issues in their queue, to notify them of this issue.
3. Separate module.

It's currently packaged as a separate module for easy use on an XCart to Ubercart migration I'm doing atm.

I'm happy to create and maintain a separate module but if you all think its better to be integrated into Ubercart or Migrate then I'm happy with that too.

I'm posting here first to see if you or the Migrate guys want to do that.

Immediately after I post this issue I'll post the link to my step by step tutorial on the Ubercart forums on how to use this to perform a complete migration from XCart to Ubercart.

Of course this can be used for any shopping cart migration based on CSV import, I just happen to be doing a migration out of XCart.

CommentFileSizeAuthor
#7 uc_migrate.tgz7.75 KBunivate
uc_migrate.tar_.gz10.97 KBwillieseabrook
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

willieseabrook’s picture

willieseabrook’s picture

Argh, http://drupal.org/node/272323 is note where the code came from - that's a related issue I've been browsing.

http://drupal.org/node/620812 is actually where the original product migrate code comes from.

univate’s picture

I've also just been working on something similar and have build my own uc_migrate module, so can probably help you out with this effort. I had some other requirements as I have added support to migrate recurring payments over to uc_recurring as well as users and previous orders.

As for where the the code should like, its a tough one as its hard to expect anyone to put their hand up to actively maintain a separate module that you only use a few times (unless you are in the business of doing lots of ubercart migrations).

But I think to be valuable it probably is best as its own module where lots of people can actively add to it and it doesn't have to be limited to any ubercarts feature freezes.

The only thing I don't understand from skimming over your code is why you need to create those extra db tables in your modules, migrate already handles these legacy relationships for you.

TR’s picture

I think this should be its own module. You should apply for a CVS account, see http://drupal.org/cvs-application/requirements

willieseabrook’s picture

migrate recurring payments over to uc_recurring

I've seen plenty of chatter on the forums and the net about migrating from product x to Ubercart recurring, so if we could get it all together as a complete and documented CSV/legacy table based Ubercart import solution, I think it would prove quite useful to the community.

The only thing I don't understand from skimming over your code is why you need to create those extra db tables in your modules, migrate already handles these legacy relationships for you.

That's a good point. Keeping separate was primarily a development approach of get it working quickly, and optimize later.

But it would certainly be possible, and perhaps desirable to remove those tables in favor of accessing existing migrate_map_* tables.

This raises another point though:

The end objective of this experiment is to get the legacy table relations showing in the migrate content set mapping screen - see the screenshots on the ubercart forums.

I thought the idea of selecting a relation from drop downs was more intuitive than the current situation, but there is the possibility that I've got the supposed "current situation" wrong.

Is there an existing way to solve migrate imports that involve multiple csv files with relationships, that uses point and click?

I played around a bit with TW relations and creating new table views etc then have multiple content map runs, but either I couldn't see the way or it's not possible.

Or perhaps it's possible but not in an intuitive manner?

I've always just written a simple hook_migrate_prepare to look up the migrate map to get the new id for the legacy id.

I think this should be its own module.

I'll let this float for a few more days just in case, then set up a new project. @univate, are you keen on helping me maintain?

dww’s picture

univate’s picture

FileSize
7.75 KB

How I was able to deal with legacy id's is create a relationship and then edit the view to also expose the linked field - its easy point and click.

I was also keen to see how far I could get with being able to export everything and just have a module I could install on new sites and have all the migrate information ready just to be run. With that in mind I found that you can:
* export the migrate content sets and add them to a modules install file
* export views

What I haven't worked out is how to export the table wizard relationships (I guess that would have to be done manually). I also haven't tested install the module and having everything just work.

I've attached where I got to with this (I think are basically at the same point). The main difference is that I was also focused on a different application (amember -> drupal/ubercart/uc_recurring migration)

I'm happy to do what I can to help maintain the module (if you don't already have a cvs account, i could get the project created now as well)

AlanT’s picture

This is exactly what I need for a project I'm working on now. One question -- When I installed your module, univate, I got an error message: "View amember_members does not exist - either (re)create this view, or remove the migrate content set using it."

Do I need to create this myself, and if so, how?

Thanks.

EDIT: In looking further, I am unable to find the "content set" being referred to. I did find the view definition in the module code, but for some reason the system doesn't seem to be able to find it.

This looks like a perfect solution to what I need to do, but it seems I need to take a step back and try the generic process instead.

AlanT’s picture

It seems I'm having trouble with the original module posted to this page.

After trying the amember version, I uninstalled all related modules, removed that uc_migrate module from the server, uploaded the original uc_migrate module, and started over.

Following the recommended tutorial step by step, everything seemed to go okay until I imported the products view, when I received a number of errors about tables not existing in the database.

user warning: Table 'powerkey_test.uc_migrate_product' doesn't exist query: INSERT INTO uc_migrate_product (mcsid, legacy_id, nid) VALUES (1, '2', 125) in /home/powerkey/public_html/includes/common.inc on line 3528.

The Migrate dashboard showed 24 products imported AND unimported. Going to the UC products screen showed that all products had been imported, and that associated data was there, so I continued.

I then imported users, getting the same type of error messages about the uc_migrate_users table not existing.

user warning: Table 'powerkey_test.uc_migrate_user' doesn't exist query: INSERT INTO uc_migrate_user (mcsid, legacy_id, uid) VALUES (2, '3', 1287) in /home/powerkey/public_html/includes/common.inc on line 3528.

Also saw that they had been imported and unimported, and were in the Drupal system, so I continued.

After importing order data and getting the same error message about a table not existing, I checked the UC order screen to see that the orders were there, but not associated with any users.

user warning: Table 'powerkey_test.uc_migrate_user' doesn't exist query: SELECT DISTINCT(mcs.mcsid), mcs.description FROM migrate_content_sets mcs INNER JOIN uc_migrate_user umr ON mcs.mcsid = umr.mcsid in /home/powerkey/public_html/sites/all/modules/uc_migrate/uc_migrate/uc_migrate.module on line 537.

Obviously, I have a problem.

My next test will be to try univate's module again, but without the amember hooks.

In case it matters, migrating my amember users is most important right now, but I do plan to migrate older data from a couple of shopping cart systems including X-Cart. None of my amember users are on recurring billing, so that's not a requirement here. (I used amember simply to manage access to a private member area with 1-time payments.)

Any help that anyone can offer would be greatly appreciated. I will do what I can to assist, however, I'm not a programmer, so there's not much I can do on the PHP side.

AlanT’s picture

Okay, this is strange.

After uninstalling the original uc_migrate module, I decided to take a quick look into the install file and noticed that it does define the database schema for the missing tables. So I decided to try installing it again to see what happens.

After installing the module again, I checked phpMyAdmin and saw the tables were added. So I went through the tutorial again.

This time, no "table missing" errors, although I did see something I forgot to mention in my last comment -- I do get error messages about the views not being present, although they most definitely are. (They show up in the Views admin screen.)

# View amember_members does not exist - either (re)create this view, or remove the migrate content set using it.
# View amember_products does not exist - either (re)create this view, or remove the migrate content set using it.
# View amember_payments does not exist - either (re)create this view, or remove the migrate content set using it.

So, I'm not sure what happened the first time, but this time everything worked as expected.

One thing I see is that I may need to find out what UC considered a "completed" order status and manually update the incoming CSV file to show this instead of the codes used by the previous system. I didn't see anywhere to set the "status code" translation in this process. (And while I could provide a "default value", I'd have to remove all non-completed orders from the file, and I'd like to maintain ALL order history.)

I want to express my appreciation for what you guys have done here. This is going to make my work a lot easier. Thanks!

netentropy’s picture

was this upgraded to migrate 2.x?

mattcasey’s picture

subscribing

longwave’s picture

Status: Needs review » Needs work

Marked #620812: Support importing UberCart product fields with migrate.module and #626380: Add migrate.module support for uc_order (orders, order product details, etc) as duplicates as this supersedes both.

However, marking this as "needs work", as going forward it would be better to support Migrate 2.x than 1.x.

verta’s picture

subscribing

hedac’s picture

I need to migrate one drupal ubercart shop to another new installation drupal. I need to merge users and nodes so the id's must change in the new drupal installation.
is this the best solution to migrate products, orders and clients from one drupal site to another drupal site?
will this create new id's for products and maintain relation with the orders and clients and everything?

snlnz’s picture

subscribing

mikeryan’s picture

subscribe

twardnw’s picture

I too am interested in seeing this updated to work with Migrate 2.x, don't yet know enough about Migrate to try it myself.

Island Usurper’s picture

Status: Needs work » Needs review

I've been writing a migration for a site, so I needed a bit of Ubercart integration. So far, all I've needed were classes for product data and orders. Everything else has used MigrateDestinationTableCopy since not much else has changed in Ubercart from D6 to D7. Making sure the CCK fields get put into Field API took more work, but that's something that has to be done per-site anyway.

uc_migrate lives in the sandbox for now, but if it works well enough for people, I can promote it to a full project. http://drupal.org/sandbox/islandusurper/1494696

TR’s picture

Version: 6.x-2.2 » 7.x-3.x-dev
Status: Needs review » Active

New features should go into 7.x-3.x first. The above sandbox contains D7 code. Setting to postponed - there is no patch here so "needs review" is inappropriate, and the proposed solution of a uc_migrate module doesn't involve changes to Ubercart.

thatjustin’s picture

I opened up a discussion focused just on importing orders, which is closely related to this topic on drupal.stackexchange.com.
Island Usurper: can you discuss what you've done with a bit more detail?

hockey2112’s picture

Any word on a solution for a D7/UC3 site? I need to migrate users/orders/products/attributes/options from a D6/UC2 site to a new D7/UC3 site.

longwave’s picture

You don't need migrate to upgrade from D6/UC2 to D7/UC3, just follow the standard Drupal upgrade path between major versions.

hockey2112’s picture

Will this method work with migrating customers/orders from Zen Cart to Drupal 7 / UC 3?

longwave’s picture

Status: Active » Closed (won't fix)

The sandbox is available at https://drupal.org/sandbox/islandusurper/1494696 if anyone wants to carry on with this, I am not sure there is anything useful we could add to core to deal with migrations.

hockey2112’s picture

Thanks, Longwave. I ended up manually "migrating" from Zen Cart to Ubercart. It wasn't as bad as I thought it would be. Here are the DB tables I imported to:

uc_coupons_orders
uc_order_line_items
uc_order_products
uc_order_quotes
uc_orders
users

And these are the tables I used from Zen Cart to populate those UC tables. Keep in mind, it was never a 1:1 match; I had to move columns around between spreadsheets to get everything where it needed to go.

znc_customers
znc_orders
znc_orders_products
znc_orders_total

Hopefully these "notes" will help others who need to do a similar migration from ZC to UC.

rvb’s picture

What's the status on the sandbox uc_migrate project? Will it become a full project?

TR’s picture

@rvb: You can post questions about that project in the issue queue for that project.

g089h515r806’s picture

Issue summary: View changes

Migrate has been moved into Drupal8, it will be better to provide more integration for migrate.