Thanks for the replies. :)

I bet it's something really easy to fix but I just have no idea! Would someone mind taking a look at the code below from modules/order_total/ and see what the problem might be please?

Code:
<?php



  class ot_3_for_2_discount_flags {

    var $title, $output;
    var $explanation; 

    function ot_3_for_2_discount_flags() {
      $this->code = 'ot_3_for_2_discount_flags';
      $this->title = MODULE_ORDER_TOTAL_3_FOR_2_DISCOUNT_FLAGS_TITLE;
      $this->description = MODULE_ORDER_TOTAL_3_FOR_2_DISCOUNT_FLAGS_DESCRIPTION;
      $this->sort_order = MODULE_ORDER_TOTAL_3_FOR_2_DISCOUNT_FLAGS_SORT_ORDER;
      $this->output = array();
    }

	function check_product($pid) {
		global $db;
		
		$sql_chk = " select products_id from products_3_for_2_flags where products_id = ". (int)$pid;
		$rs_chk = $db->Execute($sql_chk);
		
		if ($rs_chk->EOF) {
			return false;
		}
		else {
			return true;
		}
	}
	
    function print_amount($amount) {
      global $db, $order, $currencies;
      return  $currencies->format($amount, true, $order->info['currency'], $order->info['currency_value']);
    }

    function get_order_total() {
       global  $order;
       $order_total_tax = $order->info['tax'];
       $order_total = $order->info['total'];

       $order_total -= $order->info['shipping_cost'];
       $order_total -= $order->info['tax'];
       $orderTotalFull = $order_total;
       $order_total = array('totalFull'=>$orderTotalFull, 'total'=>$order_total, 'tax'=>$order_total_tax);
       return $order_total;
    }

    function process() {
       global $db, $order, $currencies;
       $od_amount = $this->calculate_deductions();
       if ($od_amount['total'] > 0) {
         $order->info['total'] = $order->info['total'] - $od_amount['total'];
         $this->title = '<a href="javascript:alert(\'' . $this->explanation . '\');">' . $this->title . '</a>'; 
         $this->output[] = array('title' => $this->title . ':',
         'text' => '-' . $currencies->format($od_amount['total'], true, $order->info['currency'], $order->info['currency_value']),
         'value' => $od_amount['total']);
       }
    }

    function calculate_deductions() {
       global $db, $order, $currencies;
	   
       $od_amount = array();
       $od_amount['tax'] = 0;

       $products = $_SESSION['cart']->get_products();

       $prod_list = array();
       $prod_list_price = array();
       $prod_list_back = array(); 
	   
       $all_items = 0;
       $all_items_price = 0;
	   
	   $disc_amount = 0;

       for ($i=0, $n=sizeof($products); $i<$n; $i++) {
	   
	   	if ($this->check_product($products[$i]['id'])) {
		
	          $price = $products[$i]['final_price'];
	          $quantity = $products[$i]['quantity'];
	
			  //$disc_amount += $this->get_disc_amount($quantity, $price);
			  
	          //$prod_list_back[$products[$i]['id']] = &$products[$i];
	          //$prod_list[$products[$i]['id']] += $quantity;
	          //$prod_list_price[$products[$i]['id']] += ($price * $quantity);
	
	          $all_items += $quantity;
	          //$all_items_price += ($price * $quantity);
		}	  
		
       }

		$disc_amount += $this->get_disc_amount($all_items, $price);
		  
       $this->explanation = YOUR_CURRENT_3_FOR_2_DISCOUNT_FLAGS . "\\n" . "\\n"; 
       $this->explanation .= "\\n\\n" . TOTAL_DISCOUNT . $this->print_amount($disc_amount); 
	   $od_amount['total'] = round($disc_amount, 2); 
       return $od_amount;
   }

   function get_disc_amount($count,$price) {
      $disc_amount = 0;
	  $new_count = $count - ($count%3);
//	  if (($count % 3) == 0) {
	  	$disc_amount = ($new_count/3) * 3;
//	  }	
      return $disc_amount; 
   } 


   function pre_confirmation_check($order_total) {
      $od_amount = $this->calculate_deductions();
      return $od_amount['total'] + $od_amount['tax'];
    }

    function credit_selection() {
      return $selection;
    }

    function collect_posts() {
    }

    function update_credit_account($i) {
    }

    function apply_credit() {
    }

    function check() {
      global $db;
      if (!isset($this->_check)) {
        $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_3_FOR_2_DISCOUNT_FLAGS_STATUS'");
        $this->_check = $check_query->RecordCount();
      }
      return $this->_check;
    }

    function keys() {
      return array('MODULE_ORDER_TOTAL_3_FOR_2_DISCOUNT_FLAGS_STATUS', 'MODULE_ORDER_TOTAL_3_FOR_2_DISCOUNT_FLAGS_SORT_ORDER');
    }

    function install() {
      global $db;
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('&copy; Gary<br /><div><a href=\"http://www.mywebsite.com\" target=\"_blank\">Website</a></div><br />This module is installed', 'MODULE_ORDER_TOTAL_3_FOR_2_DISCOUNT_FLAGS_STATUS', 'true', '', '6', '1','zen_cfg_select_option(array(\'true\'), ', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_3_FOR_2_DISCOUNT_FLAGS_SORT_ORDER', '299', 'Sort order of display.', '6', '2', now())");
    }

    function remove() {
      global $db;
      $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }

  }

?>
The table products_3_for_2_flags is there too. Here's a screen cap :)



Any idea? Please?