newsletter discounts

Newsletter Discount

Newsletter Discount is a Zen Cart™ discounting module which allows you to offer reduced prices for newsletter subscribers. It can be configured to work with the native Zen Cart newsletter facility or with MailChimp.

Donate! Show your appreciation by supporting my efforts.

Relevance: Zen Cart™ 1.3.5 - 1.3.9, 1.5.0

Current Version: 3.0 (MailChimp API 1.3)

Note: You must use the same version of the MailChimp API in both the MailChimp integration and Newsletter Discounts (if you use both). You cannot mix API versions!

Cost: Free, but donation appreciated

Location: Zen Cart Downloads page, under Pricing Tools.

Download: Newsletter Discount on Zen Cart Downloads Page

Add-Ons: For MailChimp users, the MailChimp Integration contribution interoperates with Newsletter Discount.

Support Thread: Newsletter Discount Support Thread

FAQ: click here

Installation Instructions: click here

Overview:

Newsletter Discount allows you to offer a percentage discount on purchases made by someone who has signed up for your newsletter.

Newsletter Discount is an order total module; it only shows up on the second page of checkout.


Payment Page displaying Newsletter Discount

Payment page showing Newsletter Discount



Installation Instructions:

  1. Back up everything! Try this in a test environment prior to installing it on a live shop.
    If you have installed this module before, go to admin->modules->order total->newsletter discount, note your settings, and press "remove" to uninstall the module.
  2. Copy the contents of the unzipped folder to the root directory of your shop.
  3. Login to admin and in Modules->Order Total you will see 'Newsletter Discount' listed along with all the other modules available.
  4. Click on 'Newsletter Discount' to highlight the module and click on 'Install'
  5. If you are using MailChimp, login to your MailChimp account. At the top of the Mailchimp page is a dropdown called "Account." Select "api keys & info" and add an api key to your account. This is the value you should enter in the "API Key" field in Newsletter Discount config.
  6. Set the parameters according to your discounting plan.
  7. If you wish, follow the guidelines in marketing to advertise your discounts.



A Note on Taxes

(If you are not subject to a VAT and do not mix taxable and non-taxable products, please skip this section.)

The way taxes are handled internally in Zen Cart 1.x is that the entire tax amount is stored in the cart; the tax is not broken down on an item by item basis. For this reason, tax recalculation after discounting may not work perfectly if items which attract different levels of tax are in the cart - for example, taxable and non-taxable items. This issue is discussed in this forum post, and we are hopeful that Zen Cart 2.x will solve this problem.

Included Taxes and My Mods

This section is only relevant to Zen Carts which use "Display Prices with Tax" = true (in Admin->Configuration->My Store).

If your shop displays prices with tax included, you should configure my discounting mods to use Include Tax = true and set Re-Calculate tax to either "Standard" or "VAT" (depending on how taxes are handled in your jurisdiction).

There was a time when my software would gross up percentage discounts for tax but not currency based discounts. I decided to change this and handle both uniformly, so now (post April 2010) if you configure one of my discount mods to use include taxes = true, your discount will be grossed up whether it is a currency value or a percentage.


Configuration:

Some shops will want to further customize their discounting policy. User exits are provided to permit the following customizations:
  • Include or exclude certain categories from discounting.
  • Include or exclude certain products from discounting.


Specifically:

  • The function exclude_category() shows you how to add categories to a list of categories to not be discounted.
  • The function exclude_product() shows you how to add products to a list of products to not be discounted.

Each of these functions contains a simple example of how to use it using item and category numbers like 99999, 99998, etc. Note that the "category" of an item is its parent category; see my category explanation page for an explanation. Note that to use the category exclusions you must be running Zen Cart 1.3.5 or greater.

The user exits are in includes/modules/order_total/ot_newsletter_discount.php.

MailChimp

MailChimp

MailChimp is an Email Service Provider; their business is managing commercial email. They have a very reasonable per-email cost model (unlike firms like Constant Contact, which charge per month irrespective of how little mail you send). You can integrate MailChimp into your Zen Cart using the MailChimp Newsletter contribution.

The Newsletter Discount contribution uses the MailChimp API to communicate with MailChimp and determine whether the customer is a newsletter subscriber.

Configuration of Newsletter Discounts when using MailChimp:
  • In Admin->Modules->Order Total->Newsletter Discount, You must set the Newsletter Type to "mailchimp" and fill in the MailChimp API Key.
  • By default, all MailChimp lists you have set up are scanned. If you want to use one list only, look for the line
                 $id = $lists[$i]['id'];
    
    and change it to
                 if ($lists[$i]['name'] != 'Your-Newsletter-List-Name') continue;
                 $id = $lists[$i]['id'];
    
    Change Your-Newsletter-List-Name to the actual name of your list


Marketing

A discounting plan reaches maximum effectiveness through advertising.

Customize the tpl_product_info_display.php file to advertise your discounts. Put the file

includes/templates/template_default/templates/tpl_product_info_display.php

into includes/templates/<Your Template>/templates, and add this block of code to the page:
<?php 
  $value = "ot_newsletter_discount.php";
  include_once(zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] .
          '/modules/order_total/', $value, 'false'));
  include_once(DIR_WS_MODULES . "order_total/" . $value);
  $discount = new ot_newsletter_discount();
  echo '<div class="content" id="discountPolicy">';
  $resp = $discount->get_html_policy(); 
  echo $resp;
  echo '</div>';
  echo '<br class="clearBoth" />'; 
?>
The placement of this code is a matter of personal preference; try placing it below the product description and adjust to your tastes.

You can put this code whereever you'd like. For example, here I have placed it in tpl_modules_create_account.php so that new signups see the policy when making their newsletter choice:

Signup page showing Newsletter Discount


Files

(new)includes/languages/english/modules/order_total/ot_newsletter_discount.php
(new)includes/modules/order_total/ot_newsletter_discount.php
(new)includes/classes/MCAPI.class.php


Learning More about Newsletters

MailChimp provides some excellent resources to help you learn about newsletters, whether or not you use their service. Start with their 65 Page Email Marketing Guide. Then take a look at their Resource Center.

To learn more about the value proposition of the MailChimp service, go to their features and benefits page.

Major Versions

  • 3.0 05/01/2012 - Update to new MailChimp API 1.3
  • 2.0 08/01/2010 - Update to new MailChimp API 1.2
  • 1.3 11/13/2008 - Resolve issue with PayPal IPN.
  • 1.2 08/25/2008 - Upgrade to version 1.1 of MailChimp API.
  • 1.1 06/01/2008 - Adding ways to customize the order total calculation; upgrade to version 1.0 of MailChimp API
  • 1.0 04/02/2008 - First Release

FAQ

Q: I'm using exclude_category() and it's not working!
A: Please see the Category Issues page for solutions.

Q: I do not want to discount products 12 and 13. How do I do this?
A: Update the function exclude_product() in includes/modules/order_total/ot_quantity_discount.php as follows:
    function exclude_product($prid) {
        $id = (int)$prid;
        switch($id) {
           case 12:
           case 13:
                return true;
        }
        return false;
    }


Q: I only want discounts applied to items in category 11. How do I do this?
A: Update the function exclude_category() in includes/modules/order_total/ot_newsletter_discount.php as follows:
    function exclude_category($category) {
        switch($category) {
           case 11:
                return false;
        }
        return true;
    }


Q: I don't want discounts applied to items in category 7. How do I do this?
A: Update the function exclude_category() in includes/modules/order_total/ot_newsletter_discount.php as follows:
    function exclude_category($category) {
        switch($category) {
           case 7:
                return true;
        }
        return false;
    }








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.