---- dataentry ----
type : integration # do not change this line
systems : MailChimp
name : Add customers to mailing list.
description : Allow customers to 'opt in' to your MailChimp mailing list during checkout.
tags_tags : mailing list, emarketing
date_dt : 2008-05-21
version : 1
developer_url : http://code.fredalger.net/
----
====== MailChimp ======
===== Description =====
[[http://www.mailchimp.com/affiliates/?aid=ed92070b0f31f9a8ed4dce30a&afl=1|MailChimp]] is a high-octane sportscar for concocting and delivering permission-based email marketing campaigns. It's simple, powerful, and more fun than a barrel of... well, monkeys.
This script uses the FoxyCart XML datafeed to automatically add customers to your MailChimp mailing list(s), if they check the opt-in checkbox during checkout. (The opt-in could easily be changed to an opt-out, but isn't generally recommended.)
===== Requirements =====
* PHP4 or later, built with the XML extensions (you've probably got 'em).
* A [[http://www.mailchimp.com/affiliates/?aid=ed92070b0f31f9a8ed4dce30a&afl=1|MailChimp]] account.
===== Installation =====
- [[http://www.mailchimp.com/affiliates/?aid=ed92070b0f31f9a8ed4dce30a&afl=1|Set Up]] your MailChimp account.
- [[http://github.com/phred/fox2chimp/tarball/master|Download the latest tarball]] from the fox2chimp git repository on github. Alternatively, you may use git, if that's the way you roll. Alternative to the alternative: {{:integration:fox2chimp-2008.07.21.zip|download right from the Foxy wiki}}. The goods are in fc-mailchimp.php Included for good measure are the PHP MailChimp API interface, a PHP4-compatible XML parser, RC4 decryption library, and a test harness.
- Upload all 5(!) files to a folder your web server. Customize this block at the top of fc-mailchimp.php:
// ...
$MailChimp_Auth = array(
'user' => 'username', // Replace "username" with your MailChimp username
'pass' => 'password' // Replace "password" with your MailChimp password
);
/**
* Use a custom field during checkout? If true, check for the presence of $Custom_Field below.
* If false, always subscribe the customer. Use wisely.
*/
$Use_Custom_Field = true;
$Custom_Field = 'Subscribe'; // Name of the custom "Opt In" field during checkout.
$Custom_Field_Value = 'yes'; // The value of the custom field that indicates the customer's agreement.
$Email_Format = 'html'; // The customer's preferred email format.
$Send_Confirmation = true; // If true, MailChimp will send a confirmation email to the customer.
$key = 'CHANGE THIS TEXT to your own datafeed keyphrase'; // Make up something random and 30+ characters. This is the encryption key that your XML is encrypted using, and you'll use it below as well.
// ...
- Point FoxyCart to http://www.your-domain.com/path/to/fc-mailchimp.php
- Log into your FoxyCart admin and go to Store -> Datafeed.
- Check the checkbox to turn the datafeed on, enter a SUPER SECRET datafeed key and copy it to your configuration.
- Enter the URL to ''fc-mailchimp.php'' (e.g. ''http://your.domain.dom/path/to/fc-mailchimp.php'') that you uploaded as described above.
- Enter the exact same data key that you entered above into ''fc-mailchimp.php''.
- Save your settings.
- TEST! It should work, but give it a test transaction to make sure. Enter your datafeed key and the URL of your ''fc-mailchimp.php'' into ''test.xmldatafeed.php'', then open ''http://your.domain.dom/path/to/test.xmldatafeed.php'' in your browser. You should get a page that contains only the word ''foxy'' in reply. If you get something else, double-check your datafeed keys in both files and, if all else fails, pop on by the forums.
- Don't panic. You're done!
==== Code =====
[[http://github.com/phred/fox2chimp/tarball/master|Download the Very Latest]] from
[[http://github.com/phred/fox2chimp/tree/master|the fox2chimp github repository]]. Alternatively, {{:integration:fox2chimp-2008.07.21.zip|download right from the Foxy wiki}}.