I’m trying to solve this problem: I have a customer list from another e-commerce app and need to import the customer data into GOLD. While it looks trivial to do direct database access (handful of user tables + ac_Addresses, possibly wishlists, etc.), I was wondering if there is a safe means to do this through some api calls? If not, is there a recommended approach? I would certainly need some sort of API function to correctly store a password in the ac_UserPasswords table).
I'm thinking of a console app (run once) that would read through each customer, add the customer info (ac_User), passwords (ac_UserPasswords), groups (ac_UserGroups) , addresses (ac_Addresses).
Any suggestions or guidance you can provide?
importing customers
Re: importing customers
I solved the problem, which turns out to be mostly simple. For anyone that is curious, I wrote a console app to insert a customer and then any customer addresses and then just loop through each customer in turn.
You need to reference NHibernate, NHibernate.Caches.SysCache, System.Web and of course CommerceBuilder. And you need to have log4net.config and nhibernate.config in the project.
Customers can be created by passing in email and password to this method:
We now have a user instance (with id field) and can create a new Address instance, populate the various fields
and then finally:
You need to reference NHibernate, NHibernate.Caches.SysCache, System.Web and of course CommerceBuilder. And you need to have log4net.config and nhibernate.config in the project.
Customers can be created by passing in email and password to this method:
Code: Select all
user = UserDataSource.CreateUser(c.EMAIL.ToLower(), c.PASS);
Code: Select all
Address addr = new Address(user,...);
addr.User = user;
Code: Select all
AddressDataSource.Insert(address);
Re: importing customers
Thank you so much for posting this! Good stuff
Thank you for choosing AbleCommerce!
http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support
http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support