Code:
// make sure all the zones are available in the configuration table
for ($i = 1; $i <= $this->num_zones; $i++)
{
$check = $db->Execute("select * from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_ZONETABLE_ZONE_" . $i . "'");
if ($check->EOF)
{
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone " . $i . "', 'MODULE_SHIPPING_ZONETABLE_ZONE_" . $i . "', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
define('MODULE_SHIPPING_ZONETABLE_ZONE_' . $i, '0');
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " . $i ." Shipping Table', 'MODULE_SHIPPING_ZONETABLE_COST_" . $i ."', '25:8.50,50:5.50,10000:0.00', 'The shipping cost is based on the total cost or weight of items or count of the items. Example: 25:8.50,50:5.50,etc.. Up to 25 charge 8.50, from there to 50 charge 5.50, etc', '6', '0', 'zen_cfg_textarea(', now())");
define('MODULE_SHIPPING_ZONETABLE_COST_' . $i, '25:8.50,50:5.50,10000:0.00');
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Handling Fee', 'MODULE_SHIPPING_ZONETABLE_HANDLING_" . $i ."', '0', 'Handling fee for this shipping method.', '6', '0', now())");
define('MODULE_SHIPPING_ZONETABLE_HANDLING_' . $i, '0');
}
}
Bookmarks