Zen Cart custom software development, Zen Cart modules, Zen Cart Expert eCommerce Starts Here!
osCommerce Big Spender

osCommerce Big Spender

A discounting module for osCommerce 2.2 and 2.3 that allows you to discount products at certain levels of spending.

Background: See the osCommerce Matrix-o-discounts

Example Discounts: I have provided several examples of osCommerce Big Spender discounts.

Relevance: osCommerce 2.2, 2.3

Current Version: 1.2.8a. Occasionally, new features are documented prior to being publicly available; please check the version history to ensure the feature you want is available in your version.

Support Thread: My commercial software is not supported on the osCommerce forum. Please email me questions instead.

Cost: $60 (Note: this low price covers software only for self-installation.)

Buy Now

Would you like to ask me questions before buying? I'm happy to help likely purchasers make the right decision. Just use my contact form.

Installed Cost: $120.00 (Professional installation by That Software Guy) Note that this does not include payment gateway integration - see above. Please test my free software first (Better Together or Quantity Discounts) to ensure that this will work with your payment gateway.

Installation Difficulty: Moderate (You must write some PHP to configure this mod; there is no Admin panel)

Installation Instructions: click here

Payment Gateway Integration Note that some payment modules, including PayPal, do not natively work with Order Total discounts (mine or anyone else's).
Here are some suggestions on how to fix this:
osCommerce 2.2     osCommerce 2.3 Note that doing these integrations is your responsibility. You can try doing this before purchase by testing my Better Together or Quantity Discounts modules, both of which are free.

Buy: Buy Big Spender!
Pre-purchase questions? No problem! Just click here.

Marketing Text: click here

See it Live: Go to this test cart. Add $100 worth of hardware (category 1) to your cart. On the shopping cart page, you will see the discount (this is because of Discount Preview). Without Discount Preview, you would see the message on the Order Confirmation page, as shown in this image.

The code that created this Big Spender Discount was:
         $this->add_threshold(100, 'Spend over $100 on hardware, get 10% off your hardware purchase', false); 
         $this->set_constraint(CAT,1);
         $this->set_discount(CAT, 1, '*', "%",10);


Promotional Page Download: The Big Spender promotional page is a free download from my website. You must buy Big Spender separately.
BS Promo Page for osC 2.2     BS Promo Page for osC 2.3.x.

Add-Ons:
If you buy enough hardware items to pass the $200 threshold and then add the movies to your cart, you will be able to see the discount in your cart because of Discount Preview.

Here is a sample of the Big Spender Discount promotional page, which is a free download.

FAQ: click here


Overview:

My Quantity Discounts Contribution allows you to discount the purchase of specific quantities of items, where items can be grouped and counted in a number of ways. Every once in a while though, people ask me to modify the contribution to discount by dollars spent (typically with a few exceptions or exemptions). This is a modification which I do for $30.

Increasingly, however, I have been receiving more complex requests for discounts based on dollars spent. Typically these are initiated after a certain dollar threshold is exceeded. The most common of these is, "provide a free gift after with purchases of a certain amount," or, "provide additional discounts on further purchases after a certain amount has been spent."

None of my existing modules is adequate for this task. This requires a new approach to specifying both conditions and discounts. Hence, Big Spender.

Big Spender is configured by setting "thresholds" and then parameterizing these thresholds, specifying the discounts available once the threshold is exceeded, and (optionally) specifying how the threshold is to be determined, if it is anything other than the total value of all cart items.

Big Spender requires you to add these thresholds and parameters to the module itself - they are not configured through the admin panel. This sounds complicated, but it's not that bad, and many examples of common discounting practices are provided. Please note that Big Spender only provides a discount; it does not automatically add items to the cart.

The calling conventions for building a threshold are as follows:

{ dollar figure, text description, whether to apply the behavior multiple times }

So suppose the discount was stated as, "After $200 is spent, take some action." This would be

   $this->add_threshold(200, "Spend over $200 and get ...", false); 

If the discount was, "For every $200 spent, take some action," the code would be
   $this->add_threshold(200, "For every $200 spent, get ...", true); 

Now we need to parameterize the threshold. Parameter statements apply to the threshold statement they immediately follow. I have provided a visual cue for this by indenting the parameter statements on this page by three spaces. The following types of parameter statements are currently supported:

  • set_discount - discount some product or category by a specific percentage or currency figure
  • set_choice_discount - discount a specified number of items from some product or category by a specific percentage or currency figure
  • set_cart_discount - discount the entire cart by a specific percentage or currency figure
  • set_constraint - determine whether the threshold has been crossed by totalling the value of only the specified products or categories
  • set_negative_constraint - determine whether the threshold has been crossed by totalling the value of all products except those specified
  • set_support - provide additional information on the discount
  • set_deal_id - giving the discount an identifying number to allow other discounts to be filtered out if this number has been run
  • set_no_double_dip - specifying which discounts which, if executed, will cause this discount to be skipped
  • set_group - only apply this discount to members of the listed groups
  • set_min_items - apply this discount only if at least this many items are in the cart and meet the other criteria

One of set_discount(), set_choice_discount() or set_cart_discount() must be done for every threshold for it to have any action. The use of set_constraint() is optional.

Examples

The discount, "Spend over $200, get a free product 5" would be specified as

   $this->add_threshold(200, "Spend over $200 and get a free name-of-product-5", false); 
      $this->set_discount(PROD, 5, 1, "%", 100); 

The discount, "For every $200 spent, get $20 off an item from category 7" would be specified as

   $this->add_threshold(200, "For every $200 spent, get $20 off an item from name-of-category-7", true); 
      $this->set_discount(CAT, 7, 1, "$", 20); 

Now let's add a constraint. The discount, "For every $200 spent from category 3, get two free items from category 7" would be specified as

   $this->add_threshold(200, "For every $200 spent from category 3, get two free items from category-7", true); 
      $this->set_discount(CAT, 7, 2, "%", 100); 
      $this->set_constraint(CAT, 3); 

Now let's add choices. The discount, "For every $200 spent from category 3, get your choice of 2 free gifts from products 20, 25, 30, 35, or 40" would be specified as

   $this->add_threshold(200, "For every $200 spent from category 3, select 2 free gifts... ", true);
      $this->set_choice_discount(2, PROD, 20, "%", 100, 
                                 PROD, 25, "%", 100,
                                 PROD, 30, "%", 100,
                                 PROD, 35, "%", 100, 
                                 PROD, 40, "%", 100);
      $this->set_constraint(CAT, 3); 

What if instead of category 3, you wanted to provide a discount for spending on certain types of products which were spread across categories. We'll call this product class "open stock cookware," and assume that it is made up of product ids 1, 3, 5, 11, 13, 19, 37, and 41. We'll only allow this discount to be offered once per order.

   $this->add_threshold(200, "Spend over $200 on open stock cookware, select 2 free gifts... ", false);
      $this->set_choice_discount(2, PROD, 20, "%", 100, 
                                 PROD, 25, "%", 100,
                                 PROD, 30, "%", 100,
                                 PROD, 35, "%", 100, 
                                 PROD, 40, "%", 100);
      $this->set_constraint(PROD, 1, PROD, 3, PROD, 5, PROD, 11, PROD, 13, PROD, 19, PROD, 37, PROD, 41); 

Discounting can be done in currencies as well. To offer $5 off (or 5 of whatever currency your cart uses), instead of 100% off, use
   $this->add_threshold(100, "Spend over $100, select 2 free gifts... ", false);
      $this->set_choice_discount(2, PROD, 20, "$", 5, 
                                 PROD, 25, "$", 5,
                                 PROD, 30, "$", 5,
                                 PROD, 35, "$", 5, 
                                 PROD, 40, "$", 5);

(The "$" is just used to specify currency; your cart's currency settings will be respected when computing the discount.)

Constraints can be specified in the opposite manner; to total all items in the cart except for gift certificates (category 21), use set_negative_constraint():
   $this->add_threshold(100, "Spend over $100 (excluding gift certificates), get a free product 20", false);
      $this->set_negative_constraint(CAT, 21);
      $this->set_discount(PROD, 20, 1, "%", 100); 

The discount, "Spend over $200, get 20% off one item priced at $100 or more" would be specified as

   $this->add_threshold(200, "Spend over $200, get 20% off one item $100 or more", false); 
      $this->set_discount(MINPRICE, 100, 1, "%", 20); 


The discount, "Spend over $200 on items by manufacturer ABC, get a free product 20" would be specified as

   $this->add_threshold(200, "Spend over $200 on items from manufacturer ABC, get a free product 20", false); 
      $this->set_constraint(MANUF, 7);
      $this->set_discount(PROD, 20, 1, "%", 100); 
(assuming the manufacturer id of ABC was 7.)

The discount, "Get 20% off on items by manufacturer ABC" would be specified as

   $this->add_threshold(1, "20% off items from manufacturer ABC", true); 
      $this->set_constraint(MANUF, 7);
      $this->set_discount(MANUF, 7, "*", "%", 20); 
(again assuming the manufacturer id of ABC was 7.)

Discounts can also be limited to certain groups using set_group():
   $this->add_threshold(100, "Spend over $100, get a free product 20", false);
      $this->set_group(1,3,7);
      $this->set_discount(PROD, 20, 1, "%", 100); 


Discounts can be made to require the purchase of a minimum number of items:
   $this->add_threshold(100, "Spend over $100 on at least 3 items, get a free product 20", false);
      $this->set_min_items(3);
      $this->set_discount(PROD, 20, 1, "%", 100); 


Discounts can be applied to the cart's value:
   $this->add_threshold(100, "Spend over $100 on category 2, get 20% off your purchase", false);
      $this->set_constraint(CAT, 2);
      $this->set_cart_discount("%", 20);


Discounts can be applied to the items that allowed you to cross the threshold.
   $this->add_threshold(100, "Spend over $100 on category 2, get 20% off all category 2 items", false);
      $this->set_constraint(CAT, 2);
      $this->set_discount(CAT, 2, '*', "%", 20); 


You can have different discounts on different products:
         $this->add_threshold(100, 'Spend over $100, get $10 off each hardware item and $5 off each movie', false); 
         $this->set_discount(CAT, 1, '*', "$",10);
         $this->set_discount(CAT, 3, '*', "$",5);


Sometimes you may wish to tier your discounts
   $this->add_threshold(500, "Spend $500 get five free product 20", false);
      $this->set_discount(PROD, 20, 5, "%", 100); 
   $this->add_threshold(100, "Spend $100 get a free product 20", false);
      $this->set_discount(PROD, 20, 1, "%", 100); 

Big Spender does not know that these are related, so this would allow someone spending over $500 to take six free product 20. To indicate that discounts are exclusive, use set_deal_id() and set_no_double_dip().
   $this->add_threshold(500, "Spend $500 get five free product 20", false);
      $this->set_discount(PROD, 20, 5, "%", 100); 
      $this->set_deal_id(1);
   $this->add_threshold(100, "Spend $100 get a free product 20", false);
      $this->set_discount(PROD, 20, 1, "%", 100); 
      $this->set_no_double_dip(1);
Note that when this is done, the highest discount should be specified first; otherwise, a lower discount will block a higher discount.

A set_no_double_dip() on the first threshold and a set_deal_id() on the last are not required but may be specified; the above block is identical to this:
   $this->add_threshold(500, "Spend $500 get five free product 20", false);
      $this->set_discount(PROD, 20, 5, "%", 100); 
      $this->set_deal_id(1);
      $this->set_no_double_dip(2);
   $this->add_threshold(100, "Spend $100 get a free product 20", false);
      $this->set_discount(PROD, 20, 1, "%", 100); 
      $this->set_deal_id(2);
      $this->set_no_double_dip(1);


These thresholds and parameters are not only used in discount calculations; they are also used to create messages which are automatically displayed on the product_info page. Details on how to do this are provided in marketing.

Big Spender is an order total module, so it appears on the Order Confirmation Page of your checkout as a discount (unless Discount Preview is used, which allows the discount to be shown in the cart).

Order Confirmation Page displaying Big Spender Discount

This is a "spend over $100, get 10% off" offer.

osCommerce Order confirmation page showing Big Spender Discount

Detailed Description:

Thresholds and parameters are specified in the setup() method at the bottom of the file includes/modules/order_total/ot_bigspender_discount.php There is no admin interface; you must modify the file directly.

Any number of these discounts may be offered; discount computation will be done in the following order:
  • Thresholds are calculated in the order in which they are specified in setup()
  • For each threshold, the set_discount() and set_cart_discount() statements are executed first (in the order they were specified), then the set_choice_discount() statements (in the order they were specified)
  • Once an item has been discounted, it is not subject to re-discounting, even if rules would permit it
  • Items in the cart are discounted from least expensive to most expensive.


To make these discounts visible on your product info page, follow the directions in marketing below in the installation instructions.

This step will display the message you provided in the add_threshold() command:

For every $200 spent on open stock cookware, select 2 free gifts ...

The message is displayed to encourage the customer to cross the threshold. It is displayed on any item which will contribute to crossing the threshold *and* any item which is discounted after crossing the threshold.

This step is optional; if you prefer, you can add your own marketing text.

Category Handling

Note that CAT has different semantics in Big Spender when compared to Better Together. In Better Together, CAT only includes items directly below the specified category (i.e. CAT means "parent category"). In Big Spender, CAT includes all items in the specified category, whether they are directly below or in subcategories.

Men's Clothing (category 3)
     |
     ---->  Shirts (category 5)
     |      |
     |      -------> shirt A 
     |               shirt B
     |               shirt C 
     ---->  Pants (category 6)
     |      |
     |      -------> pants A 
     |               pants B
     |               pants C 
     ---->  Shoes (category 7) 
            |
            --->  Dress Shoes (category 12) 
            |     |
            |     -------> dress shoes A 
            |              dress shoes B
            |              dress shoes C 
            --->  Casual Shoes (category 18) 
                  |
                  -------> casual shoes A 
                           casual shoes B
                           casual shoes C 

Specifying "Men's Clothing" as a category in Big Spender will include all items in Shirts, Pants and Shoes. Better Together.

Specifying "Shoes" (CAT 7) as a category in Big Spender will include both dress shoes and casual shoes.

Because of the ability to specify categories in both the negative and positive manner, you can create a discount which is triggered by spending over $100 on Men's Clothing, excluding shoes:
   $this->add_threshold(100, "Spend over $100 on Men's clothing (excl. shoes), get a free product 20", false);
      $this->set_constraint(CAT, 3);
      $this->set_negative_constraint(CAT, 7);
      $this->set_discount(PROD, 20, 1, "%", 100); 


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. Login to admin and in Modules->Order Total.
  4. In osCommerce 2.2: you will see 'Big Spender Discount' listed along with all the other modules available. Click on 'Big Spender Discount' to highlight the module and click on 'Install'
  5. In osCommerce 2.3: Click on the "Install Module" button on the upper right. Select the row that says "Big Spender Discount." Press the "Install Module" button on the right hand side of the screen.
  6. Ensure that the sort order that you have selected for Big Spender is not already used by another module. If necessary, change the sort orders of other modules to ensure that Big Spender displays where you want it, with a unique sort order. Also, if you are using Re-calculate Tax = Standard, be sure the Tax sort order is larger than the Big Spender sort order.
  7. Decide on the discounts you wish to use. The easiest way to do this is to open a shopping cart in another window, and just start adding discounts to the setup() method of includes/modules/order_total/ot_bigspender_discount.php The discounts are shown on the second step of checkout in "Your Total" under "Big Spender Discount."
  8. You may wish to use a less silly name than "Big Spender Discount." If so, modify the file includes/languages/english/modules/order_total/ot_bigspender.php
  9. If you wish, follow the guidelines in marketing to advertise your discounts.
  10. Test a transaction and ensure the discount goes all the way through. For PayPal and some other payment methods, you may need to make additional changes, as outlined below in Payment Modules in osCommerce 2.2 and Payment Modules in osCommerce 2.3.
  11. Light a cigar with a $100 bill. You are now a Big Spender!


Optional Installation Instructions:

  1. I highly recommend Discount Preview with all my discounting modules. Without Discount Preview, your customers cannot see the price reductions they are entitled to until the second page of checkout (checkout confirmation). Obviously this is a disadvantage, particularly for new customers who need to go through the additional step of creating an account before they can see this information. Sometimes seeing is believing, so here's a video showing Discount Preview in action.



Notes on Taxes for osCommerce 2.3


If you don't use embedded taxes, and don't have a mix of taxable and tax-free products, and don't have a different rate of tax for shipping, please skip this section.
However, if you any of the above apply to you, please read my Notes on Taxes.



Payment Modules in osCommerce 2.2

Note: This only applies to osCommerce 2.2. For osCommerce 2.3, please click here.

Some contributed payment modules in osCommerce 2.2 (such as PayPal) are not naturally aware of the existence of discounts (mine or any other contribution or extension). For this reason, you must ensure any payment module you use takes discounts into account. Here are some guidelines:
  • If the payment module passes in a subtotal, shipping and tax, modify the subtotal (as shown below) to include the discount.
  • If the payment module passes in a shipping, tax, and total, modify the total (as shown below) to include the discount.
  • In the case of PayPal, turn OFF the sending of line item details, which will confuse PayPal since the total is not the sum of the line items. This can be done through the admin panel by setting Transaction Type to "Aggregate."
The modification involves subtracting the discount amount. If the order total is computed as follows (example taken from paypal_ipn.php):
      foreach ($order_totals as $ot) {
        $order_total[$ot['code']] = $ot['value'];
      }
then the discount is available in the $order_total variable as follows:
ModuleVariable Name
Quantity Discounts$order_total['ot_quantity_discount']
Better Together$order_total['ot_better_together']
Big Chooser$order_total['ot_big_chooser']
Big Spender$order_total['ot_bigspender_discount']
Table Discounts$order_total['ot_table_discounts']
Free Gift Chooserot_freegift_chooser.php


So for instance, subtracting the Quantity Discounts discount from a variable called $subtotal would be done as follows:
$subtotal = $subtotal - $order_total['ot_quantity_discounts'];
This would be done in process_button() for example.

Another more sophisticated approach would be to execute the order totals and use ot_total, which is the final total after discounts.
 

// BEGIN: Change to use order_totals to get values 

      $order_id = substr($cart_PayPal_IPN_ID, strpos($cart_PayPal_IPN_ID, '-')+1);
      $ord_totals = array();
      $ord_totals_query = tep_db_query("select class, value from " . TABLE_ORDERS_TOTAL . 
          " where orders_id = '" . (int)$order_id . "' order by sort_order");
      while ($totals = tep_db_fetch_array($ord_totals_query)) {
        $ord_totals[$totals['class']] = $totals['value'];
      }

// END

. . . 

      $parameters['business'] = MODULE_PAYMENT_PAYPAL_IPN_ID;
// BEGIN : use order_totals['ot_total'] for order total to include all discounts.  
      if ($ord_totals['ot_total'] > 0) {
        $parameters['amount'] = number_format($ord_totals['ot_total'], $currencies->get_decimal_places($currency));
      } else {
        $parameters['amount'] = number_format($order->info['total'] - $order->info['shipping_cost'] 
           - $order->info['tax'], $currencies->get_decimal_places($currency));
      }
// END 


Payment Modules in osCommerce 2.3

Note: This only applies to osCommerce 2.3. For osCommerce 2.2, please click here.

Some contributed payment modules in osCommerce 2.3 (2.3.1-2.3.3.x) are not naturally aware of the existence of discounts (mine or any other contribution or extension). For this reason, you must ensure any payment module you use takes discounts into account.

For some carts, PayPal Website Payments Standard has been changed to accommodate these osC discounts, but in a bizarre way. If you have
Subtotal: $30
Postage: $7.69
Discount: -$12.00
Tax (7%): $1.26
-----------------------------
Total:   $26.95
PayPal turns this into
Subtotal: $17.16
Tax (7%): $2.10
Shipping: $7.69
-----------------------------
Total:   $26.95
This is in osC 2.3.3, with no changes made to PayPal. But the final number is correct (and your actual order total figures as shown in osC admin will be correct per the checkout confirmation page).

I have seen this work on some carts and not on others depending on mods and settings; please test your own cart carefully.

PayPal Express in osCommerce 2.3 still has problems with osCommerce discounts. Here is one way to fix it:

In ./ext/modules/payment/paypal/express.php, right above the block on line 544-545 that sets the item and tax amounts:
      $params['ITEMAMT'] = $items_total;
      $params['TAXAMT'] = $tax_total;
insert the discount computation. Here's an example for Quantity Discounts. Pull in the module and its language file. Then compute the discount and add it in as a line item.
      // Add OT
      require('includes/modules/order_total/ot_quantity_discount.php');
      include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_quantity_discount.php');
      $discount = new ot_quantity_discount();
      if ($discount->check()) {
         $qd = $discount->calculate_deductions();
         if ($qd['total'] > 0) {
            $amt = $qd['total'] * -1;
            $params['L_NAME' . $line_item_no] = 'Discount';
            $params['L_AMT' . $line_item_no] = $amt;
            $params['L_NUMBER' . $line_item_no] = 0;
            $params['L_QTY' . $line_item_no] = 1;
    
            $product_tax = 0; 
            $params['L_TAXAMT' . $line_item_no] = $paypal_express->format_raw($product_tax);
            $items_total += $paypal_express->format_raw($amt);
            $line_item_no++;
         }
      }

For other modules, here are the filenames. The object to be created is the filename without the .php suffix.
ModuleFile Name
Quantity Discountsot_quantity_discount.php
Better Togetherot_better_together.php
Big Chooserot_big_chooser.php
Big Spenderot_bigspender_discount.php
Table Discountsot_table_discounts.php
Free Gift Chooserot_freegift_chooser.php


Marketing

What good is having cross selling and upselling specials if you don't advertise them?

Big Spender Discounts may be automatically displayed in two places: on the product info page, and on a separate promotional page. We'll talk about the product info page first.

Modify catalog/product_info.php, and add this block of code:
<?php 
require(DIR_FS_CATALOG. 'bigspender_marketing.php');
?>
The placement of this code is a matter of personal preference; try placing it below the product description and adjust to your tastes. It creates a message on your page that uses the description you provided in the add_threshold():

For every $200 spent on open stock cookware, select 2 free gifts ...


Only one div block of text will be produced, with the div id bigSpenderDiscountPolicy.

The file bigspender_marketing.php also contains additional print statements which are commented out, but which you may uncomment if desired. These include:
  • An indication of whether this product contributes towards reach the threshold and/or is discounted after the threshold is reached
  • The display of additional "supporting" text for the discount that you have added using $this->set_support(). Such text can include links to PDFs, links to products in your cart, links to external pages, or simply descriptive text. This text will be automatically displayed on the Big Spender Discount promotional page.

Styling this block of text (changing font, color, etc.) is simply a matter of adding to your stylesheet

#bigSpenderDiscountPolicy {
   font-size: 200%;
   color: #ff0000;
}
This would give you

For every $200 spent on open stock cookware, select 2 free gifts ...

Probably a bit more obnoxious than you would truly want, but you get the idea.

Alternately, you could modify the marketing text template (bigspender_marketing.php) and put the text into a fieldset:

 Big Spender Discounts 
For every $200 spent on open stock cookware, select 2 free gifts ...


The approach to marketing text for Big Spender is different than the one used in Better Together, in that it is not triggered by a particular product. Instead, it is globally displayed on all product info pages unless that product is constrained out of the discount. So for instance, if you have
   $this->add_threshold(100, "Spend over $100 on Men's clothing (excl. shoes), get a free product 20", false);
      $this->set_constraint(CAT, 3);
      $this->set_negative_constraint(CAT, 7);
      $this->set_discount(PROD, 20, 1, "%", 100); 
then the marketing text will appear on pages for products in category 3 (and subcategories), and on the page for product 20, but not on pages in category 7 (and subcategories). If the two constraints were not specified, the marketing text would appear on all product info pages. Note that price based constraints are not used to filter out marketing text because the final price of a product may not be known on the product info page.

The other available marketing vehicle is the Big Spender Discount promotional page. This page is completely optional; it is not included in the bigspender.zip file, but it is a free download from my website for people who have purchased Big Spender. It creates a page that looks like this, displaying all discounts and supporting text.

Files

(new)  catalog/includes/languages/english/modules/order_total/ot_bigspender_discount.php
(new)  catalog/includes/modules/order_total/ot_bigspender_discount.php
(new)  catalog/bigspender_marketing.php


Formal Syntax of Thresholds and Parameters

Thresholds and Parameters, which are specified in the setup() function of ot_bigspender_discount.php, are the mechanism for configuring a store's discounts.

Thresholds

Discounts always begin by specifying a spending threshold. All subsequent parameters (until the next threshold) apply to this threshold.

$this->add_threshold(<amount>,<description>,<repeatable>);

where:
amountis the cart total above which the discounts apply
descriptionIs a textual description of the discount. This description is not automatically created the way it is in Better Together; it must be added manually. The reason for this is to allow greater flexibility
repeatableis a boolean flag indicating whether to apply the discount only one time (false) or as many times as possible (true).


Parameters - set_discount

The set_discount() command specifies the items or categories whose prices should be reduced if the threshold has been met.

$this->set_discount(<discount 1>[,<discount 2>,...,<discount n>]);

where:
discountis the string PROD, CAT, PRICE, MINPRICE or MANUF, followed by an identifier (product or category id, or product price), followed by a quantity, followed by a percent or dollar sign, followed by an amount

<PROD | CAT | PRICE | MINPRICE | MANUF> <product or category identifier or price> <item count> < "$" | "%" > <discount amount>
The item_count may be specified as "*", meaning "the discount may be taken an unlimited number of times."


Parameters - set_cart_discount

The set_cart_discount() command specifies the reduction in the total cart price that should be done if the threshold has been met.

$this->set_cart_discount(<"$"|"%">, <discount_amount>);

where:
price reductionis a percent or dollar sign, followed by an amount


Parameters - set_choice_discount

The set_choice_discount() command specifies that the customer may choose between a series of discounts if the threshold has been met.

$this->set_choice_discount(<count><choice 1>,<choice 2>[,...,<choice n>]);

where:
countis the number of discounts the customer will receive; it must be a numeric quantity
choiceis the string PROD, CAT, PRICE, MINPRICE or MANUF, followed by an identifier (product or category id, or product price), followed by a percent or dollar sign, followed by an amount

Note that this is different from the discount specified in set_discount because no explicit quantity is specified per choice; the quantity set at the level above.
<PROD | CAT | PRICE | MINPRICE | MANUF> <product or category identifier or price> < "$" | "%" > <discount amount>


Parameters - set_constraint

The set_constraint() command specifies the items whose prices are used to determine if the threshold has been passed. If this command is not specified, the total price of all items in the cart is used.

$this->set_constraint(<qualifying_purchase 1>[,<qualifying_purchase 2>,...,<qualifying_purchase n>]);

where:
qualifying_purchaseis the string PROD, CAT, PRICE, MINPRICE, or MANUF, followed by an identifier (product or category id, or product price)

<PROD | CAT | PRICE | MINPRICE | MANUF> <product or category identifier or price>


Parameters - set_negative_constraint

The set_negative_constraint() command specifies the items whose prices are NOT used to determine if the threshold has been passed. If this command is not specified, the total price of all items in the cart is used.

$this->set_negative_constraint(<excluded_purchase 1>[,<excluded_purchase 2>,...,<excluded_purchase n>]);

where:
excluded_purchaseis the string PROD, CAT, PRICE, MINPRICE, or MANUF, followed by an identifier (product or category id, or product price)

<PROD | CAT | PRICE | MINPRICE | MANUF> <product or category identifier or price>


NOTE: A negative constraint does not mean "the item must not be in the cart;" it simply means "the item is not counted towards the reaching the total."

Parameters - set_support

The set_support() command provides additional supporting text to describe your promotion. It is completely optional.

$this->set_support(<text>);

where:
textis a text string, which can be plain text or a link

These strings are displayed on your promotional page, and optionally, on your product info page if you follow the guidelines in marketing.

Parameters - set_deal_id

The set_deal_id() command allows you to give a threshold and its associated discount an id, to allow later discounts to be filtered out if this discount has been run using set_no_double_dip. This parameter is optional and is only needed for discounts which preclude other discounts.

$this->set_deal_id(<nnnn>);

where:
nnnnis some number which identifies this threshold or group of thresholds.

For convenience, use the same id for all members of a related group of thresholds ("Spend $1000, get..", "Spend $500, get ...", "Spend $250, get ...") where you only want the highest value discount to be executed.

Parameters - set_no_double_dip

The set_no_double_dip() command allows you to give a specify that if a certain discount has already been run, the current discount should be skipped. This parameter is optional and is only needed for discounts which preclude other discounts.

$this->set_no_double_dip(<nnnn>);

where:
nnnnis the id which was used in a set_deal_id() command for one or more previous thresholds.

Multiple set_no_double_dip commands may be used as required.

Parameters - set_group

The set_group() command specifies that the discount is only available to members of the listed group(s).

$this->set_group(<group 1>[,<group 2>,...,<group n>]);

where:
groupis the group eligible to receive the discount


Parameters - set_min_items

The set_group() command specifies that the discount is only available to if a certain number of items or more are purchased and meet the other discount requirements.

$this->set_min_items(<nnnn>);

where:
nnnnis the minimum number of items required to get the discount.




Major Versions

  • Version 1.2.8a - 08/14/16 - Fix minor PHP error in constructor.
  • Version 1.2.8 - 09/21/13 - Update for osCommerce 2.3.3.3.
  • Version 1.2.7 - 11/01/11 - Added VAT + bug fixes from Zen Cart Big Spender 1.2.7.
  • Version 1.2.5 - 05/01/10 - Some PHP5's didn't handle quantities correctly.
  • Version 1.2.4 - 11/18/09 - First release

FAQ

Q: Why is there an Big Spender in the first place?
A: To better facilitate a more powerful model for discounting based on dollars spent than can be done by modifying Quantity Discounts.

Q: Why is the version number of the first release so high?
A: Big Spender for osCommerce is based on a product of the same name for the Zen Cart platform. The version of this product at the time was 1.2.4, so I started at the same number. This means you get hardened, field tested code in the first release.

Q: Why is doesn't this have the same features as the Zen Cart version?
A: Zen Cart has certain built in features which osCommerce does not, such as groups and coupons. I didn't want to rely on the contributions that provided these features in osCommerce, so I omitted them entirely.

Q: Why do you have to add PHP code to setup()? Why didn't you put this in the Admin panel?
A: Although it's a bit tedious to have to manually code the associations, it maximizes the module's flexibility. If you need help with the setup logic, I will be happy to do it for you for a small fee, but first look at the many examples in this page.

Q: Can I start and stop my Big Spender discounts on certain dates in the future?
A: Please see Timing Discounts in osCommerce for an explanation of how to do this.

Q: How do I determine a product's id?
A: In the catalog, click on the product to open the product info page. In the address bar of your browser, you see something like
... product_info.php?products_id=24&osCsid=...
The products_id = 24 tells you the product's id is 24.

Q: How do I determine a product's category id?
A: In admin->catalog, single click on the category you're interested in. In the address bar of your browser, you will see something like
categories.php?cPath=3&cID=11
If you were to double click on it, you'd see something like
categories.php?cPath=3_11
The category you want to use is "11".

In the same way, in the catalog you can hover over this category in the categories sidebox and see
catalog/index.php?cPath=3_11
This re-confirms that the category is "11."

Q: How do I find out the manufacturer id so I can use MANUF?
A: Go to the Manufacturer's sidebox on your catalog home page and select a manufacturer. The resultant URL will look something like this:
catalog/index.php?manufacturers_id=8&osCsid=rhifpa0duotjnoadm4e5is70k0
The "manufacturers_id=8" component of this URL indicates that the id for this manufacturer is 8.

Q: I would like my discounts to show up in the shopping cart. Why don't they?
A: The way the Order Total modules work is that they show up at checkout time. However, if you require the discounts to show up in the shopping cart, you may wish to purchase the Discount Preview module for $30.

Alternately, you may indicate that you have a Big Spender discount policy by displaying a message on the shopping cart page informing the user that Big Spender discounts will be calculated (and visible) at checkout time. Additionally, changing SUB_TITLE_SUB_TOTAL in the same file to something like 'Sub-Total BEFORE Discount' will emphasize the fact that a discount will be added at checkout time.

Q: How can I present my Big Spender discounts on the product page?
A: Follow the directions in marketing in the installation instructions for details on the changes that are required.

Q: I like the message on my product page, but I'd like it to have a link in it. The threshold for my discount is a $100 hardware purchase, which corresponds to category 1.
A: You can create a link in your message.
         $this->add_threshold(100, 'Spend over $100 on <a href="index.php?main_page=index&cPath=1">hardware</a>, 
                                    get two movies free', false);
This will show up on your product info page as
         'Spend over $100 on hardware, get two movies free'
Be sure to construct your link WITHOUT a osCsid. Do not just copy and paste from your address bar!

Q: What is the difference between MINPRICE and PRICE?
A: PRICE means the price must be exactly equal to the specified value. MINPRICE means the price must be greater than or equal to the specified value. So using MINPRICE in a set_constraint means that only items of this price or greater count in the threshold calculation. Using MINPRICE in a set_negative_constraint means that only items below this price are counted. And using MINPRICE in a set_discount() or set_choice_discount() means that items at the specified price or greater will match the rule.

Q: If I specify multiple thresholds with the same discounts, will Big Spender double discount my products?
A: Each product in the customer's cart will only be discounted once by Big Spender. Specifying "repeatable" for a threshold or an item count greater than 1 for set_discount will discount multiple times only if multiple items exist; it will not cause the same item to be discounted multiple times.

Q: I like Big Spender, but I really just want to give cash discounts to my customers. Is this possible?
A: The "set_cart_discount()" command was introduced to allow this.

Q: In what order are the discounts evaluated?
A: The thresholds are evaluated in the order they are entered, with the set_discount() parameters executed first (in the order they were entered), followed by the set_choice_discounts (in the order they were entered). If repeatable is specified, a discount is run as many times as possible (as long as products are not discounted multiple times). If a threshold uses no_double_dip, and other thresholds with the specified ids have already been passed and discounted, that threshold's discounts will not be run.

All discounts are run unless a discount is precluded because of a set_no_double_dip() command. Items are discounted in the order least expensive to most expensive.

Q: OK, I have the Big Spender information on my product page, but my customers can't figure out that the discount isn't visible until checkout time
A: Add some explanatory text to the discountPolicy information you created above. This way it will show up every time there is Big Spender information on a page. Alternately, you may purchase the Discount Preview module, or you may also add text to the shopping cart page to indicate that Big Spender discounts will show up at checkout time as discussed above.

Q: I operate a multilingual shop. How can I avoid putting my descriptions in ot_bigspender_discount.php?
A: If you run a multilingual shop, then instead of putting the string in the add_threshold() command directly, edit the file includes/languages/english.php and put your definitions there as PHP defined strings. Here's an example:

<?php
  define('BIGSPENDER_MOVIE_DISCOUNT', "Spend over $200, get a movie half off");
?>
Then, in ot_bigspender_discount.php, do
$this->addthreshold(200, BIGSPENDER_MOVIE_DISCOUNT, false); 


Q: How do I put a link in my supporting text?
A: To put an external link, use
            $this->set_support('<a href="articles/Sample_PDF.pdf">Sample PDF document</a>');
(single quotes around the entire string and double quotes around the href parameter or vice versa.)

For a link to a category (say category 17), use
         $this->set_support('Here is our <a href="index.php?main_page=index&cPath=17">hardware</a> category');


For a link to a product (say product 9), use
    $this->set_support('Here is our  <a href="index.php?main_page=product_info&products_id=9">widget</a> product');


Q: How can I display images? Can I use set_support to display images?
A: Absolutely!
    $this->set_support('<img src="images/my_image.jpeg" />');


Q: All these rules and parameters and combinations make my head hurt. Will you configure this for me?
A: Naturally. Contact me with your requirements for a quote.

I charge a fee of $60 for Big Spender. Buy Now.
The fee covers software only; installation is extra if you require help.