Binding a payment module to more than one country zone ID
Hi, Im using the eway payment module for credit card, it has an option in the admin to set it to function for one zone - or none at all.
Id like to make a small change to the file for it to work within two country zones.
If Im reading the code correctly, its checking the ‘geo zones’ against the db and deciding whether to allow the module based on what country is chosen in the admin. (and as mentioned above, the option in the admin only lets you chose one country or none at all)
Could someone please help me rewrite this to allow the module to be based on one or more zones?
PHP Code:
// class methods
function update_status() {
global $order, $db;
if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_EWAY_ZONE > 0) ) {
$check_flag = false;
$check = $db->Execute("SELECT zone_id FROM " . TABLE_ZONES_TO_GEO_ZONES . " WHERE geo_zone_id = '" . MODULE_PAYMENT_EWAY_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();
}
if ($check_flag == false) {
$this->enabled = false;
}
}
}
Cheers,
Scott.
Re: Binding a payment module to more than one country zone ID
Simply create *another* zone definition that contains *both* sets of zones you want it to work for. Then set *that* new zone in the payment module's zone restrictions.
Re: Binding a payment module to more than one country zone ID
Hi DrByte, I wasnt aware that zones could actually be manipulated in that way. I'll give it a go thanks!
Re: Binding a payment module to more than one country zone ID
Thanks Dr Byte, that did the trick.
Just one interesting thing.. when there is only one shipping method available to a user it has a pre-selected radio button next to that one shipping option.
For the payment module, in my case Im only allowing Paypal for certain countries - the payment module was visible as I was checking out but not 'selected' by way of a radio button or checkbox.
I know that doesnt stop me from checking out, but I must admit, it really threw me for a few minutes - I could see the payment method and thought (incorrectly) that I had no way of selecting it.
Just my 2c :smile: