MailChimp!

MailChimp Integration

A Zen Cart™ mod which allows you to use MailChimp's newsletter services instead of the native Zen Cart mailer.

This mod was formerly called "MailChimp Newsletter Sidebox," but now subscription is available during account creation as well.

Donate! Show your appreciation by supporting my efforts.

Relevance: Zen Cart™ 1.3.0 - 1.3.9, 1.5.0

Current Version: 2.2a

Cost: Free, but donation appreciated

Location: Zen Cart Downloads page, under Marketing Tools.

Download: MailChimp Integration on Zen Cart Downloads Page

Add-Ons: The Newsletter Discount contribution interoperates with the MailChimp Newsletter Sidebox.

Support Thread: MailChimp Integration Support Thread

Installation Difficulty: Moderate (Professional installation available for $60)

Installation Instructions: click here

Overview:

MailChimp is a great newsletter management service that has a per- message pricing model. This makes it much more affordable than Constant Contact (which bills by the month) for small businesses with infrequent bulk emailing needs.

Yes, Zen Cart has a built in newsletter service. However,
  • MailChimp has a whole set of very sophisticated HTML templates that are provided free.
  • MailChimp's service is de-coupled from your store, making it easier to sign up people who may not want to create an account.
  • Having a third party send your commercial email makes it less likely that your hosting provider will cancel your account or push you into a more expensive plan due to excessive resource usage.
  • MailChimp has a ton of analytics tools that show you how many people opened your email, clicked on links, etc.
Still not convinced? Learn more about MailChimp.

To sign up for their service, go to www.mailchimp.com

MailChimp Integration allows you to create a sidebox in which people can subscribe to a newsletter provided by MailChimp.com, and allows your customers to also signup when they create an account.

MailChimp Newsletter Sidebox

MailChimp Sidebox



Pre-Installation Instructions:

  1. Read the MailChimp Email Marketing Guide and some of the resources offered by MailChimp.
  2. Sign up for a MailChimp Account.
  3. Create a list for your newsletter (press the Lists tab at the top of the page, then "Create New List"). In your Sign-up form, I suggest only having email address; if you want more fields, you'll have to modify this contribution.
  4. Press the Forms link for your new list. This will take you to a screen which will show you your signup form.
    Press the "create embed code for small form" link.

    It generates code in a box on the left hand side of the screen under the label copy/paste onto your site.

    Search for the string "list-manage.com".

    You will find something that looks like this:
    form action="http://YourSite.us1.list-manage.com/subscribe/post?u=d0bcc6a7b231472e0ac481ae0&id=56d217bcfc" method="post"  .... 
    
    Note the the values of "u" and "id" - you will be embedding them in the language file during the installation process. The & is not part of the u value; in this case,
    u is d0bcc6a7b231472e0ac481ae0
    id is 56d217bcfc
    

    Note also the value of the URL before the arguments; in this case, it is
    http://YourSite.us1.list-manage.com/subscribe/post
    
  5. At the top of the Mailchimp page is a dropdown called "Account." Select "api keys & info" and add an api key to your account. Note the value; you will be embedding it in the language file during the installation process.
  6. Take the time to test and customize MailChimp before adding it to your site.


Installation Instructions:

  1. Back up everything! Try this in a test environment prior to installing it on a live shop.
  2. Copy the contents of the unzipped folder to the root directory of your shop.
  3. Edit the file
    includes/languages/english/extra_definitions/mailchimp_sidebox_defines.php
    
    1. Set the BOX_MAILCHIMP_NEWSLETTER_ID to the "id" value you noted during the pre-installation instructions.
    2. Set the BOX_MAILCHIMP_NEWSLETTER_U to the "u" value you noted during the pre-installation instructions.
    3. Set BOX_MAILCHIMP_NEWSLETTER_URL to the value you noted during the pre-installation instructions.
    4. Set BOX_MAILCHIMP_APIKEY to the value you noted during the pre-installation instructions.
  4. In Admin->Tools->Layout Boxes Controller, turn on the mailchimp sidebox.
  5. Changes to your Zen Cart configuration:
    1. In Configuration->Customer Details, set Show Newsletter Checkbox to 1.
    2. In Configuration->Email Options, set Display 'Newsletter Unsubscribe' Link to false.
      (To subscribe, people use the MailChimp sidebox; to unsubscribe, they use the link at the bottom of the newsletter.)
  6. If you do not yet have an
           
    includes/modules/YOUR_TEMPLATE/create_account.php
    
    then copy
           
    includes/modules/create_account.php to 
    
    to
           
    includes/modules/YOUR_TEMPLATE/create_account.php
    
    Look for the line:
           
       $zco_notifier->notify('NOTIFY_LOGIN_SUCCESS_VIA_CREATE_ACCOUNT');
    


    right below it, add the code:
           
       if ((int)$newsletter == 1) { 
           mailchimp_add($email_address, $email_format);
       }
    


Installation Issues:

  1. If after installation you are getting the message, "monkeys must have stolen the page" when you try to subscribe, it is possible that you have the values BOX_MAILCHIMP_NEWSLETTER_U and BOX_MAILCHIMP_NEWSLETTER_ID in mailchimp_sidebox_defines.php backwards. The value BOX_MAILCHIMP_NEWSLETTER_U should be the longer of the two.
  2. If subscriptions from Account Creation are not working, you may not have set the API KEY field in the file
    ./includes/languages/english/extra_definitions/mailchimp_sidebox_defines.php
    
  3. If you are running Newsletter Discount, upgrading that module is mandatory if you install MailChimp Integration version 2.0 or greater.
  4. If subscribing during the account creation process doesn't work, check the logfile in DIR_FS_SQL_CACHE/MailChimp.log.
  5. If you find that the email text entry box is wider than you want it to be, edit
    ./includes/templates/template_default/sideboxes/tpl_mailchimp_sidebox.php
    
    and change the line that says
      $content .= '<input type="text" name="EMAIL" value=""><br />';
    
    to
      $content .= '<input type="text" name="EMAIL" value="" size="15"><br />';
    
    (add the size="15" attribute to the input box). Adjust to taste.


Importing your Zen Cart Newsletter Subscriber List

To export a list of customers who are have signed up for your Zen Cart newsletter and import them into MailChimp, use the following procedure. I will assume you don't use a prefix for your table names; if you do, change customers to <your_prefix>_customers.
  • Go into phpMyAdmin and select your database. Select the table "customers."
  • Press the SQL button and enter the query
    SELECT customers_email_address FROM customers WHERE customers_newsletter = 1
    
  • At the bottom of the screen, you'll see an "Export" link. Press it.
  • You will now see the "Export" screen. Set the Export type to "CSV." Set "Fields enclosed by" to be blank (not double quote).
  • Press the Go Button.
  • In another window, log in to MailChimp, and press the Lists button.
  • Click the name of the list, and press the "Import list" link.
  • Confirm that your list is allowed, and paste the names from the phpMyAdmin window.
  • Press the Upload Customer List button.
Note that you are not allowed to simply upload all your email addresses; only upload the ones who have given you permission to send them a newsletter.

If you've never had a newsletter before, and you want to see get permission from your existing customers, MailChimp has some suggestions. Zen Cart's email facility has a very useful filter: under Tools->Send Email, the "Customer" dropdown list has a selection entitled "Active customers in past 3 months." Be careful when you're doing this; the last thing you want is for customers to perceive you as a spammer.

This would probably be a good time to update your Privacy Policy. In admin, go to Tools->Define Pages Editor, and select "define_privacy.php." This file will be made visible if you use the "Information" sidebox (Admin->Tools->Layout Boxes Controller, turn sideboxes/information.php ON).

MultiLanguage Newsletters

With no software change, you can accomodate all the languages your cart supports. You will need to create a second newsletter list in MailChimp in the other language you support, and make a note of this list's id. Simply copy the file
./includes/languages/english/extra_definitions/mailchimp_sidebox_defines.php
to your other language directory (for instance, if your other language is Klingon, it would be
./includes/languages/klingon/extra_definitions/mailchimp_sidebox_defines.php
Then set the value BOX_MAILCHIMP_NEWSLETTER_ID in that file to the list id of your second list.

Providing Archives of your MailChimp Newsletter

MailChimp provides an archive service. It gives you a little snippet of javascript which retreives links to the last <n> newsletters you sent. You can either paste that code into an EZ Page, or you can use the About Us contribution to create a Newsletter Page.

Learning more about Newsletters

See the learning more section of the Newsletter Discount page.

Major Versions

  • 2.2a 07/16/2011 - Fixed validation issues.
  • 2.2 03/12/2011 - Updated instructions to reflect latest MailChimp policies.
  • 2.1 10/02/2010 - Updated instructions to reflect latest MailChimp policies.
  • 2.0 08/01/2010 - Added mailchimp subscribe at signup
  • 1.2 08/25/2008 - updated install instructions and form for new API.
  • 1.1 08/05/2007 - Put files in template directories for easier upgrade
  • 1.0 06/22/2007 - First Release


Certificates of appreciation most welcome!
If the information you learned reading this site is helping your store make more money, please consider making a donation. Thank you!



Want more Zen Cart?     Tips and Tricks     Contributions     Extensions     Custom Software     Newsletter

Terms | Privacy | SiteMap | Newsletter | Contact Me | Contents © 2003-2011 That Software Guy, Inc.
Zen Cart Project Home Page | Zen Cart Forum | Zen Cart™ is © Zen Ventures, LLC.