We have implemented a different approach for MailChimp. In place of the following snippet, we now have webhooks for Zapier (beta) feature in FoxyCart that allows you to pass the data from FoxyCart onto a whole stack of other services,including MailChimp, quickly and easily. Please see the “Zapier” section here. This page will remain for reference.
Please note: The code on this page is submitted by members of the FoxyCart community, and may not verified by FoxyCart.com LLC in any way, shape, or form. Please double check the code before installing. If you need help with it please post in our forum, but if we cannot offer assistance (due to unfamiliarity with this particular system or language) we apologize in advance.
This is a short modification of fc-mailchimp.php in the MailChimp integration in order to test your MailChimp API connection. You should save this in a file along-side the the other MailChimp files listed here: http://wiki.foxycart.com/integration:mailchimp That way the other files can be included (e.g. MailChimpUtils.php).
<?php require 'class.rc4crypt.php'; require 'class.xmlparser.php'; include 'MailChimpUtils.php'; $MailChimp_Auth = array( 'apikey' => 'xxxxxxxxxxxxxxxxxxxxxxxxx', // EDIT: add MailChimp API key here ); $Email_Format = 'html'; $Send_Confirmation = false; $List_Name = 'YourTestList'; // EDIT: The exact name of your mailing list. No List ID required, we'll look it up. subscribe_user_to_list( array( 'first_name' => 'Test', 'last_name' => 'Person', 'email' => 'firstname.lastname@example.org', // EDIT: Put a real email address 'format' => $Email_Format, 'confirm' => $Send_Confirmation), $List_Name, $MailChimp_Auth); ?>
To test this, you should log into your MailChimp account and view the list that you've specified above (preferably a test list). Just keep MailChimp open in a separate browser window and put it aside f or a moment.
Put REAL information into your script above, save it, and then navigate to the newly created page in your browser, e.g. http://www.yourdomain.com/mailchimpscripts/test-api.php
When you navigate to this page in a browser, you will see NOTHING but a blank page (!!!); head back over to your MailChimp admin page and refresh the view of list subscribers in the $List_Name you specified above.