Current Version: 2.4
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.
Configuration:
The basic configuration of Better Together involves adding PHP code
to the setup() function in the module, as shown below. For people
who would prefer not to do this, a
Better Together Admin panel
is available.
Many examples of basic configuration are shown in this help file;
examples of advanced configuration are also available.
Add-Ons:
The add-ons for Better Together are all grouped together on one page called
The Better Together World.
Better Together is an order total module, so the discount is
not visible until the second page of checkout. If you want
to see the discount on the shopping cart page (or sidebox), look at
Discount Preview.
The Checkbox Cross Sell
allows you to enable add to cart of items which are cross sold through
better together with just the tick of a checkbox.
The items appear on the product info page underneath the add to cart
button, and if checked, are added at the same time as the main item.
The Better Together Admin panel
(a separate product which is sold as commercial software)
allows you to create discounts without
needing to edit files.
If you add product 12 to your cart in my demo site,
you will notice that on the shopping
cart page (and the first checkout page) that
Checkout Candy
re-enforces the upselling message.
The gold standard of online retailing is Amazon.com.
Zen Cart store operators looking to increase their profitability
should constantly be asking, "WWAD?" or "What would Amazon do?"
When you look at an item in Amazon, not only is a cross selling
recommendation made, a discount is offered to persuade the
customer to accept the recommendation. This mod permits you
to offer this type of discounted cross selling in your Zen Cart.
You may specify
Buy item X, get item Y at a discount
Buy item X, get an item from category A at a discount
Buy an item from category A, get an item from category B at a discount
Buy an item from category A, get item X at a discount
You may also specify cross sells for any of these variants
("You may also be interested in ...").
Cross sells
are pairings like the ones listed above, but without a discount.
Discounts may be specified as percentages of the latter item's price or as
absolute values in the currency your cart uses.
These discount specifications are called "linkages," because they
"link" one product or category to another. These linkages 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.
In addition, Better Together may be used to facilitate two-for-one offers for identical items. Although it may be argued that this is simply a special case
of "buy item X, get item Y at a discount," this capability was added to
facilitate two for one offers for an entire category of goods with a single statement.
You may specify two-for-one type specials such as
Buy item X, get another item X free
Buy an item from category A, another identical item free
Better Together is an order total module, so it appears on the second page
of your checkout as a discount (unless
Discount Preview
is used, which allows the discount to be shown in the cart).
Please note that Better Together only provides a discount; it does not automatically
add items to the cart.
If you need to automatically add your discounted items
to the cart, take a look at Auto Add.
(Note that several restrictions apply to Auto Add; please read the documentation carefully.)
Payment Page displaying Better Together Discount
Detailed Description:
The original model for adding Better Together discounts was that people would
modify the setup() function at the bottom of
the file
This still works, but now another available option is the
Better Together Admin panel
(a separate module which is sold commercially).
Better Together Admin is easy to use and fast - and it's a great way to show your support
for Better Together.
If you wish to continue editing the setup function,
several examples are provided.
Four types of linkages may be performed. The format of each of these
is the same:
first identifier (product or category)
second identifier (product or category)
"%" or "$" to indicate how discounting is to be done, or "X" for a cross sell
a number, indicating the discount amount.
The four calls for the
four types of discounting are
add_prod_to_prod()
add_prod_to_cat()
add_cat_to_cat()
add_cat_to_prod()
If a straight two for one discount is what is desired, the calls are
add_twoforone_prod()
add_twoforone_cat()
Let's consider two products: product 5 from category 3, and product 2
from category 1.
Suppose you want to offer a 50% discount on product 5 with the purchase
of product 2. Make the setup() function look like this:
function setup() {
$this->add_prod_to_prod(2,5,"%", 50);
}
Want to make it buy product 2, get product 5 free?
function setup() {
$this->add_prod_to_prod(2,5,"%", 100);
}
How about buy one product 2, get one free?
function setup() {
$this->add_prod_to_prod(2,2,"%", 100);
}
If you just want to cross sell product 5 when product 2 is displayed, use
function setup() {
$this->add_prod_to_prod(2,5,"X", 0);
}
Remember product 5 is in category 3. If instead of specifying product 5
in particular, you want to discount any item in category 3
by 20% with the purchase of a product 2 item, use
function setup() {
$this->add_prod_to_cat(2,3,"%", 20);
}
Discount can be done in currencies as well. To offer $7 (or 7 of whatever
currency your cart uses), use
function setup() {
$this->add_prod_to_cat(2,3,"$", 7);
}
(The "$" is just used to specify currency; your cart's currency settings
will be respected when computing the discount.)
Remember product 2 is in category 1. If you want to widen the discount to
provide a discount of 20% off any item in category 3 when an item from
category 1 is purchased, use
function setup() {
$this->add_cat_to_cat(1,3,"%", 20);
}
Any number of these discounts may be offered; discount computation will
be done in the order in which your discounts are specified in setup(),
and items will be processed in the order in which they appear in the cart.
Using the examples above, suppose these items are in your cart:
function setup() {
$this->add_prod_to_prod(2,5,"$", 7);
$this->add_cat_to_cat(1,3,"%", 25);
}
The following discounts will be computed:
$7 off ONE product 5 because of ONE product 2 (rule 1)
25% each off TWO product 20 because of TWO product 10 (rule 2)
To get $7 off the second product 5, the customer would need to add
a second product 2 to the cart.
With the same cart, coding
function setup() {
$this->add_cat_to_cat(1,3,"%", 25);
$this->add_prod_to_prod(2,5,"$", 7);
}
Would compute the following discount:
25% off ONE product 20 because of ONE product 2 (rule 1)
25% off ONE product 20 because of ONE product 10 (rule 1)
25% off ONE product 5 because of ONE product 10 (rule 1)
Obviously these could be very different discounts!
To create a two for one discount for product 5, simply code
function setup() {
$this->add_twoforone_prod(5);
}
And to create two for one discount for all products in category 3, code
function setup() {
$this->add_twoforone_cat(3);
}
Note the difference between
function setup() {
$this->add_twoforone_cat(3);
}
and
function setup() {
$this->add_cat_to_cat(3,3,"%", 100);
}
The latter says, "buy any item from category three, and get 100%
off any other item from category three." The former says, "all
items in category three are buy one, get an identical item free."
So if a customer bought items 20 and 30 from category three,
a discount would only be given in the latter case.
To make these discounts visible on your product info page, customize the file
includes/templates/template_default/templates/tpl_product_info_display.php
as described in marketing below in the installation instructions.
This step will create text like this:
The link is created to facilitate the cross sell.
This step is optional; if you prefer, you can add your own cross selling text.
Category Handling
Note that the "category" in add_cat_to_cat(), add_prod_to_cat(),
add_cat_to_prod() and add_twoforone_cat() is the
parent category, as determined by the master_categories_id field
in the products table. If subcategories are being used, the parent category
will not be the
same as the top level category. If the product is linked to another category, the parent category will still be the original parent category (the master_categories_id field).
Men's Clothing (Category 7)
|
----> Shirts (Category 12)
|
-------> shirt A
shirt B
shirt C
In this example, the parent category of "shirt A" is "Shirts," not
"Men's Clothing." "Mens' Clothing" would be considered the top level category.
In stores where the first level of categories has products directly underneath it, the top level category and the parent category are the same.
If your store uses subcategories and you require the ability to reference
categories at different levels,
you may wish to consider purchasing either
Combination Discounts or
Big Chooser.
Again, note that "parent category id" is determined using the master_categories_id field
from the products table. So if Shirt A is also linked
into a category called "Hot Products," the parent category is still
category 12 (Shirts). For more details on category handling
in Better Together, please see
the Category Issues page.
Installation Instructions:
Back up everything! Try this in a test environment prior to installing
it on a live shop.
If you already have the Better Together module installed, please
deinstall your old copy by going to Admin->Modules->Order Total,
selecting "Better Together" and pressing the "Remove" button. Make
a note of your settings so you can apply them to the new version.
Copy the contents of the unzipped folder to the root directory of your
shop.
The names of these files reflect a template name of "custom." If you are
using a different template name, please change file paths using "custom" to
use your template name instead.
Login to admin and in Modules->Order Total you will see 'Better Together' listed along with all the other modules available.
Click on 'Better Together' to highlight the module and click on 'Install'
Decide on the linkages you wish to use, and add them to
the setup() function in includes/modules/order_total/ot_better_together.php.
Open a shopping cart in another window to test these discounts. They
are shown on the second step of checkout in
"Your Total" under "Better Together."
The most common installation problems for this module are as follows:
For
Better Together Admin panel
users: Forgetting to modify
includes/modules/order_total/ot_better_together.php
as described in the Better Together Admin Panel instructions.
Using a category function - add_prod_to_cat(), add_cat_to_prod(), add_cat_to_cat() or add_twoforone_cat() - can cause problems - see
the Category Issues page.
Some people try deleting the setup function and wind up deleting the
final brace in the file, which causes a blank page on checkout. The
bottom of the file
includes/modules/order_total/ot_better_together.php
should look like this:
function setup() {
.. some statements here ....
}
}
?>
The final curly brace must not be deleted.
Not donating often causes problems. Donate! Show your appreciation by supporting my efforts.
If you are having trouble installing this module, you should also refer
to my
Guide to Mod Installation on Zen Cart.
I'm also happy to install most of my mods for a fee.
Marketing
What good is having cross selling and upselling specials if you don't
advertise them?
Better Together 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.
There are two built-in ways to display Better Together items on the product info page:
In addition, the following extensions also exist for showing the Better Together info on the product info and other pages:
As checkboxes on the product info page, allowing people to add cross sell items without attributes
to their cart when they add
the main item, using
Checkbox Cross Sell.
As links on the product info page, including a single button which
will purchase both items, with
Buy Both Now.
Showing Better Together Discounts
Customize the tpl_product_info_display.php file to advertise
your discounts. Copy the file
The placement of this code is a matter of personal preference.
Some people like it at the top of the page, right above the first
zen_draw_form() call; others place it below the product description.
The marketing text will appear like this on your product info page:
In version 2.1 and higher, the marketing text may also be displayed with images of the products. Use the following code in your tpl_product_info_display.php file:
If both products do not have attributes, and you want to offer a one
click buying opportunity, you may wish to upgrade to
Buy Both Now.
You will see the marketing text appear like this:
Buy Both Now
Buy Both Now is sold
separately from Better Together; it's a paid add-on.
There are also marketing opportunities on the Shopping Cart page; the
Checkout Candy module can be configured to show available Better Together
discounts both on the Shopping Cart page and on the first page of
checkout.
Showing Better Together Cross Sells
The cross sells work differently - since there is no discount to be displayed,
they are shown more like a regular Zen Cart product display.
For instance, suppose your setup function looked like this:
function setup() {
// Add all linkages here
$this->add_prod_to_prod(3, 83, 'X', 0);
$this->add_prod_to_prod(3, 25, 'X', 0);
}
When you are on the product info page for product 3,
if you add the Better Together Cross Sell template change,
you will see products
25 and 83 displayed like this:
To display the cross sell marketing on your product info page, simply add the following code to the bottom
of your includes/templates/YOUR TEMPLATE/templates/tpl_product_info_display.php file:
Note that cross sells, unlike regular Better Together offers, are not
bidirectional; in the example above, product 3 will not appear on
the page for products 83 and 25 unless you explicitly add a cross
sell statement to do this:
The other available marketing vehicle is the Better Together Discount promotional page.
This page is completely optional; it is not included in the Better Together
Contribution,
but it is a free download.
It creates a page that looks like
this,
displaying all discounts.
You may also optionally add an "Add both to Cart" button to the
Promotional page; see
the
Better Together Promotional Page for details.
Discount Preview makes
Better Together pop!
It shows the discount on the shopping cart page, instead of making your customers wait until the checkout payment page to see their discounts.
Here's a screenshot of the shopping cart page on a cart using Discount Preview and Better Together.
The discount was a prod to prod linkage between these two items.
Notice that the description has been changed to "Bundle discount."
(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.)
Mixing taxable and non-taxable products
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.
Tax Descriptions
Due to the way gross-up and gross-down calculations are done for
shops using embedded taxes, your tax descriptions (as shown in
Admin->Locations/Taxes->Tax Rates) must be unique.
The customer using the setup shown below had problems because
the recalculation logic couldn't tell which version of Varav moms
(Swedish for "Including VAT") should be used.
Different rates of tax for shipping
If you have taxable shipping but the tax rate is different than it is for
products, you'll need to make some code changes. Firstly, be sure your
descriptions for shipping taxes include an easily identifiable string
such as "on shipping"
Then, in the discount module you use, skip over this tax when computing
the updated amount of tax.
Here is a block of logic from Quantity Discounts 1.11. (Newer versions
may look different.)
1.5 09/08/2007 Fixed some messages; consolidated marketing text down to one div; only display marketing text if module turned on
1.4a 07/31/2007 Simplified inclusion of marketing logic by adding it to this package. Some minor language improvements.
1.3 12/30/2006 Adding marketing ability to print discounts in reverse order. (If buy A, get B free is offered, can now show this on B's page, not just A's page.) Allow products which are ordered in odd quantities to be used as twoforones *and* better together discounts if so specified. Previously, twoforone products were not additionally checked for better together discounts.
1.2 12/03/2006 Adding explicit two for one support
1.1 09/26/2006 Providing PHP 4 compatibility
1.0 09/15/2006 First Release
Bugs
Users wishing to sort native discounts (such as Coupons or Group Discounts) after my discounts, with tax recalculation, should look at
this page.
Older versions of Better Together (prior to 1.6)
require a patch to run under Zen Cart 1.3.8. Take
this function and paste it
right above the function calculate_deductions()
in the file includes/modules/order_total/ot_better_together.php.
The latest versions (1.6 and greater) include this patch, but if you haven't upgraded,
you must manually apply the patch.
FAQ
Q: What's the difference between
Buy Both Now and
the
Better Together Promotional Page with Add both to Cart? A: They're two separate products. Buy Both Now works with the marketing
text on the product info page; the Promotional Page with Add both to Cart
works on the Promotional page.
Q: How do I install this software? A: Installation instructions are here. If you've never installed a Zen Cart mod before, please read my
Guide to Mod Installation on Zen Cart.
Q: How do I set up Better Together discounts? A: Decide on the linkages you wish to use, and add them to
the setup() function in includes/modules/order_total/ot_better_together.php.
("Linkages" are what "add_prod_to_prod," etc. are called.)
Don't want to edit code? Get the Better Together Admin panel.
Q: Can I start and stop my Better Together discounts on certain dates in the future? A: Please see Timing Discounts in Zen Cart for an explanation of how to do this.
Q: I'm using a category function - add_prod_to_cat() or add_cat_to_cat() or add_twoforone_cat() - and it's not working! A: This is the most common question of all.
Please see the Category Issues
page for solutions.
Q: Why do you have to add PHP code to setup()? Why didn't you put
this in the Admin panel? A: When I created Better Together, I wanted it to be as flexible as possible,
and I focused on functionality, not ease of use. Over time, the demand grew
for an admin panel, and when the project got funded, I did it.
Creating the Better Together Admin panel was a significant amount of work and represents my main
revenue stream for Better Together (the support for which consumes hours
of my time every week); please show your support for my
software by purchasing it.
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 show your
support for Better Together by
purchasing the
Discount Preview
module for $30.
Alternately, you may indicate that you have a Better Together
discount policy by adding to
TEXT_INFORMATION in includes/languages/english/shopping_cart.php, and inform the user that Better Together 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 Better Together discounts on the product page? A:Create your custom template
if you haven't already done so.
Then customize the file includes/templates/template_default/templates/tpl_product_info_display.php.
Follow the directions in
marketing in the installation instructions
for details on the changes that are required.
Q: OK, I have the Better Together 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 discount policy information you created
above. This way it will show up every time there is Better Together
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 Better Together discounts will show up at checkout time
as discussed above.
Q: OK, I have Better Together specials, but my customers aren't biting.
How can I re-enforce the promotion? A: My Checkout Candy module can be configured to show available Better Together
discounts both on the Shopping Cart page and on the first page of
checkout. Please consider showing your support for Better Together
by purchasing this module.
Q: I don't want
Discount Preview
or Checkout Candy, but
I'd still like to make a contribution to show my appreciation
for Better Together - how do I do this? A:Click here!
All donations are greatly appreciated.
Q: What would my setup() look like if I wanted to give 2 for 1 on all items in category 1? A: You have two options. This provides a two for one discount, allowing you
to mix and match items from category 1:
function setup() {
$this->add_cat_to_cat(1,1,"%", 100);
}
This provides a two for one discount on identical items in category 1:
function setup() {
$this->add_twoforone_cat(1);
}
Q: What would my setup() look like if I wanted to give 2 for 1 on all items 5, 8, 12, 17 and 31? What about buy one get one half off? A: Here's what you would do for 2 for 1:
As in the previous question, mixing and matching is allowed with
these discounts - but since these are specific products, what are the
semantics of "mixing and matching?"
Well, for add_prod_to_prod() and add_twoforone_prod(),
mixing and matching means
"having different attributes."
If you wish to give a buy one get one free
for only precisely the same item for items 5 and 8,
and not permit mixing and matching,
you would use:
function setup() {
$this->add_twoforone_prod(5);
$this->add_twoforone_prod(8);
}
For example, if you sell sweaters with the attribute "color," then buying a red
sweater and a blue sweater would not produce a discount if add_twoforone_prod()
were used, but it would if add_prod_to_prod() were used.
Q: What would my setup() look like if I wanted to do buy one of item 5, get one from category 2, 7 or 9 at $5 off? A: Here's what you would do:
function setup() {
$this->add_prod_to_cat(5,2,"$", 5);
$this->add_prod_to_cat(5,7,"$", 5);
$this->add_prod_to_cat(5,9,"$", 5);
}
Q: Can I do three for the price of two? Four for the price of three? A: No. But
You may also wish to look at
Combination Discounts and
Big Chooser
can do this sort of discounting.
Q: What if I want to do offers on all my products? A: The setup() function is in a php file, so you can write software
to configure your discounts. For instance, if you have 600 products,
and you want to do "buy one get one 50% off" on all of them, you can do:
function setup() {
for ($i = 1; $i <= 600; $i++) {
$this->add_prod_to_prod($i,$i,"%", 50);
}
}
Obviously you could do this for add_twoforone_prod, etc. just as well.
Another approach would be to inspect the cart
and call add_prod_to_prod (or whatever) on all items in the cart.
The downside with this is that the marketing text then wouldn't work.
Extensions
The following Better Together extensions are available:
Allow people to add your cross sold items (without attributes) with a
single tick of a checkbox using
Checkbox Cross Sell.