Sorry, I meant that the code did not change the status of the payment module.
I did not get any errors.
With your help I changed the code to:
// 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 = '".$_SESSION['customer_id']."' AND customers_group_pricing = '1' ");
if ($gpcheck->fields['count'] >0){ $check_flag = true; }
//end modification
if ($check_flag == false) {
$this->enabled = false;
}
}
}
```However, it still does not work properly:
the (Check/Money Order) payment module is published
(Payment Zone: --none--, Set Order Status: default, Sort order of display: 0).
But the module is shown in all cases; the added code does not hide the payment module for customers who are NOT in the Group Price group (who have customers_group_pricing=1 in their record).
I analysed the code that is parsed just before my modification:
If the module is enabled and the customer is located in the zone were the payment module is assigned to, then **$check_flag = true;**
In case it is set to **$check_flag = true; **then my modification cannot alter it to false, can it?
So maybe I should add the else { $check_flag = false;} part to my if statement?
Furthermore I have two general questions regarding module modification:- If the PHP code of some module is changed, are the effects immediate?
Or should I unpublish (remove) the module and republish (install) it before any changes will work?
- How can you debug the modules?
Using echo / print_r commands won't work:
there will be no screen output from within the class/method.
Kind Regards,
Peter Martin, Joomla specialist
www.db8.nl