Don't edit that line of cod.php
Here are some suggested changes to that file that will achieve what you want:
find this section of code:
// disable the module if the order only contains virtual products
if ($this->enabled == true) {
if ($order->content_type != 'physical') {
$this->enabled = false;
}
}
immediately before it, insert this code:
// disable the module if order value exceeds admin-configured maximum limit
if (zen_not_null(MODULE_PAYMENT_COD_MAX_VALUE) && ($order->info['subtotal'] > MODULE_PAYMENT_COD_MAX_VALUE)) {
$this->enabled = false;
}
now, add this line to the list of configuration keys in the function install() down near the bottom so you can set from admin the maximum order value you want to allow COD payments for:
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Maximum Order Value', 'MODULE_PAYMENT_COD_MAX_VALUE', '500', 'Maximum order subtotal allowed for COD payment. (Leave blank for no upper limit)', '6', '0', now())");
and in the function keys() right at the bottom, change the whole array line to this:
return array('MODULE_PAYMENT_COD_STATUS', 'MODULE_PAYMENT_COD_ZONE', 'MODULE_PAYMENT_COD_ORDER_STATUS_ID', 'MODULE_PAYMENT_COD_SORT_ORDER', 'MODULE_PAYMENT_COD_MAX_VALUE');
Once you upload the modified file, you will need to remove the module and reinstall it from Admin > Modules > Payment so the new configuration key is added to the database.