Migrating Gift Certificates from Xcart to Magento

Hold on Cowboy

This blog post is pretty old. Be careful with the information you find in here. It's likely dead, dying, or wildly inaccurate.

Youre migrating to Magento from Xcart and want to offer gift certificates (GC) on Magento and you want to take all the active gift certificates over to Magento as well.

We’ll be using the wonderful GC extension at http://www.magentocommerce.com/extension/reviews/module/751/gift-certificates–virtual-cards

1. Dump the gift cert data from Xcart to a csv file.

SELECT gcid as cert_number,debit as balance,'USD' as currency_code,'' as pin, '' as pin_hash,'A' as status, NULL as expire_at, recipient as recipient_name,recipient_email, CONCAT(recipient_address,'\n', recipient_city,', ',recipient_state,' ',recipient_zipcode) as recipient_address, message as recipient_message, 0 as toself_print FROMxcart_giftcertsWHERE status = 'A';

You can use PHPMySQLadmin to dump that or you can save that query to a text file (gcert.sql) and run it on the command line

mysql -u [YourUserName] -p [YourDBName] < gcert.sql > datadump.csv

2. Import the data into the Magento table ugiftcert_cert

3. Then you need to run this SQL to make them show up in the backend.

insert into ugiftcert_history (cert_id, action_code, ts, amount, currency_code, status) SELECT cert_id,'create',now(),balance,currency_code,statusFROM ugiftcert_cert

Summary You need to dump the data from Xcart and use some MySQL magic to format the fields to import into Magento.  The Gift Certificate extension tracks transactions for each GC and so the need for step 3 to create the initial history of the GC.

![](http://img.zemanta.com/pixy.gif?x-id=32096f9e-6fa6-8f4f-a3e2-91868276e8b8)

Did this help you out? It took me a few days to piece together all this information together, I hope this saves you some time (who knows, maybe the future me will be thankful I wrote this down). Let me know your thoughts. shanestillwell@gmail.com