
Magento's database structure is rather arcane, but the API provides a clean way of retrieving order data. So, I made this little tool to pull Magento's orders from the API and then populate these orders in a second MySQL database. The orders are exported to two tables : mage (the order data, including customer shipping and billing information), and mage_items (which includes info on the items purchased). The tables are linked by the increment_id (which is also the order #), so it makes for a very readable database. This tool was designed for reporting, but could likely be useful for other applications... If anyone has any suggestions or improvements definitely send 'em my way!
Installation
- Create a Magento API username and key (done within the Magento back-end)
- Untar to a protected directory on your webserver ("tar -xvf magesync_v1.00a.tar")
- Edit /etc/cfg.php and define your absolute path, database host, database name, database username, database password, Magento API URL, Magento API username, and Magento API key
- Setup a CRON job and set to run as desired (ex, "cd /path/to/magesync; php -q cron.php")
- Watch and be amazed as Magento's database is demystified!
Download MageSYNC v1.01
Update Log
01/06/2010 - Removed removeMagicQuotes and unregisterGlobals functions since they appeared to be causing problems on some systems (and were also superfluous)