function product_tare_group_bulk($category, $tare_group)
{
    global $db;
    $db->Execute("UPDATE " . TABLE_PRODUCTS . " SET products_tare_group='" . (int) $tare_group . "' WHERE master_categories_id = '" . (int) $category . "'");
    $sub_categories = $db->Execute("SELECT * FROM " . TABLE_CATEGORIES . " WHERE parent_id = '" . (int) $category . "'");
    if ($sub_categories->RecordCount() > 0) {
        while (!$sub_categories->EOF) {
            product_tare_group_bulk((int) $sub_categories->fields['categories_id'], (int) $tare_group);
            $sub_categories->MoveNext();
        }
    }
    $product_to_cat_groups = $db->Execute("SELECT * FROM " . TABLE_PRODUCTS_TO_CATEGORIES . " WHERE categories_id='" . (int) $category . "'");
    while (!$product_to_cat_groups->EOF) {
        $db->Execute("UPDATE " . TABLE_PRODUCTS . " SET products_tare_group='" . (int) $tare_group . "' WHERE products_id = '" . (int) $product_to_cat_groups->fields['products_id'] . "'");
        $product_to_cat_groups->MoveNext();
    }
}
<?php

/**
 * @package admin
 * @copyright Copyright 2003-2011 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: zones.php 19330 2011-08-07 06:32:56Z drbyte $
 */
require 'includes/application_top.php';
$tare_group_array = array(array('id' => '1', 'text' => 'Product Tare Group 1'), array('id' => '2', 'text' => 'Product Tare Group 2'), array('id' => '3', 'text' => 'Product Tare Group 3'), array('id' => '4', 'text' => 'Product Tare Group 4'), array('id' => '5', 'text' => 'Product Tare Group 5'));
if (isset($_POST['bulk_add_tare_groups']) && $_POST['bulk_add_tare_groups'] == 'true') {
    $category_bulk_add = zen_db_prepare_input($_POST['category']);
    $tare_group_bulk_add = zen_db_prepare_input($_POST['products_tare_group']);
    product_tare_group_bulk($category_bulk_add, $tare_group_bulk_add);
    $messageStack->add("Applied Product Tare Group to " . zen_get_category_name((int) $category_bulk_add, 1), 'success');
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php 
echo HTML_PARAMS;
?>
>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo CHARSET;
?>
">
        <title><?php 
echo TITLE;
?>