type:
integration
system:
ConstantContact.
name:
Add customers to mailing list.
description:
Allow customers to 'opt in' to your Constant Contact mailing list during checkout.
tags:
mailing list,
emarketing
date:
2008-05-21
version:
1
developer:
http://themancan.com

ConstantContact

Description

Constant Contact… everyone's got it, it's the standard, so why not plug your FoxyCart into it for some hands-off customer subscription power?

This script uses the FoxyCart XML datafeed to automatically add customers to one of your Constant Contact mailing lists, if the the customer checks 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 ConstantContact account.

Installation

  1. Set up a list in your Constant Contact account.
  2. Download the latest tarball from the constantfoxy git repository on github. Alternatively, you may use git, if that's the way you roll. Alternative to the alternative: download right from the Foxy wiki. The goods are in
    fc-constantcontact.php

    Included for good measure are a PHP4-compatible XML parser, RC4 decryption library, and test harness.

  3. Upload all 4(!) files to a folder your web server. Customize this block at the top of fc-constantcontact.php:
    // ...
     
    $ConstantContact_Auth = array(
        'user'  => 'username',     // Replace "username" with your Constant Contact username
        'pass'  => 'password'      // Replace "password" with your Constant Contact password
    );
    $ListName = 'My Awesome List!'; // The exact name of your list in Constant Contact.
     
    /**
    * 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.
     
    $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.
     
    // ...
    1. Log into your FoxyCart admin and go to Store → Datafeed.
    2. Check the checkbox to turn the datafeed on, enter a SUPER SECRET datafeed key and copy it to your configuration.
    3. Enter the URL to fc-constantcontact.php (e.g. http://your.domain.dom/path/to/fc-constantcontact.php) that you uploaded as described above.
    4. Save your settings.
  4. TEST! It should work, but give it a test transaction to make sure. Enter your datafeed key and the URL of your fc-constantcontact.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.
  5. Don't panic. You're done!

Code

 
integration/constantcontact.txt · Last modified: 2008/08/06 00:09 by foxyfred
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki