Originally Posted by
swguy
> Should there be an Admin page check?
Yep.
Thank you for the quick response. I was just not sure where to put the control. I am wondering if this is the right place to block out while in the admin section (added if control around ---> // Check if called in admin page):
PHP Code:
function __construct() {
global $order, $currencies, $db;
$this->code = 'ot_insurance';
$this->title = MODULE_ORDER_TOTAL_INSURANCE_TITLE;
$this->description = MODULE_ORDER_TOTAL_INSURANCE_DESCRIPTION;
$this->enabled = ((MODULE_ORDER_TOTAL_INSURANCE_STATUS == 'true') ? true : false);
$this->sort_order = MODULE_ORDER_TOTAL_INSURANCE_SORT_ORDER;
$this->credit_class = true;
$this->output = array();
$geozones = $db->Execute("SELECT * FROM " . TABLE_GEO_ZONES);
$this->num_zones = $geozones->RecordCount();
if (!defined('IS_ADMIN_FLAG') || (IS_ADMIN_FLAG === false)) { // Check if called in admin page
if ($this->enabled == true) {
$this->dest_zone = 0;
for ($i = 1; $i <= $this->num_zones; $i++) {
if ((int) constant('MODULE_ORDER_TOTAL_INSURANCE_ZONE_' . $i) > 0) {
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . constant('MODULE_ORDER_TOTAL_INSURANCE_ZONE_' . $i) . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
while (!$check->EOF) {
if ($check->fields['zone_id'] < 1) {
$this->dest_zone = $i;
break;
}
elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
$this->dest_zone = $i;
break;
}
$check->MoveNext();
} // end while
} // END if ((int)constant('MODULE_ORDER_TOTAL_INSURANCE_ZONE_' . $i) > 0)
} // END for ($i=1; $i<=$this->num_zones; $i++)
if ($this->dest_zone < 1 && MODULE_ORDER_TOTAL_INSURANCE_ZONE_1 > 0) {
$this->enabled = false;
}
}
} // Check if called in admin page
}
Bookmarks