VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Customer / User Management VM 1.1 => Topic started by: Acardenes on September 14, 2011, 10:14:17 am

Title: Importing 13k users from old shop to Virtuemart
Post by: Acardenes on September 14, 2011, 10:14:17 am
Hi, as stated in the title, I need to import into Virtuemart a number of users. Problem is, the old shop is an old php custom scrip (as far as i know, it could be a well know ancient scrip modified by the original programmer or totally written by him...)

I have this colums in my db:

Code: [Select]
ID, name, lastname, deliveryadddress, postalcode, provinceID, province_delivery, countryID, billing_address, phone, email, password, newsletter, date_creation, date_last, sent
I guess I could just import username, password and email address and have the customer add his delivery after first buy in the shop, but the password is gonna be a serious problem, am I right?

Well, I wonder if this task could be done or I will need to ask the customers to register again.

Any ideas?
Title: Re: Importing 13k users from old shop to Virtuemart
Post by: stinga on September 15, 2011, 09:05:54 am
G'day,

Depends on how the password is stored, would need a bit more information.
But it would be a simple job to load the data into J!/VM, just need to work out the password issue, is it the same can it be decoded etc.
If it can't just set it to a known value and the cust will have to use the remind me button.
You could send all your customers an email to say they need to change their password due to you moving the shop to a newer patform.

Quite a common issue really.
Title: Re: Importing 13k users from old shop to Virtuemart
Post by: Acardenes on September 15, 2011, 09:46:51 am
Hi Stinga, thanks for your reply. The function that generates the passwords in the old page is using 
Code: [Select]
substr(md5(rand()),0,6); for the passwords, but it's no so important.
I'll be happy if they are created in Virtuemart and I have to send an email asking them to get a new password  :)

Could you point me at the right direction?

Thanks!
Title: Re: Importing 13k users from old shop to Virtuemart
Post by: stinga on September 15, 2011, 20:11:25 pm
Not sure if VM uses the same method, if it does then you are in luck, otherwise just do the remind me method.

Next thing then is to have a look at the tables and see how they are populated. The easy method to do this is to take a system where there is no activity, no other users etc. Turn on mysql logging and add a customer this will give the tables that need to be populated. I did this for product entry, takes too long to use the gui, so I created a cli load_prd.pl program to populate the DB. Much faster.

show tables like '%use%';
gives
Code: [Select]

+---------------------------+
| Tables_in_joomlat (%use%) |
+---------------------------+
| j_users                   |
| j_vm_auth_user_group      |
| j_vm_auth_user_vendor     |
| j_vm_order_user_info      |
| j_vm_user_info            |
| j_vm_userfield            |
| j_vm_userfield_values     |
| j_wats_users              |
+---------------------------+

So that is a good place to start :-) Won't need all those tables, just need to work out what ones you need to populate.
Title: Re: Importing 13k users from old shop to Virtuemart
Post by: 911websiterepair on September 15, 2011, 21:30:07 pm
you can get the users,   but not their passwords
Title: Re: Importing 13k users from old shop to Virtuemart
Post by: stinga on September 16, 2011, 00:38:33 am
G'day,

I think you will be able to use the existing passwords if you change the encryption method to md5 (this might be the default), which is what you already have.

Register a user and have a look at the password, then use the md5 statement to generate one and compare, if joomla give the same result you are in luck, failing that change ./libraries/joomla/user/helper.php to do whatever you want it to do, I think the password stuff is rattling around in there some where.

@geekhead
Don't need the plain text password, the encrypted will do. He would only move that data so no need to try and decrypt it.
Title: Re: Importing 13k users from old shop to Virtuemart
Post by: dragos.alex on September 16, 2011, 10:05:18 am
it works also with plain passwords, just upload them, then:"UPDATE jos_users SET `password` = MD5(`password`) WHERE LENGTH(`password`) > 0 AND (LENGTH(`password`) != 65 AND LOCATE(':', `password`) != 33) AND LENGTH(`password`) != 32 ".
i did this for 900 users and it worked.
Title: Re: Importing 13k users from old shop to Virtuemart
Post by: stinga on September 16, 2011, 14:33:42 pm
OP does not know the plain text passwords though.
Title: Re: Importing 13k users from old shop to Virtuemart
Post by: Acardenes on September 16, 2011, 15:00:26 pm
Yeah, I don't know the plain passwords. Anyway, thanks a lot for the answers, I will try to do a test import and see how it goes.

Thanks again!