# --- BEGIN PLUGIN HELP --- For display information visit: http://homeplatewp.com/TextCommerce/article/67/tc_product_display-001 # --- END PLUGIN HELP --- '; echo ''; $step = "update"; //CSS FOR SETTINGS EDIT //================================== echo n.''; //JS //================================== doJS(); echo startTable('edit'). ''.n; //if ($view == 'text') //{ //-- markup help -------------- echo ''. n.''; echo ''.n; //General Settings //======================================== echo "
"; extract($general_settings); echo n.n.'
'; echo hInput('id', $id). eInput('settings'). sInput($step). ''. n."
". n."General Settings"; echo ''. n.''.br. n.'

Email will be used to notify of new orders, low inventory, etc.

'. n.''. n.''.br. n.''. n.''.br. n.''. n.''.br. n.''. n.''.br. n.''. n.build_list("store_country", "countries", "id", "name", $store_country,"1", false, "order by name asc"). n.'
'; if($unit_system == "metric"){ $metric_selected = 'selected="true"'; }else{ $imperial_selected = 'selected="true"'; } echo "
". n."Standards & Formats". n.''. n.''. n.''. n.build_list("store_currency", "currencies", "currency_code", "currency_name", $store_currency,"1").br; echo n.'
'; if($hide_inventory_when_depleted == 1){ $inventory_hide_selected = "selected='true'"; }else{ $inventory_show_selected = "selected='true'"; $display_message = "display:block;"; } if(isset($inventory_management_on) && $inventory_management_on == 1){ $inventory_management_on_checked="checked='checked'"; } echo "
". n."Inventory Settings". n.'

These options only apply to products with inventory management turned on

'. n.''. n.''.br. n.'
'. n.''. n.'
'.br. n.''. n.'

Send low inventory warning to store owner

'.br; echo n.'
'. n.'
'; //-- publish button -------------- echo (has_privs('article.publish')) ? fInput('submit','publish',gTxt('update'),"publish", '', '', '', 4) : fInput('submit','publish',gTxt('update'),"publish", '', '', '', 4); echo n.'
'; //Shipping Zones //======================================== echo "'; //Shipping Rates //======================================== echo "'; //Notices Management //======================================== echo "'; if(isset($show_panel)){ if($show_panel == "zones"){ echo ''; }else if($show_panel == "rates"){ echo ''; }else if($show_panel == "notices"){ echo ''; } } echo ''; echo ''; } //--- end settings function settings_update($event, $step){ global $txp_user, $vars, $txpcfg, $prefs; extract(doSlash($_REQUEST)); if($settings_update == "general"){ if(!isset($inventory_management_on)){ $inventory_management_on = 0; } if(!isset($send_low_inventory_email_notification)){ $send_low_inventory_email_notification = 0; } $storeSettingExist = safe_count("store_settings", "1"); //do we even have any store settings? if($storeSettingExist > 0){ $return = safe_update("store_settings", "inventory_management_on = $inventory_management_on, hide_inventory_when_depleted = $hide_inventory_when_depleted, depleted_inventory_message = '$depleted_inventory_message', send_low_inventory_email_notification = $send_low_inventory_email_notification, store_address = '$store_address', store_city = '$store_city', store_state = '$store_state', store_zip = '$store_zip', store_country = '$store_country', owner_email = '$owner_email', unit_system = '$unit_system', store_currency = '$store_currency'", "1"); }else{ $return = safe_insert("store_settings", "inventory_management_on = $inventory_management_on, hide_inventory_when_depleted = $hide_inventory_when_depleted, depleted_inventory_message = '$depleted_inventory_message', send_low_inventory_email_notification = $send_low_inventory_email_notification, store_address = '$store_address', store_city = '$store_city', store_state = '$store_state', store_zip = '$store_zip', store_country = '$store_country', owner_email = '$owner_email', unit_system = '$unit_system', store_currency = '$store_currency'"); } if(!$return){ echo mysql_error(); }else{ settings_edit($event, $step, $message='General settings updated'); } }else if($settings_update == "add_zone"){ $country = safe_row("name", "countries", "id=$country_id"); $country = $country['name']; if(!isset($shipping_rate_id)){ $shipping_rate_id = 'NULL'; } $return = safe_insert("shipping_zones", "name = '$country', country_id = $country_id, tax_rate = $tax_rate, shipping_rate_id=$shipping_rate_id"); if(!$return){ echo mysql_error(); }else{ settings_edit($event, $step, $message='Shipping region added', "zones"); } }else if($settings_update == "delete_zone"){ $return = safe_delete("shipping_zones", "id=$id"); if(!$return){ echo mysql_error(); }else{ settings_edit($event, $step, $message='Shipping region deleted', "zones"); } }else if($settings_update == "update_zone"){ $return = safe_update("shipping_zones", "tax_rate = $tax_rate", "id=$id"); if(!$return){ echo mysql_error(); }else{ settings_edit($event, $step, $message='Shipping region updated', "zones"); } }else if($settings_update == "update_zone"){ $return = safe_update("shipping_zones", "tax_rate = $tax_rate", "id=$id"); if(!$return){ echo mysql_error(); }else{ settings_edit($event, $step, $message='Shipping region updated', "zones"); } }else if($settings_update == "update_rate"){ $return = safe_update("shipping_rates", "title = '$title', rate = $rate, start_weight = $start_weight, end_weight = $end_weight", "id=$shipping_rate_id"); if(!$return){ echo mysql_error(); }else{ settings_edit($event, $step, $message='Shipping rate updated', "rates"); } }else if($settings_update == "add_rate"){ $rate_id = safe_insert("shipping_rates", "title = '$title', rate = $rate, start_weight = $start_weight, end_weight = $end_weight"); if(!$rate_id){ echo mysql_error(); die(); } $return = safe_insert("zones_rates", "shipping_rate_id = $rate_id, shipping_zone_id = $id"); if(!$return){ echo mysql_error(); }else{ settings_edit($event, $step, $message='Shipping rate added', "rates"); } }else if($settings_update == "delete_rate"){ $result = safe_delete("shipping_rates", "id=$shipping_rate_id"); if(!$result){ echo mysql_error(); die(); } $result = safe_delete("zones_rates", "shipping_rate_id = $shipping_rate_id AND shipping_zone_id = $id"); if(!$result){ echo mysql_error(); }else{ settings_edit($event, $step, $message='Shipping rate deleted', "rates"); } }else if($settings_update == "notices"){ $result = $return = safe_update("store_settings", "order_confirmation_form = '$order_confirmation_form', new_order_notification_form = '$new_order_notification_form'", "1"); if(!$result){ echo mysql_error(); }else{ settings_edit($event, $step, $message='Notices updated', "notices"); } } } ?>