Migrating Gift Certificates from Xcart to Magento

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 FROM `xcart_giftcerts` WHERE 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] &lt; gcert.sql &gt; datadump.csv<br />

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,`status` FROM 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.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <drupal5>, <drupal6>, <javascript>, <php>, <sql>. Beside the tag style "<foo>" it is also possible to use "[foo]".

More information about formatting options