Zen Cart custom software development, Zen Cart modules, Zen Cart Expert eCommerce with Zen Cart!

Zen Cart Buy Both Now

Zen Cart Buy Both Now for Better Together Marketing Text

Buy Both Now for Better Together Marketing Text is a Zen Cart™ extension which allows a shopowner to enhance the product info page marketing text with a one click purchase of two items grouped using my Better Together Contribution.

Note that Buy Both Now for Better Together Marketing Text and the Promotional Page with Add Both to Cart are sold separately.

Relevance: Zen Cart™ 1.3.9, 1.5.x, along with Better Together

This extension is part of the Better Together World.

Current Version: 2.5 (version history)

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

Cost: $20.00 (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. Please use my contact form.

Installed Cost: $120.00 (Professional installation by That Software Guy)

Installation Difficulty: Moderate (Some file merging)

Installation Instructions: click here

Buy: Get Buy Both Now!
Pre-purchase questions? No problem! Just Please contact me with your question.

FAQ: click here

Restrictions: click here. Please read this section carefully; if you have questions, please contact me before purchasing.

See it Live: Go to product 3 in my demo shop you will see the cross-sell message for product 25, along with a button that allows both products to be purchased with a single click. The code that created this Better Together linkage was:
         $this->add_prod_to_prod(3, 25, "%", 50);

Add Ons: Better Together Promotional Page with Add Both to Cart (sold separately)

osCommerce User? This is a Zen Cart page. Look at the Better Together for osCommerce World for osCommerce help.


This product complements my Better Together contribution by allowing you to have a single button that adds both items to the cart - just like Amazon does. The button is displayed on the product info page for products with no attributes which are linked using add_prod_to_prod or add_twoforone_prod. (Note: Products with defaultable attributes may be used, if you have installed my Default Attribute mod.)

Amazon Style

Product Info Page displaying Buy Both Now

Zen Cart Better Together with Buy Both Now

If you prefer, you may add an image to this text as shown below:

Product Info Page displaying Buy Both Now with Images

Zen Cart Better Together with Buy Both Now and Images


  • The linkage must use only products. In other words, only add_prod_to_prod or add_twoforone_prod. Linkages like add_cat_to_cat() and add_prod_to_cat() will not display a "buy both now" button.
  • The product must not have attributes. If you look at product 14 in my demo shop you will see that since it has attributes, it does not display a "buy both now" button.
  • The marketing text must be at the very top (recommended) or the very bottom of the page. Details are provided in the README file.
  • Of course it works for twoforone_prod linkages! Look at product 6 in my demo shop for an example.
  • Buy Both Now is for Better Together only; it does not understand Combination Discounts linkages.

    For Combination Discounts, see Buy The Set.
Note that Buy Both Now works best with Discount Preview. This way, customers can see their discount on the shopping cart page instead of having to wait for the Checkout Payment page.

Installation Instructions:

The first steps are the same as the Better Together installation instructions. Note that the instructions for adding marketing text are left out, because Buy Both Now is the same as marketing text.
  1. Back up everything! Try this in a test environment prior to installing it on a live shop.
  2. Install the latest version of Better Together. The download is here. 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.
  3. 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. Note: If you are using Zen Cart 1.5.5 or higher, your template name will be "responsive_classic" if you have not changed it.
  4. Login to Admin and in Modules > Order Total you will see 'Better Together' listed along with all the other modules available.
  5. Click on 'Better Together' to highlight the module and click on 'Install'
  6. 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."
  7. If you wish, install the Better Together Promotional Page (which displays all your Better Together discounts on one page).

Next, you have to add Buy Both Now by customizing your product info page.

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 be sure you have installed tpl_better_together_marketing.php in this same directory.

Now you must add this block of code to the tpl_product_info_display.php file

     $current_page_base,'templates'). '/tpl_better_together_marketing.php');

to use images, use

     $current_page_base,'templates'). '/tpl_better_together_marketing_images.php');

NOTE! There are only TWO places this block of code may be inserted. It must be either immediately before the first "bof Form start" or immediately after the last "bof Form close".

If you have an old copy of tpl_product_info_display.php with this code after the product description, you must move it.

Want to get the product images aligned with the plus sign? See the README file in the mod for code samples.

Installation Problems:

The most common installation problems for this module are as follows:
  1. Forgetting to put the marketing text either before or after the <form> tag. The marketing text cannot be placed arbitrarily on the page with Buy Both Now; it must be before or after the form begins or ends. See the README that comes with the module.
  2. Trying to use Buy Both Now on items with attributes. Buy Both Now only works on product linkages (add_prod_to_prod or add_twoforone_prod) with no attributes.
  3. If your template uses CSS buttons, then you'll need to make a small change: Edit the file includes/functions/extra_functions/checkbbn_pi.php At the bottom, replace $bbn_string_end = '<input type="image" src="' . $button . '" alt="Buy both now" title="Buy both now" /></form>';
    $bbn_string_end = "  " . zen_image_submit($image, "Buy Both Now") . "</form>";
  4. Got a blank page? Review the guidelines for Debugging a blank page in Zen Cart
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.

Major Versions

Buy Both Now is a superset of Better Together; the change history shown here shows all changes to both modules.
  • 2.5 12/26/2018 - Updates for plus sign options
  • 2.4a 01/14/2018 - Form didn't work in some environments
  • 2.4 08/01/2016 - Updates for Default Attribute
  • 2.3d 03/06/2012 Update for Zen Cart 1.5.0
  • 2.3b 09/01/2011 Bug when displaying marketing text on listing pages
  • 2.3a 07/23/2010 Bug in Marketing Text
  • 2.3 05/02/2010 Cross Sells
  • 2.2 04/03/2010 VAT handling
  • 2.1a 02/18/2010 Minor housekeeping
  • 2.1 12/20/2009 Added images to marketing text
  • 2.0 09/01/2008 Added price sorting, add_cat_to_prod
  • 1.6 12/14/2007 Compatibility with 1.3.8.
  • 1.5a 09/18/2007 Fixed Google Checkout issue.
  • 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
Better Together Admin panel version 3.1 or higher (with Cross Sells), you must upgrade to Buy Both Now version 2.3 or higher.


Q: What's the difference between Buy Both Now and the Better Together Centerbox with I Want Both and the Better Together Promotional Page with Add Both to Cart?
A: They're all 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, and the Centerbox (and the I Want Both button) works on the main page.

Q: What do you mean by "defaultable attributes" or "single valued defaultable attributes?"
A: The two terms mean the same thing. They're just attributes for which a default value can be selected without needing input from the product info page. "Single valued" means the attribute has just one value. For example, a radio button with just one value (such as "PDF" or "ZIP file") is single valued. A radio button with two values (such as "red" or "green") would not be single valued. Similarly, "defaultable" means the single value can be easily set without needing additional input. For example, product with a single TEXT attribute would be single valued but not defaultable, since it's not known what the correct value would be. Similarly, a product requiring a file upload would not be defaultable.

Note that in order to take advantage of defaultable attributes, you need my Default Attribute contribution if your Zen Cart version is lower than 1.5.7. (It has been built in since Zen Cart 1.5.7.)

Q: Why doesn't Buy Both Now work with products with non-defaultable attributes?
A: Buy Both Now automatically adds the two items to the cart. You can't just add something with non-defaultable attributes to the cart automatically because you don't know the correct attribute settings; there are as many possibilities as the arithmetic product of the number of options. There's no way to know which one is right. So then the customer would have to go in and modify that item and add a new one with the correct attributes (because you can't edit an item in the cart), and then delete the old one. In addition, if there was javascript validation of the attributes, this would be sidestepped if I allowed Buy Both Now to automatically add items to the cart. So given all these complications, I decided to not allow it and clearly advertise this fact.

I charge a fee of $20.00 for Buy Both Now for Zen Cart. Buy Now!
The fee covers software only; installation is extra if you require help.