The file /includes/modules/order_totals/ot_cod_fee.php begins with
Code:
class ot_cod_fee {
var $title, $output;
function ot_cod_fee() {
$this->code = 'ot_cod_fee';
$this->title = MODULE_ORDER_TOTAL_COD_TITLE;
$this->description = MODULE_ORDER_TOTAL_COD_DESCRIPTION;
$this->enabled = ((MODULE_ORDER_TOTAL_COD_STATUS == 'true') ? true : false);
$this->sort_order = MODULE_ORDER_TOTAL_COD_SORT_ORDER;
$this->output = array();
}
function process() {
global $order, $currencies, $cod_cost, $cod_country, $shipping;
if ($this->enabled == 'true') {
//Will become true, if cod can be processed.
$cod_country = false;
While this code magically operates, it is semantically incorrect. The function ot_cod_fee sets the enabled flag to either binary true or false, based on the text-based value in the database. The function process then proceeds to test whether it should process based on the text-based value. This only works because (binary)true == EVERYTHING and (binary)false == NOTHING.
Just to reduce confusion in the future, I suggest that the code be changed to
Code:
class ot_cod_fee {
var $title, $output;
function ot_cod_fee() {
$this->code = 'ot_cod_fee';
$this->title = MODULE_ORDER_TOTAL_COD_TITLE;
$this->description = MODULE_ORDER_TOTAL_COD_DESCRIPTION;
$this->enabled = ((MODULE_ORDER_TOTAL_COD_STATUS == 'true') ? true : false);
$this->sort_order = MODULE_ORDER_TOTAL_COD_SORT_ORDER;
$this->output = array();
}
function process() {
global $order, $currencies, $cod_cost, $cod_country, $shipping;
if ($this->enabled) {
//Will become true, if cod can be processed.
$cod_country = false;
Bookmarks