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

osCommerce Better Together Admin

osCommerce Better Together Admin

Better Together Admin simplifies the process of adding discounts to Better Together.

Relevance: osCommerce™ 2.2 and 2.3, along with Better Together.
This software will not work under PHP 8.
PLEASE NOTE there is currently no Better Together Admin for Phoenix. (Use Discount Chooser instead.)

Current Version: 1.0a
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: $30 (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: $90.00 (Professional installation by That Software Guy)

Installation Difficulty: Moderate

Installation Instructions: See README.txt in mod

Common Installation Issues: click here

Buy: Buy Better Together Admin.
Pre-purchase questions? No problem! Just Please contact me with your question.

FAQ: click here

Video: Here's a movie of me creating a Better Together discount in osCommerce using Better Together Admin.

Incompatibilities: This mod builds dropdowns of all categories with products and all products in a specific category once that category is selected.

For this reason, if you have
  • over 400 categories containing products, or
  • categories with other 400 products in them,
please do not buy this software; the dropdowns will not work. You can determine how many categories you have by doing this query in phpMyAdmin:
SELECT COUNT( DISTINCT categories_id ) FROM products_to_categories;

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


This page assumes a basic familiarity with Better Together.

Better Together is a very popular module, but many people have told me they dislike need to edit a file in order to add "linkages" (the term I used to describe associating one product with another for the purpose of discounting). So I created an admin panel which allows you to add linkages in a way which will be familiar to users of the osCommerce admin system.

Better Together Admin Panel

osCommerce Better Together Admin Panel

The page is broken into two areas: on the top, a list of existing discounts, and on the bottom, a form to allow you to add new linkages to create new discounts.

See it Live! If you go to my demo admin (link no longer working), and login with userid "test" password "test" you can see Better Together Admin live. It's under the Tools menu. (This is a Zen Cart but the osCommerce admin panel looks and works the same.)

Discounts are listed in the order they were created. Discounts can currently be deleted but not edited directly; instead, to edit a discount, delete the existing one and create a new one.

Once you select a linkage type, the appropriate fields are filled in for the first product or category and the second product or category. For instance, in this example, the Linkage Type "A product and a category" (add_prod_to_cat) is selected. The "Buy" dropdown is automatically populated with a complete list of categories, with a list of products for the selected category, and the "Get" dropdown is automatically populated with a complete list of categories. Choose the correct category, then the correct product within that category for the "Buy" item. Then choose the correct category for the "Get" item.

Better Together Admin - Add a new linkage - step 1

osCommerce Better Together Admin - Add a new linkage

You then select the discount units (% or $ off, or Cross Sell), fill in the amount, and press "Submit."

Better Together Admin - Add a new linkage - step 2

osCommerce Better Together Admin - Add a new linkage

The page refreshes, and you see your new linkage at the top of the list.

Better Together Admin - Add a new linkage - step 3

osCommerce Better Together Admin - Add a new linkage

See it Live! You can see Better Together Admin live by going to my demo admin (link no longer working), and logging in with userid "test" password "test" It's under the Tools menu. (This is a Zen Cart but the osCommerce admin panel looks and works the same.)

If you decide you don't want to offer one of your discounts, you have two options: you may permanently delete the discount with the "Delete" button, or you may temporarily suspend the discount with the "Set Inactive" button. When you set a discount inactive, the notation "INACTIVE" is painted next to the discount in red letters. This discount will not be applied at checkout, nor will it show up in the Better Together marketing text, on the Better Together Promotional Page, or in Checkout Candy on your shopping cart and shipping page.

Installation Instructions:

Please see README.txt in the mod.

Installation Problems:

The most common installation problems for this module are as follows:
  1. Unfamiliarity with installing mods. Please review my Guide to Mod Installation on osCommerce.
  2. Not updating the sort orders for your order total modules.
    One method I recommend is to multiply the default values by 10, and adjust from there. For example:
    Sub-Total 10
    Shipping  20
    Discounts 21-29
    Tax       30
    Total     40
    Be sure the values are unique (i.e. do not use any particular number twice).
  3. Incorrectly installing osCommerce Better Together.
  4. Forgetting to modify includes/modules/order_total/ot_better_together.php as described in step 4 of the README.
  5. Some hosts require scripts which are run from a URL - for example,
    to have permissions 644. You may see a message like
    HTTP 500: Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    when running Better Together Admin if this is the case with your host. Simply set the permissions of admin/better_together_admin.php to 644 using your FTP client (or perhaps your cPanel File Manager).
  6. One European IE6 user reported that the linkage type dropdown was not responding. The fix was to match the XAJAX encoding type with what was actually being received from the server. At the top of the file admin/better_together_admin.php, under the version number, insert the line
    define ('XAJAX_DEFAULT_CHAR_ENCODING', 'iso-8859-1');
    (or whatever your encoding is).
    You can tell you have 8859-1 encoding if you look at your web pages and see a line like this close to the top:

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    If so, and your dropdowns are not responding, try this fix.
  7. Some people who use ISO 8859 encoding also have reported getting errors like this:
    PHP Warning:  htmlspecialchars() [<a href='function.htmlspecialchars'>function.htmlspecialchars</a>]: Invalid multibyte sequence in argument in 
    ... admin\includes\xajax\xajax_core\xajaxResponse.inc.php on line 1575

    If this is happening to you, edit the file admin/better_together_admin.php and delete the function addCreateOptions (around line 28-37). Insert this in its place:
      function addCreateOptions($sSelectId, $options) {
        if (sizeof($options) > 0) {
           foreach ($options as $option) {
             $optval = $option['val']; 
             $text = htmlentities($optval); 
             $text = html_entity_decode( $text, ENT_NOQUOTES, "UTF-8" );
             $this->script("addOption('".$sSelectId."','".  $option['id']."','".$text."');");

    If your products have the registered trademark symbol (®) in their names you need to make this change.
  8. You have installed Better Together, right? The admin panel doesn't include the basic module, which is a free download from the osCommerce forum.
  9. I have seen installations where the AJAX queries fail (clicking linkage type does not populate the dropdowns for Buy and Get) because misplaced blank lines in PHP files. If you do a View Source in your browser and see something like this:

    osCommerce Better Together Admin Installation Failure

    The blank line on line 1 means the DOM parsing of the page will fail. You must fix this before you will be able to use Better Together Admin.
  10. Are you using PHP7? If so, please follow the Installation Tweaks for Better Together Admin on PHP7. The steps are basically the same.
  11. Did you read the incompatibilities list? You may have too many categories, for example. If this describes you but you have already bought the software, please contact me; I may be able to write some custom logic (at additional cost) to help you make this mod work.

Issues with newer PHP Versions:

NOTE: The easiest way to get all these changes is to follow the PHP7 Installation tweaks.

Xajax is an older module, and will need modification if you are running a newer version of PHP with specific settings.
  1. If you get a message like
    Only variables should be assigned by reference in YOUR_ADMIN/includes/xajax/xajax_core/xajaxPluginManager.inc.php on line 268

    You just need to make one change:
    In file YOUR_ADMIN/includes/xajax/xajax_core/xajaxPluginManager.inc.php on line 268, change
    $mResult =& $objPlugin->register($aArgs);
    $mResult = $objPlugin->register($aArgs);
  2. If you get a message like
    PHP Strict Standards:  Non-static method xajaxPluginManager::getInstance() should not be called statically, assuming $this from incompatible context in YOUR_ADMIN/includes/xajax/xajax_core/xajax.inc.php on line 269
    then you will need to change these 4 files in admin/includes/xajax/xajax_core:

    In each file, modify the signature of the getInstance() function so that it is declared static. So change
    function &getInstance()
    public static function &getInstance()
    You must make the change in all four files.
If you are having trouble installing this module, you should also refer to my Guide to Mod Installation on osCommerce. I'm also happy to install most of my mods for a fee.

Major Versions

  • 1.0a 07/01/2014 - Updates to provide better support for osC 2.3.x.
  • 1.0 04/17/2013 - First release


Q: Why do I have to enable Javascript to run the Better Together Admin Panel?
A: Because it uses AJAX, a Javascript based technology. This creates a faster, more responsive user interface. If you do not enable Javascript in your browser, you will see a flashing red error message at the top of the page, and the Better Together Admin Panel will not operate.

Q: I would like to make it more obvious that a discount is inactive. How can I do this?
A: Edit the file admin/includes/bt_stylesheet.css and add
.inactive {
Now the entire line for an inactive discount will be red. Lines for active discounts use the ".active" class if you would prefer to do it the other way around.

I charge a fee of $30 for the Better Together Admin Panel. Buy Now!
The fee covers software only; installation is extra if you require help.