Hi, I am trying to modify an oscommerce module and adapt it to the clients needs but have difficulties so was wondering if i could get some help here.
I am trying to modify the code of minimum amount order, so I can have the option of choosing the zone instead of destination. I made some changes, but does not seem to work. Where have I gone wrong? Any idea? This is part of original file:
PHP Code:class ot_minimum_order {
var $title, $output,$description,$enabled,$sort_order;
function ot_minimum_order() {
$this->code = 'ot_minimum_order';
$this->title = MODULE_ORDER_TOTAL_MINORDER_TITLE . ' (' . MODULE_ORDER_TOTAL_MINORDER_TITLE_INSERT . MODULE_ORDER_TOTAL_MINORDER_ORDER_UNDER . ')';
$this->description = MODULE_ORDER_TOTAL_MINORDER_DESCRIPTION;
$this->enabled = ((MODULE_ORDER_TOTAL_MINORDER_STATUS == 'true') ? true : false);
$this->sort_order = MODULE_ORDER_TOTAL_MINORDER_SORT_ORDER;
$this->output = array();
}
function process() {
global $order, $currencies;
if (MODULE_ORDER_TOTAL_MINORDER_LOW_ORDER_FEE == 'true') {
//Check to see if we are going to use this on this order
switch (MODULE_ORDER_TOTAL_MINORDER_ZONE) {
case 'national':
if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;
case 'international':
if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;
case 'both':
$pass = true; break;
default:
$pass = false; break;
}
and I changed this to:
PHP Code:class ot_minimum_order {
var $title, $output,$description,$enabled,$sort_order;
function ot_minimum_order() {
$this->code = 'ot_minimum_order';
$this->title = MODULE_ORDER_TOTAL_MINORDER_TITLE . ' (' . MODULE_ORDER_TOTAL_MINORDER_TITLE_INSERT . MODULE_ORDER_TOTAL_MINORDER_ORDER_UNDER . ')';
$this->description = MODULE_ORDER_TOTAL_MINORDER_DESCRIPTION;
$this->enabled = ((MODULE_ORDER_TOTAL_MINORDER_STATUS == 'true') ? true : false);
$this->sort_order = MODULE_ORDER_TOTAL_MINORDER_SORT_ORDER;
if ( ($this->enabled == true) && ((int)ORDER_TOTAL_MINORDER_ZONE > 0) ) {
$check_flag = false;
$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . ORDER_TOTAL_MINORDER_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
while ($check = tep_db_fetch_array($check_query)) {
if ($check['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check['zone_id'] == $order->delivery['zone_id']) {
$check_flag = true;
break;
}
}
if ($check_flag == false) {
$this->enabled = false;
}
}
$this->output = array();
}


Reply With Quote
Bookmarks