--- /dev/null
+<?php
+
+/**
+ * MailChimp.php
+ *
+ * PHP version 5.3
+ *
+ * @category Toolkit
+ * @package LeadManager
+ * @author Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license Gaslight Media
+ * @version SVN: (0.1)
+ * @link <>
+ */
+
+require_once GLM_APP_BASE . 'Common/LeadManager/Affiliates/MCAPI.class.php';
+/**
+ * Require the MCAPI Class
+ */
+/**
+ * Toolkit_LeadManager_MailChimp
+ *
+ * This class is an Observer class for setting up the contact forms
+ * with the ablity to send contact data to the MailChimp list.
+ *
+ * @category Toolkit
+ * @package LeadManager
+ * @author Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license Gaslight Media
+ * @release Release: (0.1)
+ * @link <>
+ */
+class Toolkit_LeadManager_MailChimp
+ extends Toolkit_LeadManager_Observer
+{
+ public function send(Toolkit_LeadManager_Lead $subject)
+ {
+ // have to convert the $subject Object to an array to be used
+ // in the mailchimp call to add to list
+ $values = array(
+ 'email_address' => $subject->getEmail(),
+ 'first_name' => $subject->getFname(),
+ 'last_name' => $subject->getLname(),
+ 'city_name' => $subject->getCity(),
+ 'state_code' => $subject->getState(),
+ 'state_name' => $GLOBALS['states'][$subject->getState()],
+ 'zip_code' => $subject->getZip(),
+ 'home_number' => $subject->getPhone()
+ );
+ if (is_a($subject, 'Toolkit_LeadManager_Contact')) {
+ $values['address_line_1'] = $subject->getAddress();
+ $values['address_line_2'] = $subject->getAddress2();
+ } else if (is_a($subject, 'Toolkit_LeadManager_Customer')) {
+ $values['address_line_1'] = $subject->getAdd1();
+ $values['address_line_2'] = $subject->getAdd2();
+ }
+ }
+
+
+}
; example BeaverIslandBoatCo/lists/1
constantcontact.list.0 = Off
+; MAILCHIMP API
+contactdb.mcapi.application = On
+; Mailchimp API key
+contactdb.mcapi.apikey = "008fe0f365c71f5ea08aed546da40242-us6"
+; Mailchimp List Id
+contactdb.mcapi.listId = "8ed24143f7"
+
; Turn the coupon application On or Off
coupons.application = Off
--- /dev/null
+<?php
+require_once 'setup.phtml';
+require_once GLM_APP_BASE . 'Common/LeadManager/Affiliates/MCAPI.class.php';
+$testEmail = 'steve@gaslightmedia.com';
+//var_dump(MAILCHIMP_APIKEY);
+//var_dump(MAILCHIMP_APP);
+//var_dump(MAILCHIMP_LISTID);
+//var_dump($testEmail);
+//exit;
+$api = new MCAPI(MAILCHIMP_APIKEY);
+
+// get lists
+$ret = $api->lists();
+echo print_r($ret);
+exit;
+$mergVars = array(
+ 'FNAME' => 'Test',
+ 'LNAME' => 'Account',
+// 'GROUPINGS' => array(
+// array('name' => 'Your Interests:', 'groups'=>'Bananas,Apples')
+// )
+);
+$retVal = $api->listSubscribe(MAILCHIMP_LISTID, $testEmail, $mergVars);
+
+if ($api->errorCode) {
+ echo "Unable to load listSubscribe()!\n";
+ echo "\tCode=" . $api->errorCode. "\n";
+ echo "\tMsg=" . $api->errorMessage. "\n";
+} else {
+ echo "Subscribed - look for the confirmation email!\n";
+}
+
'CONSTANT_CONTACT_LIST',
serialize($applicationConfig->constantcontact->list->toArray())
);
+define('MAILCHIMP_APP', $applicationConfig->contactdb->mcapi->application);
+define('MAILCHIMP_APIKEY', $applicationConfig->contactdb->mcapi->apikey);
+define('MAILCHIMP_LISTID', $applicationConfig->contactdb->mcapi->listId);
/**
* Coupons Database Installed?
*/