| « mod_fcgid, timeouts, and downloads | AV - Simulated Election results for Single Transferrable Vote » |
Integrating PHPLIST into Magento
Looking to integrate a Magento Store with a PHPLIST email database? Here are some files to help you.
Background
I'm working on moving the Maynard's Groovy Bible Tunes Store onto Magento, and one of the important things for me is to be able to continue to use PHPLIST for my email newsletters.
Unfortunately there doesn't seem to be a PHPLIST module for Magento. However there is one for OsCommerce which I've been using, and so I set about using / modifying it to get it to work with Magento.
It turned out to be easier than I expected. Having said that, I haven't made a proper module - if you want to install this, it's a DIY job. Tools you will need are: an FTP client, a text-file editor.
What it does
A user subscribes to the newsletter via their Magento page, and that gets copied over automatically to your PHPLIST setup. When you next send a PHPLIST newsletter, all your Magento store newsletter subscriptions are included.
When users (or admin) modify subscriptions via Magento or PHPLIST, the other database is updated.
NB: The Magento database is only updated when the user / admin next views newsletter subscription info via Magento.
More techically: the modifications intercept any changes made to a user's subscription to the Magento newsletter, and updates the PHPLIST database accordingly. Furthermore, when a user (or the admin) checks his Magento Newsletter subscription, the PHPLIST database is checked in case the user has changed his subscription via the PHPLIST interface, and the Magento database is updated accordingly.
The files are installed in a folder that overrides core Magento files without corrupting them. This way your underlying installation is kept safe, and completely upgradeable.
It's tested and working on Magento 1.5
Installation
Here's what you need to do:
1. Don't try this on a working store.
Experiment on your private server, and make sure it works with your setup before going live.
If you break your PHPLIST or Magento setups with this, it's not my fault.
2. Backup everything
Databases, files, anything you can think of. From now on if anything goes wrong it really is not my fault.
3. Create some folders
You need to create this folder structure in your store's root directory: app/code/local/Mage/Newsletter/Model/
Some of it will be there already, just create the extra folders.
By creating this structure, the new files you use simply override the Magento core files, without corrupting them at all. You can upgrade Magento, and the core files get changed properly, as well as the modification remaining in place.
You can remove the mod at any time just by deleting its files.
4. Copy the new files into place
Put these four files into app/code/local/Mage/Newsletter/Model/
- Subscriber.php
- MGBT_phplist_define.php
- MGBT_phplist.php
- MGBT_database.php
Download them from here: PHPLIST_Magento.zip
5. Edit MGBT_phplist_define.php
You need to provide configuration details that match your PHPLIST setup. Information is in the file.
6. Try it out.
Try subscribing / unsubscribing to the newsletter in Magento, and watch how PHPLIST gets the info.
Try changing a subscription in PHPLIST, and watch how Magento picks up the info!
If it doesn't work - sorry, you can either try contacting me to see if I can help, or just delete the files you copied in, and nothing will be broken. Unless you've made a mistake following my instructions, in which case you made backups at step 2, so use them.
7. TODO
I haven't written a script to synchronise two existing databases. Sorry.
Trackback address for this post
2 comments
i find your work very interesting.
I just one question.
Do you know if it is possible to export from magento to phplist some data like 'company' or 'buyers group'.
It would be very powerfull if we could do so.
Thanks
Thomas