You should probably put your logic for detecting the customer's eligibility into the update_status() function, since that area is used to verify that the customer's address fits within a qualifying zone. It would be logical to include your additional check inside that section.
Since you're using the money-order module as an example, you'd put it in this section of code:
Code:
function update_status() {
global $order, $db;
if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_MONEYORDER_ZONE > 0) ) {
$check_flag = false;
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_MONEYORDER_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
while (!$check->EOF) {
if ($check->fields['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check->fields['zone_id'] == $order->billing['zone_id']) {
$check_flag = true;
break;
}
$check->MoveNext();
}
// add new code here
// do lookup customer using $_SESSION['customer_id']
if (customer is qualified) {
$check_flag = true;
$this->allowed_days = [number of days retrieved from lookup]
} else {
$check_flag = false
}
// end of added code
if ($check_flag == false) {
$this->enabled = false;
}
}
}
Then use $this->allowed_days later in the module when asking for the customers commitment to pay within the required timeline.
Bookmarks