I edited /includes/modules/payment/moneyorder.php and included:
//check if current customer is part of a certain (customers_group_pricing) group pricing (zen_group_pricing -> 1) category
$gpcheck = $db->Execute("select count(*) as count from " . TABLE_CUSTOMERS . " where customers_id = '".$order->customer['customers_id']."' AND customers_group_pricing = '1'; ");
if ($gpcheck->fields['count'] >0){ $check_flag = true; }else{ $check_flag = false; }
//end modification
into the class method function update_status().
I am trying to check if the current customer is part of the
Group Pricing group "1" and if not, disabling this payment method.
Unfortunately it is not working.
Did I make some error, or is this modification not possible this way?
Code:
// class methods
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();
}
//check if current customer is part of a certain (customers_group_pricing) group pricing (zen_group_pricing -> 1) category
$gpcheck = $db->Execute("select count(*) as count from " . TABLE_CUSTOMERS . " where customers_id = '".$order->customer['customers_id']."' AND customers_group_pricing = '1'; ");
if ($gpcheck->fields['count'] >0){ $check_flag = true; }else{ $check_flag = false; }
//end modification
if ($check_flag == false) {
$this->enabled = false;
}
}
Bookmarks