| @@ -1,1849 +1,1352 @@ | ||
| 1 | -<?php | |
| 2 | -$status = $this->action_status; | |
| 3 | -$message = $this->action_message; | |
| 4 | -$this->action_status = 'none'; | |
| 5 | -$this->action_message = ''; | |
| 6 | -$delivery_method = isset($this->options['delivery_method']) ? $this->options['delivery_method'] : array(); | |
| 7 | -$shipping_charge = isset($this->options['shipping_charge']) ? $this->options['shipping_charge'] : array(); | |
| 8 | -// $prefs = get_option('usces_pref'); | |
| 9 | -//20110317ysk start | |
| 10 | - //$prefs = $this->options['province']; | |
| 11 | -//array_shift($prefs); | |
| 12 | -//global $usces_states; | |
| 13 | -$target_market = ( isset($this->options['system']['target_market']) && !empty($this->options['system']['target_market']) ) ? $this->options['system']['target_market'] : usces_get_local_target_market(); | |
| 14 | -foreach((array)$target_market as $tm) { | |
| 15 | -//20110331ysk start | |
| 16 | - //$prefs[$tm] = $usces_states[$tm]; | |
| 17 | - $prefs[$tm] = get_usces_states($tm); | |
| 18 | -//20110331ysk end | |
| 19 | - array_shift($prefs[$tm]); | |
| 20 | -} | |
| 21 | -//20110317ysk end | |
| 22 | -//20101208ysk start | |
| 23 | -$delivery_time_limit['hour'] = isset($this->options['delivery_time_limit']['hour']) ? $this->options['delivery_time_limit']['hour'] : '00'; | |
| 24 | -$delivery_time_limit['min'] = isset($this->options['delivery_time_limit']['min']) ? $this->options['delivery_time_limit']['min'] : '00'; | |
| 25 | -$shortest_delivery_time = isset($this->options['shortest_delivery_time']) ? $this->options['shortest_delivery_time'] : '0'; | |
| 26 | -$delivery_after_days = (empty($this->options['delivery_after_days'])) ? 15 : (int)$this->options['delivery_after_days']; | |
| 27 | -$delivery_days = isset($this->options['delivery_days']) ? $this->options['delivery_days'] : array(); | |
| 28 | -//20101208ysk end | |
| 29 | -//20110317ysk start | |
| 30 | -$base_country = $this->options['system']['base_country']; | |
| 31 | -//20110317ysk end | |
| 32 | -?> | |
| 33 | -<script type="text/javascript"> | |
| 34 | -jQuery(function($){ | |
| 35 | -<?php if($status == 'success'){ ?> | |
| 36 | - $("#anibox").animate({ backgroundColor: "#ECFFFF" }, 2000); | |
| 37 | -<?php }else if($status == 'caution'){ ?> | |
| 38 | - $("#anibox").animate({ backgroundColor: "#FFF5CE" }, 2000); | |
| 39 | -<?php }else if($status == 'error'){ ?> | |
| 40 | - $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000); | |
| 41 | -<?php } ?> | |
| 42 | - | |
| 43 | - $(".charge_text").bind("change", function(){ usces_check_money($(this)); }); | |
| 44 | - $(".days_text").bind("change", function(){ usces_check_num($(this)); }); | |
| 45 | - | |
| 46 | -//20110317ysk start | |
| 47 | -//20120710ysk start 0000472 | |
| 48 | -<?php | |
| 49 | - //$target_market_arr = ''; | |
| 50 | - //foreach((array)$target_market as $tm) $target_market_arr .= "'".$tm."',"; | |
| 51 | - //$target_market_arr = rtrim($target_market_arr, ","); | |
| 52 | - if(!array_key_exists($base_country, (array)$target_market)) $base_country = $target_market[0];//20110509ysk | |
| 53 | - $i = 0; | |
| 54 | -?> | |
| 55 | - var target_market = []; | |
| 56 | -<?php foreach( (array)$target_market as $tm ) : ?> | |
| 57 | - target_market[<?php echo $i; ?>] = "<?php echo $tm; ?>"; | |
| 58 | -<?php $i++; ?> | |
| 59 | -<?php endforeach; ?> | |
| 60 | -//20120710ysk end | |
| 61 | - var base_country = "<?php echo $base_country; ?>"; | |
| 62 | -//20110317ysk end | |
| 63 | - | |
| 64 | - var delivery_method = []; | |
| 65 | -<?php for($i=0; $i<count((array)$delivery_method); $i++){ $lines = explode("\n", $delivery_method[$i]['time']); ?> | |
| 66 | - delivery_method[<?php echo $i; ?>] = []; | |
| 67 | - delivery_method[<?php echo $i; ?>]['id'] = <?php echo (int)$delivery_method[$i]['id']; ?>; | |
| 68 | - delivery_method[<?php echo $i; ?>]['name'] = "<?php echo $delivery_method[$i]['name']; ?>"; | |
| 69 | - delivery_method[<?php echo $i; ?>]['charge'] = <?php echo (int)$delivery_method[$i]['charge']; ?>; | |
| 70 | -//20101228ysk start | |
| 71 | - delivery_method[<?php echo $i; ?>]['days'] = <?php echo (int)$delivery_method[$i]['days']; ?>; | |
| 72 | -//20101228ysk end | |
| 73 | - sttr = ''; | |
| 74 | - <?php foreach((array)$lines as $line){ if(trim($line) != ''){ ?> | |
| 75 | - sttr += "<?php echo trim($line); ?>\n"; | |
| 76 | - <?php } } ?> | |
| 77 | - delivery_method[<?php echo $i; ?>]['time'] = sttr; | |
| 78 | -//20101119ysk start | |
| 79 | - delivery_method[<?php echo $i; ?>]['nocod'] = "<?php echo $delivery_method[$i]['nocod']; ?>"; | |
| 80 | -//20101119ysk end | |
| 81 | -//20110317ysk start | |
| 82 | -//20110422ysk start | |
| 83 | - delivery_method[<?php echo $i; ?>]['intl'] = "<?php echo (!empty($delivery_method[$i]['intl'])) ? $delivery_method[$i]['intl'] : '0'; ?>"; | |
| 84 | -//20110422ysk end | |
| 85 | -//20110317ysk end | |
| 86 | -<?php } ?> | |
| 87 | - | |
| 88 | -//20110317ysk start | |
| 89 | - var pref = []; | |
| 90 | -<?php //foreach((array)$prefs as $pref){ ?> | |
| 91 | -<?php //} ?> | |
| 92 | -<?php foreach((array)$target_market as $tm){ ?> | |
| 93 | - pref["<?php echo $tm; ?>"] = []; | |
| 94 | -<?php foreach((array)$prefs[$tm] as $pref){ ?> | |
| 95 | - pref["<?php echo $tm; ?>"].push("<?php echo $pref; ?>"); | |
| 96 | -<?php }} ?> | |
| 97 | -//20110317ysk end | |
| 98 | - var shipping_charge = []; | |
| 99 | -<?php for($i=0; $i<count((array)$shipping_charge); $i++){ ?> | |
| 100 | - shipping_charge[<?php echo $i; ?>] = []; | |
| 101 | - shipping_charge[<?php echo $i; ?>]["id"] = <?php echo (int)$shipping_charge[$i]['id']; ?>; | |
| 102 | - shipping_charge[<?php echo $i; ?>]["name"] = "<?php echo $shipping_charge[$i]['name']; ?>"; | |
| 103 | -//20120710ysk start 0000472 | |
| 104 | -<?php foreach((array)$target_market as $tm) { ?> | |
| 105 | - shipping_charge[<?php echo $i; ?>]["<?php echo $tm; ?>"] = []; | |
| 106 | -//20110317ysk start | |
| 107 | -<?php //$country = (empty($shipping_charge[$i]['country'])) ? $base_country : $shipping_charge[$i]['country']; ?> | |
| 108 | - <?php //foreach((array)$prefs as $pref){ ?> | |
| 109 | - <?php //foreach((array)$prefs[$country] as $pref){ ?> | |
| 110 | - <?php foreach( (array)$prefs[$tm] as $pref ) { ?> | |
| 111 | -//20110317ysk end | |
| 112 | - <?php if( isset($shipping_charge[$i][$tm][$pref]) ) : ?> | |
| 113 | - shipping_charge[<?php echo $i; ?>]["<?php echo $tm; ?>"]["<?php echo $pref; ?>"] = "<?php echo (float)$shipping_charge[$i][$tm][$pref]; ?>"; | |
| 114 | - <?php else : ?> | |
| 115 | - shipping_charge[<?php echo $i; ?>]["<?php echo $tm; ?>"]["<?php echo $pref; ?>"] = "0"; | |
| 116 | - <?php endif; ?> | |
| 117 | -<?php //}} ?> | |
| 118 | -<?php }}} ?> | |
| 119 | -//20120710ysk end | |
| 120 | - | |
| 121 | -//20101208ysk start | |
| 122 | - var delivery_days = []; | |
| 123 | -<?php for($i=0; $i<count((array)$delivery_days); $i++){ ?> | |
| 124 | - delivery_days[<?php echo $i; ?>] = []; | |
| 125 | - delivery_days[<?php echo $i; ?>]["id"] = <?php echo (int)$delivery_days[$i]['id']; ?>; | |
| 126 | - delivery_days[<?php echo $i; ?>]["name"] = "<?php echo $delivery_days[$i]['name']; ?>"; | |
| 127 | -//20120710ysk start 0000472 | |
| 128 | -<?php foreach((array)$target_market as $tm) { ?> | |
| 129 | - delivery_days[<?php echo $i; ?>]["<?php echo $tm; ?>"] = []; | |
| 130 | -//20110317ysk start | |
| 131 | -<?php //$country = (empty($delivery_days[$i]['country'])) ? $base_country : $delivery_days[$i]['country']; ?> | |
| 132 | - <?php //foreach((array)$prefs as $pref){ ?> | |
| 133 | - <?php //foreach((array)$prefs[$country] as $pref){ ?> | |
| 134 | - <?php foreach( (array)$prefs[$tm] as $pref ) { ?> | |
| 135 | -//20110317ysk end | |
| 136 | - <?php if( isset($delivery_days[$i][$tm][$pref]) ) : ?> | |
| 137 | - delivery_days[<?php echo $i; ?>]["<?php echo $tm; ?>"]["<?php echo $pref; ?>"] = "<?php echo (int)$delivery_days[$i][$tm][$pref]; ?>"; | |
| 138 | - <?php else : ?> | |
| 139 | - delivery_days[<?php echo $i; ?>]["<?php echo $tm; ?>"]["<?php echo $pref; ?>"] = "0"; | |
| 140 | - <?php endif; ?> | |
| 141 | -<?php //}} ?> | |
| 142 | -<?php }}} ?> | |
| 143 | -//20120710ysk end | |
| 144 | -//20101208ysk end | |
| 145 | - | |
| 146 | - var selected_method = 0; | |
| 147 | - function get_delivery_method_charge(selected){ | |
| 148 | - var index = 0; | |
| 149 | - for(var i=0; i<delivery_method.length; i++){ | |
| 150 | - if(selected === delivery_method[i]['id']){ | |
| 151 | - index = i; | |
| 152 | - } | |
| 153 | - } | |
| 154 | - if(undefined === delivery_method[index]){ | |
| 155 | - return -1; | |
| 156 | - }else{ | |
| 157 | - return delivery_method[index]['charge']; | |
| 158 | - } | |
| 159 | - } | |
| 160 | - | |
| 161 | - $("#delivery_method_charge").click(function () { | |
| 162 | - if(shipping_charge.length == 0){ | |
| 163 | - alert('<?php _e('Please set the shipping price', 'usces'); ?>'); | |
| 164 | - } | |
| 165 | - }); | |
| 166 | - | |
| 167 | -//20101208ysk start | |
| 168 | - function get_delivery_method_days(selected){ | |
| 169 | - var index = 0; | |
| 170 | - for(var i=0; i<delivery_method.length; i++){ | |
| 171 | - if(selected === delivery_method[i]['id']){ | |
| 172 | - index = i; | |
| 173 | - } | |
| 174 | - } | |
| 175 | - if(undefined === delivery_method[index]){ | |
| 176 | - return -1; | |
| 177 | - }else{ | |
| 178 | - return delivery_method[index]['days']; | |
| 179 | - } | |
| 180 | - } | |
| 181 | - | |
| 182 | - $("#delivery_method_days").click(function () { | |
| 183 | - if(delivery_days.length == 0){ | |
| 184 | - alert('<?php _e('Please set the delivery days', 'usces'); ?>'); | |
| 185 | - } | |
| 186 | - }); | |
| 187 | -//20101208ysk end | |
| 188 | - | |
| 189 | - $("#new_delivery_method_action").click(function () { | |
| 190 | - if(delivery_method.length === 0) return false; | |
| 191 | - $("#delivery_method_name").html('<input name="delivery_method_name" type="text" value="" />'); | |
| 192 | - $("#delivery_method_name2").html(''); | |
| 193 | - $("#delivery_method_time").val(''); | |
| 194 | - $("#delivery_method_button").html('<input name="cancel_delivery_method" id="cancel_delivery_method" type="button" value="<?php _e('Cancel', 'usces'); ?>" onclick="operation.disp_delivery_method(0);" /><input name="add_delivery_method" id="add_delivery_method" type="button" value="<?php _e('Add', 'usces'); ?>" onclick="operation.add_delivery_method();" />'); | |
| 195 | -//20101119ysk start | |
| 196 | - $("#delivery_method_nocod").html('<input name="delivery_method_nocod" type="checkbox" value="1" />'); | |
| 197 | -//20101119ysk end | |
| 198 | -//20110317ysk start | |
| 199 | - $("#delivery_method_intl").html('<input name="delivery_method_intl" id="delivery_method_intl_0" type="radio" value="0" checked /><label for="delivery_method_intl_0"><?php _e('Domestic Shipment', 'usces'); ?></label> <input name="delivery_method_intl" id="delivery_method_intl_1" type="radio" value="1" /><label for="delivery_method_intl_1"><?php _e('International Shipment', 'usces'); ?></label>'); | |
| 200 | -//20110317ysk end | |
| 201 | - $("input[name='delivery_method_name']").focus().select(); | |
| 202 | - operation.make_delivery_method_charge(-1); | |
| 203 | -//20101208ysk start | |
| 204 | - operation.make_delivery_method_days(-1); | |
| 205 | -//20101208ysk end | |
| 206 | - }); | |
| 207 | - | |
| 208 | - $("#moveup_action").click(function () { | |
| 209 | - var id = $("#delivery_method_name_select option:selected").val()-0; | |
| 210 | - operation.moveup_delivery_method(id); | |
| 211 | - operation.disp_delivery_method(id); | |
| 212 | - }); | |
| 213 | - | |
| 214 | - $("#movedown_action").click(function () { | |
| 215 | - var id = $("#delivery_method_name_select option:selected").val()-0; | |
| 216 | - operation.movedown_delivery_method(id); | |
| 217 | - operation.disp_delivery_method(id); | |
| 218 | - }); | |
| 219 | - | |
| 220 | - $("#new_shipping_charge_action").click(function () { | |
| 221 | - //if(shipping_charge.length === 0) return false; | |
| 222 | - var valuehtml = ''; | |
| 223 | -//20110317ysk start | |
| 224 | - //for(var i=0; i<pref.length; i++){ | |
| 225 | - // valuehtml += "<div class='clearfix'><label class='shipping_charge_label'>" + pref[i] + "</label><input type='text' name='shipping_charge_value[" + pref[i] + "]' value='' class='charge_text' /><?php usces_crcode(); ?></div>\n"; | |
| 226 | - //} | |
| 227 | -//20120710ysk start 0000472 | |
| 228 | - //for(var i=0; i<pref[base_country].length; i++){ | |
| 229 | - // valuehtml += "<div class='clearfix'><label class='shipping_charge_label'>" + pref[base_country][i] + "</label><input type='text' name='shipping_charge_value[" + pref[base_country][i] + "]' value='' class='charge_text' /><?php usces_crcode(); ?></div>\n"; | |
| 230 | - //} | |
| 231 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 232 | - var tm = target_market[j]; | |
| 233 | - valuehtml += "<div id='shipping_charge_"+tm+"'>"; | |
| 234 | - for( var i = 0; i < pref[tm].length; i++ ) { | |
| 235 | - var p = pref[tm][i]; | |
| 236 | - valuehtml += "<div class='clearfix'><label class='shipping_charge_label'>"+p+"</label><input type='text' name=\"shipping_charge_value_"+tm+"["+p+"]\" value='' class='charge_text' /><?php usces_crcode(); ?></div>\n"; | |
| 237 | - } | |
| 238 | - valuehtml += "</div>"; | |
| 239 | - } | |
| 240 | -//20120710ysk end | |
| 241 | - $("#shipping_charge_country").val(base_country); | |
| 242 | -//20110317ysk end | |
| 243 | - $("#shipping_charge_name").html('<input name="shipping_charge_name" type="text" value="" />'); | |
| 244 | - $("#shipping_charge_name2").html(''); | |
| 245 | - $("#shipping_charge_value").html(valuehtml); | |
| 246 | - $("#shipping_charge_button").html('<input name="cancel_shipping_charge" id="cancel_shipping_charge" type="button" value="<?php _e('Cancel', 'usces'); ?>" onclick="operation.disp_shipping_charge(0);" /><input name="add_shipping_charge" id="add_shipping_charge" type="button" value="<?php _e('Add', 'usces'); ?>" onclick="operation.add_shipping_charge();" />'); | |
| 247 | - $("input[name='shipping_charge_name']").focus().select(); | |
| 248 | - $(".charge_text").bind("change", function(){ usces_check_money($(this)); }); | |
| 249 | -//20120710ysk start 0000472 | |
| 250 | - for( var i = 0; i < target_market.length; i++ ) { | |
| 251 | - if( base_country == target_market[i] ) { | |
| 252 | - $("#shipping_charge_"+target_market[i]).css("display",""); | |
| 253 | - } else { | |
| 254 | - $("#shipping_charge_"+target_market[i]).css("display","none"); | |
| 255 | - } | |
| 256 | - } | |
| 257 | -//20120710ysk end | |
| 258 | - }); | |
| 259 | - | |
| 260 | -//20101208ysk start | |
| 261 | - $("#new_delivery_days_action").click(function () { | |
| 262 | - //if(delivery_days.length === 0) return false; | |
| 263 | - var valuehtml = ''; | |
| 264 | -//20110317ysk start | |
| 265 | - //for(var i=0; i<pref.length; i++){ | |
| 266 | - // valuehtml += "<div class='clearfix'><label class='delivery_days_label'>" + pref[i] + "</label><input type='text' name='delivery_days_value[" + pref[i] + "]' value='' class='days_text' /><?php _e('day', 'usces'); ?></div>\n"; | |
| 267 | - //} | |
| 268 | -//20120710ysk start 0000472 | |
| 269 | - //for(var i=0; i<pref[base_country].length; i++){ | |
| 270 | - // valuehtml += "<div class='clearfix'><label class='delivery_days_label'>" + pref[base_country][i] + "</label><input type='text' name='delivery_days_value[" + pref[base_country][i] + "]' value='' class='days_text' /><?php _e('day', 'usces'); ?></div>\n"; | |
| 271 | - //} | |
| 272 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 273 | - var tm = target_market[j]; | |
| 274 | - valuehtml += "<div id='delivery_days_"+tm+"'>"; | |
| 275 | - for( var i = 0; i < pref[tm].length; i++ ) { | |
| 276 | - var p = pref[tm][i]; | |
| 277 | - valuehtml += "<div class='clearfix'><label class='delivery_days_label'>"+p+"</label><input type='text' name=\"delivery_days_value_"+tm+"["+p+"]\" value='' class='days_text' /><?php _e('day', 'usces'); ?></div>\n"; | |
| 278 | - } | |
| 279 | - valuehtml += "</div>"; | |
| 280 | - } | |
| 281 | -//20120710ysk end | |
| 282 | - $("#delivery_days_country").val(base_country); | |
| 283 | -//20110317ysk end | |
| 284 | - $("#delivery_days_name").html('<input name="delivery_days_name" type="text" value="" />'); | |
| 285 | - $("#delivery_days_name2").html(''); | |
| 286 | - $("#delivery_days_value").html(valuehtml); | |
| 287 | - $("#delivery_days_button").html('<input name="cancel_delivery_days" id="cancel_delivery_days" type="button" value="<?php _e('Cancel', 'usces'); ?>" onclick="operation.disp_delivery_days(0);" /><input name="add_delivery_days" id="add_delivery_days" type="button" value="<?php _e('Add', 'usces'); ?>" onclick="operation.add_delivery_days();" />'); | |
| 288 | - $("input[name='delivery_days_name']").focus().select(); | |
| 289 | - $(".days_text").bind("change", function(){ usces_check_num($(this)); }); | |
| 290 | -//20120710ysk start 0000472 | |
| 291 | - for( var i = 0; i < target_market.length; i++ ) { | |
| 292 | - if( base_country == target_market[i] ) { | |
| 293 | - $("#delivery_days_"+target_market[i]).css("display",""); | |
| 294 | - } else { | |
| 295 | - $("#delivery_days_"+target_market[i]).css("display","none"); | |
| 296 | - } | |
| 297 | - } | |
| 298 | -//20120710ysk end | |
| 299 | - }); | |
| 300 | -//20101208ysk end | |
| 301 | - | |
| 302 | - operation = { | |
| 303 | - disp_delivery_method :function (id){ | |
| 304 | - selected_method = id; | |
| 305 | - var index = false; | |
| 306 | - for(var i=0; i<delivery_method.length; i++){ | |
| 307 | - if(id === delivery_method[i]['id']){ | |
| 308 | - index = i; | |
| 309 | - } | |
| 310 | - } | |
| 311 | - if(false === index){ | |
| 312 | - selected = 0; | |
| 313 | - }else{ | |
| 314 | - selected = index; | |
| 315 | - } | |
| 316 | - if(delivery_method.length === 0) { | |
| 317 | - $("#delivery_method_name").html('<input name="delivery_method_name" type="text" value="" />'); | |
| 318 | - $("#delivery_method_name2").html(''); | |
| 319 | - $("#delivery_method_time").val(''); | |
| 320 | - $("#delivery_method_button").html('<input name="add_delivery_method" id="add_delivery_method" type="button" value="<?php _e('Add', 'usces'); ?>" onclick="operation.add_delivery_method();" />'); | |
| 321 | -//20101119ysk start | |
| 322 | - $("#delivery_method_nocod").html('<input name="delivery_method_nocod" type="checkbox" value="1" />'); | |
| 323 | -//20101119ysk end | |
| 324 | -//20110317ysk start | |
| 325 | - $("#delivery_method_intl").html('<input name="delivery_method_intl" id="delivery_method_intl_0" type="radio" value="0" checked /><label for="delivery_method_intl_0"><?php _e('Domestic Shipment', 'usces'); ?></label> <input name="delivery_method_intl" id="delivery_method_intl_1" type="radio" value="1" /><label for="delivery_method_intl_1"><?php _e('International Shipment', 'usces'); ?></label>'); | |
| 326 | -//20110317ysk end | |
| 327 | - operation.make_delivery_method_charge(-1); | |
| 328 | -//20101208ysk start | |
| 329 | - operation.make_delivery_method_days(-1); | |
| 330 | -//20101208ysk end | |
| 331 | - }else{ | |
| 332 | - var name_select = '<select name="delivery_method_name_select" id="delivery_method_name_select" onchange="operation.onchange_delivery_select(this.selectedIndex);">'+"\n"; | |
| 333 | - for(var i=0; i<delivery_method.length; i++){ | |
| 334 | - if(selected === i){ | |
| 335 | - name_select += '<option value="'+delivery_method[i]['id']+'" selected="selected">'+(i)+' : '+delivery_method[i]['name']+'</option>'+"\n"; | |
| 336 | - }else{ | |
| 337 | - name_select += '<option value="'+delivery_method[i]['id']+'">'+(i)+' : '+delivery_method[i]['name']+'</option>'+"\n"; | |
| 338 | - } | |
| 339 | - } | |
| 340 | - name_select += "</select>\n"; | |
| 341 | - $("#delivery_method_name").html(name_select); | |
| 342 | - $("#delivery_method_name2").html('<input name="delivery_method_name" type="text" value="'+delivery_method[selected]['name']+'" />'); | |
| 343 | - $("#delivery_method_time").val(delivery_method[selected]['time']); | |
| 344 | - $("#delivery_method_button").html("<input name='delete_delivery_method' id='delete_delivery_method' type='button' value='<?php _e('Delete', 'usces'); ?>' onclick='operation.delete_delivery_method();' /><input name='update_delivery_method' id='update_delivery_method' type='button' value='<?php _e('update', 'usces'); ?>' onclick='operation.update_delivery_method();' />"); | |
| 345 | -//20110317ysk start | |
| 346 | -//20101119ysk start | |
| 347 | - var checked_nocod = (delivery_method[selected]['nocod'] == '1') ? ' checked' : ''; | |
| 348 | - $("#delivery_method_nocod").html('<input name="delivery_method_nocod" type="checkbox" value="1"'+checked_nocod+' />'); | |
| 349 | -//20101119ysk end | |
| 350 | - var checked_intl_0 = (delivery_method[selected]['intl'] == '0') ? ' checked' : ''; | |
| 351 | - var checked_intl_1 = (delivery_method[selected]['intl'] == '1') ? ' checked' : ''; | |
| 352 | - $("#delivery_method_intl").html('<input name="delivery_method_intl" id="delivery_method_intl_0" type="radio" value="0"'+checked_intl_0+' /><label for="delivery_method_intl_0"><?php _e('Domestic Shipment', 'usces'); ?></label> <input name="delivery_method_intl" id="delivery_method_intl_1" type="radio" value="1"'+checked_intl_1+' /><label for="delivery_method_intl_1"><?php _e('International Shipment', 'usces'); ?></label>'); | |
| 353 | -//20110317ysk end | |
| 354 | - operation.make_delivery_method_charge(get_delivery_method_charge(selected_method)); | |
| 355 | -//20101208ysk start | |
| 356 | - operation.make_delivery_method_days(get_delivery_method_days(selected_method)); | |
| 357 | -//20101208ysk end | |
| 358 | - } | |
| 359 | - }, | |
| 360 | - | |
| 361 | - add_delivery_method : function() { | |
| 362 | - if($("input[name='delivery_method_name']").val() == "") return; | |
| 363 | - | |
| 364 | - $("#delivery_method_loading").html('<img src="<?php echo USCES_PLUGIN_URL; ?>/images/loading-publish.gif" />'); | |
| 365 | - var name = encodeURIComponent($("input[name='delivery_method_name']").val()); | |
| 366 | - var time = encodeURIComponent($("#delivery_method_time").val()); | |
| 367 | - var charge = $("#delivery_method_charge option:selected").val(); | |
| 368 | -//20101208ysk start | |
| 369 | - var days = $("#delivery_method_days option:selected").val(); | |
| 370 | -//20101208ysk end | |
| 371 | -//20101119ysk start | |
| 372 | - var nocod = ($(':input[name=delivery_method_nocod]').attr('checked')) ? '1' : '0'; | |
| 373 | -//20101119ysk end | |
| 374 | -//20110317ysk start | |
| 375 | - var intl = $(':radio[name=delivery_method_intl]:checked').val(); | |
| 376 | -//20110317ysk end | |
| 377 | - | |
| 378 | - var s = operation.settings; | |
| 379 | -//20101208ysk start | |
| 380 | -//20101119ysk start | |
| 381 | -//20110317ysk start | |
| 382 | - //s.data = "action=shop_options_ajax&mode=add_delivery_method&name=" + name + "&charge=" + charge + "&time=" + time; | |
| 383 | - //s.data = "action=shop_options_ajax&mode=add_delivery_method&name=" + name + "&charge=" + charge + "&time=" + time + "&nocod=" + nocod; | |
| 384 | - //s.data = "action=shop_options_ajax&mode=add_delivery_method&name=" + name + "&time=" + time + "&charge=" + charge + "&days=" + days + "&nocod=" + nocod; | |
| 385 | - s.data = "action=shop_options_ajax&mode=add_delivery_method&name=" + name + "&time=" + time + "&charge=" + charge + "&days=" + days + "&nocod=" + nocod + "&intl=" + intl; | |
| 386 | -//20110317ysk end | |
| 387 | -//20101119ysk end | |
| 388 | -//20101208ysk end | |
| 389 | - s.success = function(data, dataType){ | |
| 390 | - var strs = data.split('#usces#'); | |
| 391 | - var id = strs[0] - 0; | |
| 392 | - var name = strs[1]; | |
| 393 | - var time = strs[2]; | |
| 394 | - var charge = strs[3] - 0; | |
| 395 | -//20101208ysk start | |
| 396 | - var days = strs[4] - 0; | |
| 397 | -//20101119ysk start | |
| 398 | - //var nocod = strs[4]; | |
| 399 | - var nocod = strs[5]; | |
| 400 | -//20101119ysk end | |
| 401 | -//20101208ysk end | |
| 402 | -//20110317ysk start | |
| 403 | - var intl = strs[6]; | |
| 404 | -//20110317ysk end | |
| 405 | - var index = delivery_method.length; | |
| 406 | - delivery_method[index] = []; | |
| 407 | - delivery_method[index]['id'] = id; | |
| 408 | - delivery_method[index]['name'] = name; | |
| 409 | - delivery_method[index]['time'] = time; | |
| 410 | - delivery_method[index]['charge'] = charge; | |
| 411 | -//20101208ysk start | |
| 412 | - delivery_method[index]['days'] = days; | |
| 413 | -//20101208ysk end | |
| 414 | -//20101119ysk start | |
| 415 | - delivery_method[index]['nocod'] = nocod; | |
| 416 | -//20101119ysk end | |
| 417 | -//20110317ysk start | |
| 418 | - delivery_method[index]['intl'] = intl; | |
| 419 | -//20110317ysk end | |
| 420 | - operation.disp_delivery_method(id); | |
| 421 | - $("#delivery_method_loading").html(''); | |
| 422 | - }; | |
| 423 | - $.ajax( s ); | |
| 424 | - return false; | |
| 425 | - }, | |
| 426 | - | |
| 427 | - update_delivery_method : function() { | |
| 428 | - if($("input[name='delivery_method_name']").val() == "") return; | |
| 429 | - | |
| 430 | - $("#delivery_method_loading").html('<img src="<?php echo USCES_PLUGIN_URL; ?>/images/loading-publish.gif" />'); | |
| 431 | - var id = $("#delivery_method_name_select option:selected").val(); | |
| 432 | - var name = encodeURIComponent($("input[name='delivery_method_name']").val()); | |
| 433 | - var time = encodeURIComponent($("#delivery_method_time").val()); | |
| 434 | - var charge = $("#delivery_method_charge option:selected").val(); | |
| 435 | -//20101208ysk start | |
| 436 | - var days = $("#delivery_method_days option:selected").val(); | |
| 437 | -//20101208ysk end | |
| 438 | -//20101119ysk start | |
| 439 | - var nocod = ($(':input[name=delivery_method_nocod]').attr('checked')) ? '1' : '0'; | |
| 440 | -//20101119ysk end | |
| 441 | -//20110317ysk start | |
| 442 | - var intl = $(':radio[name=delivery_method_intl]:checked').val(); | |
| 443 | -//20110317ysk end | |
| 444 | - | |
| 445 | - var s = operation.settings; | |
| 446 | -//20101208ysk start | |
| 447 | -//20101119ysk start | |
| 448 | -//20110317ysk start | |
| 449 | - //s.data = "action=shop_options_ajax&mode=update_delivery_method&name=" + name + "&id=" + id + "&time=" + time + "&charge=" + charge; | |
| 450 | - //s.data = "action=shop_options_ajax&mode=update_delivery_method&name=" + name + "&id=" + id + "&time=" + time + "&charge=" + charge + "&nocod=" + nocod; | |
| 451 | - //s.data = "action=shop_options_ajax&mode=update_delivery_method&name=" + name + "&id=" + id + "&time=" + time + "&charge=" + charge + "&days=" + days + "&nocod=" + nocod; | |
| 452 | - s.data = "action=shop_options_ajax&mode=update_delivery_method&name=" + name + "&id=" + id + "&time=" + time + "&charge=" + charge + "&days=" + days + "&nocod=" + nocod + "&intl=" + intl; | |
| 453 | -//20110317ysk end | |
| 454 | -//20101119ysk end | |
| 455 | -//20101208ysk end | |
| 456 | - s.success = function(data, dataType){ | |
| 457 | - var strs = data.split('#usces#'); | |
| 458 | - var id = strs[0] - 0; | |
| 459 | - var name = strs[1]; | |
| 460 | - var time = strs[2]; | |
| 461 | - var charge = strs[3]-0; | |
| 462 | -//20101208ysk start | |
| 463 | - var days = strs[4] - 0; | |
| 464 | -//20101119ysk start | |
| 465 | - //var nocod = strs[4]; | |
| 466 | - var nocod = strs[5]; | |
| 467 | -//20101119ysk end | |
| 468 | -//20101208ysk end | |
| 469 | -//20110317ysk start | |
| 470 | - var intl = strs[6]; | |
| 471 | -//20110317ysk end | |
| 472 | - for(var i=0; i<delivery_method.length; i++){ | |
| 473 | - if(id === delivery_method[i]['id']){ | |
| 474 | - index = i; | |
| 475 | - } | |
| 476 | - } | |
| 477 | - delivery_method[index]['name'] = name; | |
| 478 | - delivery_method[index]['time'] = time; | |
| 479 | - delivery_method[index]['charge'] = charge; | |
| 480 | -//20101208ysk start | |
| 481 | - delivery_method[index]['days'] = days; | |
| 482 | -//20101208ysk end | |
| 483 | -//20101119ysk start | |
| 484 | - delivery_method[index]['nocod'] = nocod; | |
| 485 | -//20101119ysk end | |
| 486 | -//20110317ysk start | |
| 487 | - delivery_method[index]['intl'] = intl; | |
| 488 | -//20110317ysk end | |
| 489 | - operation.disp_delivery_method(id); | |
| 490 | - $("#delivery_method_loading").html(''); | |
| 491 | - }; | |
| 492 | - $.ajax( s ); | |
| 493 | - return false; | |
| 494 | - }, | |
| 495 | - | |
| 496 | - delete_delivery_method : function() { | |
| 497 | - var delname = $("#delivery_method_name_select option:selected").html(); | |
| 498 | - if(!confirm(<?php _e("'Are you sure of deleting the delivery method ' + delname + ' ?'", 'usces'); ?>)) return false; | |
| 499 | - | |
| 500 | - $("#delivery_method_loading").html('<img src="<?php echo USCES_PLUGIN_URL; ?>/images/loading-publish.gif" />'); | |
| 501 | - var id = $("#delivery_method_name_select option:selected").val(); | |
| 502 | - | |
| 503 | - var s = operation.settings; | |
| 504 | - s.data = "action=shop_options_ajax&mode=delete_delivery_method&id=" + id; | |
| 505 | - s.success = function(data, dataType){ | |
| 506 | - var strs = data.split('#usces#'); | |
| 507 | - var id = strs[0] - 0; | |
| 508 | - for(var i=0; i<delivery_method.length; i++){ | |
| 509 | - if(id === delivery_method[i]['id']){ | |
| 510 | - index = i; | |
| 511 | - } | |
| 512 | - } | |
| 513 | - delivery_method.splice(index, 1); | |
| 514 | - //operation.disp_delivery_method(delivery_method[0]['id']); | |
| 515 | - operation.disp_delivery_method(0); | |
| 516 | - $("#delivery_method_loading").html(''); | |
| 517 | - }; | |
| 518 | - $.ajax( s ); | |
| 519 | - return false; | |
| 520 | - }, | |
| 521 | - | |
| 522 | - onchange_delivery_select : function(index) { | |
| 523 | - var id = $("#delivery_method_name_select option:eq("+index+")").val()-0; | |
| 524 | - operation.disp_delivery_method(id); | |
| 525 | - }, | |
| 526 | - | |
| 527 | - make_delivery_method_charge : function(selected) { | |
| 528 | - var option = '<select name="delivery_method_charge" id="delivery_method_charge">'+"\n"; | |
| 529 | - if(selected === -1){ | |
| 530 | - option += '<option value="-1" selected="selected"><?php _e('Not fixing shipping.', 'usces'); ?></option>'+"\n"; | |
| 531 | - }else{ | |
| 532 | - option += '<option value="-1"><?php _e('Not fixing shipping.', 'usces'); ?></option>'+"\n"; | |
| 533 | - } | |
| 534 | - for(var i=0; i<shipping_charge.length; i++){ | |
| 535 | - if(selected === shipping_charge[i]['id']){ | |
| 536 | - option += '<option value="'+shipping_charge[i]['id']+'" selected="selected">'+shipping_charge[i]['name']+'</option>'+"\n"; | |
| 537 | - }else{ | |
| 538 | - option += '<option value="'+shipping_charge[i]['id']+'">'+shipping_charge[i]['name']+'</option>'+"\n"; | |
| 539 | - } | |
| 540 | - } | |
| 541 | - option += '</select>'; | |
| 542 | - $("#delivery_method_charge_td").html(option); | |
| 543 | - }, | |
| 544 | -//20101208ysk start | |
| 545 | - make_delivery_method_days : function(selected) { | |
| 546 | - var option = '<select name="delivery_method_days" id="delivery_method_days">'+"\n"; | |
| 547 | - if(selected === -1){ | |
| 548 | - option += '<option value="-1" selected="selected"><?php _e('Delivery Date Not Specified', 'usces'); ?></option>'+"\n"; | |
| 549 | - }else{ | |
| 550 | - option += '<option value="-1"><?php _e('Delivery Date Not Specified', 'usces'); ?></option>'+"\n"; | |
| 551 | - } | |
| 552 | - for(var i=0; i<delivery_days.length; i++){ | |
| 553 | - if(selected === delivery_days[i]['id']){ | |
| 554 | - option += '<option value="'+delivery_days[i]['id']+'" selected="selected">'+delivery_days[i]['name']+'</option>'+"\n"; | |
| 555 | - }else{ | |
| 556 | - option += '<option value="'+delivery_days[i]['id']+'">'+delivery_days[i]['name']+'</option>'+"\n"; | |
| 557 | - } | |
| 558 | - } | |
| 559 | - option += '</select>'; | |
| 560 | - $("#delivery_method_days_td").html(option); | |
| 561 | - }, | |
| 562 | -//20101208ysk end | |
| 563 | - | |
| 564 | - moveup_delivery_method : function(selected) { | |
| 565 | - var index = 0; | |
| 566 | - for(var i=0; i<delivery_method.length; i++){ | |
| 567 | - if(selected === delivery_method[i]['id']){ | |
| 568 | - index = i; | |
| 569 | - } | |
| 570 | - } | |
| 571 | - if( 0 === index ) return; | |
| 572 | - | |
| 573 | - $("#delivery_method_loading").html('<img src="<?php echo USCES_PLUGIN_URL; ?>/images/loading-publish.gif" />'); | |
| 574 | - | |
| 575 | - var s = operation.settings; | |
| 576 | - s.data = "action=shop_options_ajax&mode=moveup_delivery_method&id=" + selected; | |
| 577 | - s.success = function(data, dataType){ | |
| 578 | - var strs = data.split('#usces#'); | |
| 579 | - var id = strs[0].split(','); | |
| 580 | - var name = strs[1].split(','); | |
| 581 | - var time = strs[2].split(','); | |
| 582 | - var charge = strs[3].split(','); | |
| 583 | -//20101208ysk start | |
| 584 | - var days = strs[4].split(','); | |
| 585 | -//20101119ysk start | |
| 586 | - //var nocod = strs[4].split(','); | |
| 587 | - ////var selected = strs[4]-0; | |
| 588 | - //var selected = strs[5]-0; | |
| 589 | - var nocod = strs[5].split(','); | |
| 590 | -//20110317ysk start | |
| 591 | - var intl = strs[6].split(','); | |
| 592 | - //var selected = strs[6]-0; | |
| 593 | - var selected = strs[7]-0; | |
| 594 | -//20110317ysk end | |
| 595 | -//20101119ysk end | |
| 596 | -//20101208ysk end | |
| 597 | - var ct = delivery_method.length; | |
| 598 | - for(var i=0; i<ct; i++){ | |
| 599 | - delivery_method[i]['id'] = id[i]-0; | |
| 600 | - delivery_method[i]['name'] = name[i]; | |
| 601 | - delivery_method[i]['time'] = time[i]; | |
| 602 | - delivery_method[i]['charge'] = charge[i]-0; | |
| 603 | -//20101208ysk start | |
| 604 | - delivery_method[i]['days'] = days[i]-0; | |
| 605 | -//20101208ysk end | |
| 606 | -//20101119ysk start | |
| 607 | - delivery_method[i]['nocod'] = nocod[i]; | |
| 608 | -//20101119ysk end | |
| 609 | -//20110317ysk start | |
| 610 | - delivery_method[i]['intl'] = intl[i]; | |
| 611 | -//20110317ysk end | |
| 612 | - } | |
| 613 | - operation.disp_delivery_method(selected); | |
| 614 | - $("#delivery_method_loading").html(''); | |
| 615 | - }; | |
| 616 | - $.ajax( s ); | |
| 617 | - return false; | |
| 618 | - }, | |
| 619 | - | |
| 620 | - movedown_delivery_method : function(selected) { | |
| 621 | - var index = 0; | |
| 622 | - var ct = delivery_method.length; | |
| 623 | - for(var i=0; i<ct; i++){ | |
| 624 | - if(selected === delivery_method[i]['id']){ | |
| 625 | - index = i; | |
| 626 | - } | |
| 627 | - } | |
| 628 | - if( index >= ct-1 ) return; | |
| 629 | - | |
| 630 | - $("#delivery_method_loading").html('<img src="<?php echo USCES_PLUGIN_URL; ?>/images/loading-publish.gif" />'); | |
| 631 | - | |
| 632 | - var s = operation.settings; | |
| 633 | - s.data = "action=shop_options_ajax&mode=movedown_delivery_method&id=" + selected; | |
| 634 | - s.success = function(data, dataType){ | |
| 635 | - var strs = data.split('#usces#'); | |
| 636 | - var id = strs[0].split(','); | |
| 637 | - var name = strs[1].split(','); | |
| 638 | - var time = strs[2].split(','); | |
| 639 | - var charge = strs[3].split(','); | |
| 640 | -//20101208ysk start | |
| 641 | - var days = strs[4].split(','); | |
| 642 | -//20101119ysk start | |
| 643 | - //var nocod = strs[4].split(','); | |
| 644 | - ////var selected = strs[4]-0; | |
| 645 | - //var selected = strs[5]-0; | |
| 646 | - var nocod = strs[5].split(','); | |
| 647 | -//20110317ysk start | |
| 648 | - var intl = strs[6].split(','); | |
| 649 | - //var selected = strs[6]-0; | |
| 650 | - var selected = strs[7]-0; | |
| 651 | -//20110317ysk end | |
| 652 | -//20101119ysk end | |
| 653 | -//20101208ysk end | |
| 654 | - var ct = delivery_method.length; | |
| 655 | - for(var i=0; i<ct; i++){ | |
| 656 | - delivery_method[i]['id'] = id[i]-0; | |
| 657 | - delivery_method[i]['name'] = name[i]; | |
| 658 | - delivery_method[i]['time'] = time[i]; | |
| 659 | - delivery_method[i]['charge'] = charge[i]-0; | |
| 660 | -//20101208ysk start | |
| 661 | - delivery_method[i]['days'] = days[i]-0; | |
| 662 | -//20101208ysk end | |
| 663 | -//20101119ysk start | |
| 664 | - delivery_method[i]['nocod'] = nocod[i]; | |
| 665 | -//20101119ysk end | |
| 666 | -//20110317ysk start | |
| 667 | - delivery_method[i]['intl'] = intl[i]; | |
| 668 | -//20110317ysk end | |
| 669 | - } | |
| 670 | - operation.disp_delivery_method(selected); | |
| 671 | - $("#delivery_method_loading").html(''); | |
| 672 | - }; | |
| 673 | - $.ajax( s ); | |
| 674 | - return false; | |
| 675 | - }, | |
| 676 | - | |
| 677 | - disp_shipping_charge : function (id){ | |
| 678 | - var valuehtml = ''; | |
| 679 | - if(shipping_charge.length === 0) { | |
| 680 | -//20110317ysk start | |
| 681 | - //for(var i=0; i<pref.length; i++){ | |
| 682 | - // valuehtml += "<div class='clearfix'><label class='shipping_charge_label'>" + pref[i] + "</label><input type='text' name='shipping_charge_value[" + pref[i] + "]' value='' class='charge_text' /><?php usces_crcode(); ?></div>\n"; | |
| 683 | - //} | |
| 684 | -//20120710ysk start 0000472 | |
| 685 | - //for(var i=0; i<pref[base_country].length; i++){ | |
| 686 | - // valuehtml += "<div class='clearfix'><label class='shipping_charge_label'>" + pref[base_country][i] + "</label><input type='text' name='shipping_charge_value[" + pref[base_country][i] + "]' value='' class='charge_text' /><?php usces_crcode(); ?></div>\n"; | |
| 687 | - //} | |
| 688 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 689 | - var tm = target_market[j]; | |
| 690 | - valuehtml += "<div id='shipping_charge_"+tm+"'>"; | |
| 691 | - for( var i = 0; i < pref[tm].length; i++ ) { | |
| 692 | - var p = pref[tm][i]; | |
| 693 | - valuehtml += "<div class='clearfix'><label class='shipping_charge_label'>"+p+"</label><input type='text' name=\"shipping_charge_value_"+tm+"["+p+"]\" value='' class='charge_text' /><?php usces_crcode(); ?></div>\n"; | |
| 694 | - } | |
| 695 | - valuehtml += "</div>"; | |
| 696 | - } | |
| 697 | - //$("#shipping_charge_country").val(base_country); | |
| 698 | -//20120710ysk end | |
| 699 | -//20110317ysk end | |
| 700 | - $("#shipping_charge_name").html('<input name="shipping_charge_name" type="text" value="" />'); | |
| 701 | - $("#shipping_charge_name2").html(''); | |
| 702 | - $("#shipping_charge_value").html(valuehtml); | |
| 703 | - $("#shipping_charge_button").html('<input name="add_shipping_charge" id="add_shipping_charge" type="button" value="<?php _e('Add', 'usces'); ?>" onclick="operation.add_shipping_charge();" />'); | |
| 704 | - }else{ | |
| 705 | - var selected = 0; | |
| 706 | -//20110317ysk start | |
| 707 | - //var country = base_country;//20120710ysk 0000472 | |
| 708 | -//20110317ysk end | |
| 709 | - var name_select = '<select name="shipping_charge_name_select" id="shipping_charge_name_select" onchange="operation.onchange_shipping_charge(this.selectedIndex);">'+"\n"; | |
| 710 | - for(var i=0; i<shipping_charge.length; i++){ | |
| 711 | - if(shipping_charge[i]['id'] === id){ | |
| 712 | - selected = i; | |
| 713 | -//20110317ysk start | |
| 714 | - //country = shipping_charge[i]['country'];//20120710ysk 0000472 | |
| 715 | -//20110317ysk end | |
| 716 | - name_select += '<option value="'+shipping_charge[i]['id']+'" selected="selected">'+shipping_charge[i]['name']+'</option>'+"\n"; | |
| 717 | - }else{ | |
| 718 | - name_select += '<option value="'+shipping_charge[i]['id']+'">'+shipping_charge[i]['name']+'</option>'+"\n"; | |
| 719 | - } | |
| 720 | - } | |
| 721 | - name_select += "</select>\n"; | |
| 722 | -//20110317ysk start | |
| 723 | - var value = ''; | |
| 724 | - //for(var i=0; i<pref.length; i++){ | |
| 725 | - // valuehtml += "<div class='clearfix'><label class='shipping_charge_label'>" + pref[i] + "</label><input type='text' name='shipping_charge_value[" + pref[i] + "]' value='" + shipping_charge[selected]['value'][pref[i]] + "' class='charge_text' /><?php usces_crcode(); ?></div>\n"; | |
| 726 | - //} | |
| 727 | -//20120710ysk start 0000472 | |
| 728 | - //for(var i=0; i<pref[country].length; i++){ | |
| 729 | - // value = (shipping_charge[selected]['value'][pref[country][i]] == undefined) ? '' : shipping_charge[selected]['value'][pref[country][i]]; | |
| 730 | - // valuehtml += "<div class='clearfix'><label class='shipping_charge_label'>" + pref[country][i] + "</label><input type='text' name='shipping_charge_value[" + pref[country][i] + "]' value='" + value + "' class='charge_text' /><?php usces_crcode(); ?></div>\n"; | |
| 731 | - //} | |
| 732 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 733 | - var tm = target_market[j]; | |
| 734 | - valuehtml += "<div id='shipping_charge_"+tm+"'>"; | |
| 735 | - for( var i = 0; i < pref[tm].length; i++ ) { | |
| 736 | - var p = pref[tm][i]; | |
| 737 | - value = ( shipping_charge[selected][tm][p] == undefined ) ? '' : shipping_charge[selected][tm][p]; | |
| 738 | - valuehtml += "<div class='clearfix'><label class='shipping_charge_label'>"+p+"</label><input type='text' name=\"shipping_charge_value_"+tm+"["+p+"]\" value='"+value+"' class='charge_text' /><?php usces_crcode(); ?></div>\n"; | |
| 739 | - } | |
| 740 | - valuehtml += "</div>"; | |
| 741 | - } | |
| 742 | - //$("#shipping_charge_country").val(country); | |
| 743 | -//20120710ysk end | |
| 744 | -//20110317ysk end | |
| 745 | - $("#shipping_charge_name").html(name_select); | |
| 746 | - $("#shipping_charge_name2").html('<input name="shipping_charge_name" type="text" value="'+shipping_charge[selected]['name']+'" />'); | |
| 747 | - $("#shipping_charge_value").html(valuehtml); | |
| 748 | - $("#shipping_charge_button").html("<input name='delete_shipping_charge' id='delete_shipping_charge' type='button' value='<?php _e('Delete', 'usces'); ?>' onclick='operation.delete_shipping_charge();' /><input name='update_shipping_charge' id='update_shipping_charge' type='button' value='<?php _e('update', 'usces'); ?>' onclick='operation.update_shipping_charge();' />"); | |
| 749 | - } | |
| 750 | - $(".charge_text").bind("change", function(){ usces_check_money($(this)); }); | |
| 751 | -//20120710ysk start 0000472 | |
| 752 | - var country = $("#shipping_charge_country option:selected").val(); | |
| 753 | - for( var i = 0; i < target_market.length; i++ ) { | |
| 754 | - if( country == target_market[i] ) { | |
| 755 | - $("#shipping_charge_"+target_market[i]).css("display",""); | |
| 756 | - } else { | |
| 757 | - $("#shipping_charge_"+target_market[i]).css("display","none"); | |
| 758 | - } | |
| 759 | - } | |
| 760 | -//20120710ysk end | |
| 761 | - }, | |
| 762 | - | |
| 763 | - add_shipping_charge : function() { | |
| 764 | - var error = 0; | |
| 765 | - if($("input[name='shipping_charge_name']").val() == "") { | |
| 766 | - error++; | |
| 767 | - $("input[name='shipping_charge_name']").css({'background-color': '#FFA'}).click(function() { | |
| 768 | - $(this).css({'background-color': '#FFF'}); | |
| 769 | - }); | |
| 770 | - } | |
| 771 | -//20120710ysk start 0000472 | |
| 772 | - //var country = $("#shipping_charge_country").val(); | |
| 773 | - //for(var i=0; i<pref[country].length; i++){ | |
| 774 | - // var value = $("input[name='shipping_charge_value\[" + pref[country][i] + "\]']").val(); | |
| 775 | - // if( "" == value || !checkMoney(value) ) { | |
| 776 | - // error++; | |
| 777 | - // $("input[name='shipping_charge_value\[" + pref[country][i] + "\]']").css({'background-color': '#FFA'}).click(function() { | |
| 778 | - // $(this).css({'background-color': '#FFF'}); | |
| 779 | - // }); | |
| 780 | - // } | |
| 781 | - //} | |
| 782 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 783 | - var tm = target_market[j]; | |
| 784 | - for( var i = 0; i < pref[tm].length; i++ ) { | |
| 785 | - var p = pref[tm][i]; | |
| 786 | - var value = $("input[name=\"shipping_charge_value_"+tm+"\["+p+"\]\"]").val(); | |
| 787 | - if( "" == value || !checkMoney(value) ) { | |
| 788 | - error++; | |
| 789 | - $("input[name=\"shipping_charge_value_"+tm+"\["+p+"\]\"]").css({'background-color': '#FFA'}).click(function() { | |
| 790 | - $(this).css({'background-color': '#FFF'}); | |
| 791 | - }); | |
| 792 | - } | |
| 793 | - } | |
| 794 | - } | |
| 795 | -//20120710ysk end | |
| 796 | - if( 0 < error ) { | |
| 797 | - alert("<?php _e("There is incomplete data.","usces"); ?>"); | |
| 798 | - return false; | |
| 799 | - } | |
| 800 | - | |
| 801 | - $("#shipping_charge_loading").html('<img src="<?php echo USCES_PLUGIN_URL; ?>/images/loading-publish.gif" />'); | |
| 802 | - var name = encodeURIComponent($("input[name='shipping_charge_name']").val()); | |
| 803 | - var query = ''; | |
| 804 | -//20110317ysk start | |
| 805 | - //var country = $("#shipping_charge_country").val(); | |
| 806 | - //for(var i=0; i<pref.length; i++){ | |
| 807 | - // query += '&value[]=' + $("input[name='shipping_charge_value\[" + pref[i] + "\]']").val(); | |
| 808 | - //} | |
| 809 | -//20120710ysk start 0000472 | |
| 810 | - //for(var i=0; i<pref[country].length; i++){ | |
| 811 | - // query += '&value[]=' + $("input[name='shipping_charge_value\[" + pref[country][i] + "\]']").val(); | |
| 812 | - //} | |
| 813 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 814 | - var tm = target_market[j]; | |
| 815 | - for( var i = 0; i < pref[tm].length; i++ ) { | |
| 816 | - query += '&value_'+tm+'[]='+$("input[name=\"shipping_charge_value_"+tm+"\["+pref[tm][i]+"\]\"]").val(); | |
| 817 | - } | |
| 818 | - } | |
| 819 | -//20120710ysk end | |
| 820 | -//20110317ysk end | |
| 821 | - | |
| 822 | - var s = operation.settings; | |
| 823 | -//20110317ysk start | |
| 824 | - //s.data = "action=shop_options_ajax&mode=add_shipping_charge&name=" + name + query; | |
| 825 | -//20120710ysk start 0000472 | |
| 826 | - //s.data = "action=shop_options_ajax&mode=add_shipping_charge&name=" + name + "&country=" + country + query; | |
| 827 | - s.data = "action=shop_options_ajax&mode=add_shipping_charge&name="+name+query; | |
| 828 | -//20120710ysk end | |
| 829 | -//20110317ysk end | |
| 830 | - s.success = function(data, dataType){ | |
| 831 | -//20120710ysk start 0000472 | |
| 832 | - //var strs = data.split('#usces#'); | |
| 833 | - //var id = strs[0] - 0; | |
| 834 | - var id = data - 0; | |
| 835 | - //var name = strs[1]; | |
| 836 | -//20110317ysk start | |
| 837 | - //var country = strs[2]; | |
| 838 | - //var value = strs[2].split(','); | |
| 839 | - //var value = strs[3].split(','); | |
| 840 | -//20120710ysk end | |
| 841 | -//20110317ysk end | |
| 842 | - var index = shipping_charge.length; | |
| 843 | - shipping_charge[index] = []; | |
| 844 | - shipping_charge[index]['id'] = id; | |
| 845 | -//20120710ysk start 0000472 | |
| 846 | - //shipping_charge[index]['name'] = name; | |
| 847 | - shipping_charge[index]['name'] = $("input[name='shipping_charge_name']").val(); | |
| 848 | - //shipping_charge[index]['value'] = []; | |
| 849 | -//20110317ysk start | |
| 850 | - //shipping_charge[index]['country'] = country; | |
| 851 | - //for(var i=0; i<pref.length; i++){ | |
| 852 | - // shipping_charge[index]['value'][pref[i]] = value[i]; | |
| 853 | - //} | |
| 854 | - //for(var i=0; i<pref[country].length; i++){ | |
| 855 | - // shipping_charge[index]['value'][pref[country][i]] = value[i]; | |
| 856 | - //} | |
| 857 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 858 | - var tm = target_market[j]; | |
| 859 | - shipping_charge[index][tm] = []; | |
| 860 | - for( var i = 0; i < pref[tm].length; i++ ) { | |
| 861 | - var p = pref[tm][i]; | |
| 862 | - shipping_charge[index][tm][p] = $("input[name=\"shipping_charge_value_"+tm+"\["+p+"\]\"]").val(); | |
| 863 | - } | |
| 864 | - } | |
| 865 | -//20120710ysk end | |
| 866 | -//20110317ysk end | |
| 867 | - operation.disp_shipping_charge(id); | |
| 868 | - operation.make_delivery_method_charge(get_delivery_method_charge(selected_method)); | |
| 869 | - $("#shipping_charge_loading").html(''); | |
| 870 | - | |
| 871 | - }; | |
| 872 | - $.ajax( s ); | |
| 873 | - return false; | |
| 874 | - }, | |
| 875 | - | |
| 876 | - update_shipping_charge : function() { | |
| 877 | - var error = 0; | |
| 878 | - if($("input[name='shipping_charge_name']").val() == "") { | |
| 879 | - error++; | |
| 880 | - $("input[name='shipping_charge_name']").css({'background-color': '#FFA'}).click(function() { | |
| 881 | - $(this).css({'background-color': '#FFF'}); | |
| 882 | - }); | |
| 883 | - } | |
| 884 | -//20120710ysk start 0000472 | |
| 885 | - //var country = $("#shipping_charge_country").val(); | |
| 886 | - //for(var i=0; i<pref[country].length; i++){ | |
| 887 | - // var value = $("input[name='shipping_charge_value\[" + pref[country][i] + "\]']").val(); | |
| 888 | - // if( "" == value || !checkMoney(value) ) { | |
| 889 | - // error++; | |
| 890 | - // $("input[name='shipping_charge_value\[" + pref[country][i] + "\]']").css({'background-color': '#FFA'}).click(function() { | |
| 891 | - // $(this).css({'background-color': '#FFF'}); | |
| 892 | - // }); | |
| 893 | - // } | |
| 894 | - //} | |
| 895 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 896 | - var tm = target_market[j]; | |
| 897 | - for( var i = 0; i < pref[tm].length; i++ ) { | |
| 898 | - var p = pref[tm][i]; | |
| 899 | - var value = $("input[name=\"shipping_charge_value_"+tm+"\["+p+"\]\"]").val(); | |
| 900 | - if( "" == value || !checkMoney(value) ) { | |
| 901 | - error++; | |
| 902 | - $("input[name=\"shipping_charge_value_"+tm+"\["+p+"\]\"]").css({'background-color': '#FFA'}).click(function() { | |
| 903 | - $(this).css({'background-color': '#FFF'}); | |
| 904 | - }); | |
| 905 | - } | |
| 906 | - } | |
| 907 | - } | |
| 908 | -//20120710ysk end | |
| 909 | - if( 0 < error ) { | |
| 910 | - alert("<?php _e("There is incomplete data.","usces"); ?>"); | |
| 911 | - return false; | |
| 912 | - } | |
| 913 | - | |
| 914 | - $("#shipping_charge_loading").html('<img src="<?php echo USCES_PLUGIN_URL; ?>/images/loading-publish.gif" />'); | |
| 915 | - var id = $("#shipping_charge_name_select option:selected").val(); | |
| 916 | - var name = encodeURIComponent($("input[name='shipping_charge_name']").val()); | |
| 917 | - var query = ''; | |
| 918 | -//20110317ysk start | |
| 919 | - //var country = $("#shipping_charge_country").val(); | |
| 920 | - //for(var i=0; i<pref.length; i++){ | |
| 921 | - // query += '&value[]=' + $("input[name='shipping_charge_value\[" + pref[i] + "\]']").val(); | |
| 922 | - //} | |
| 923 | -//20120710ysk start 0000472 | |
| 924 | - //for(var i=0; i<pref[country].length; i++){ | |
| 925 | - // query += '&value[]=' + $("input[name='shipping_charge_value\[" + pref[country][i] + "\]']").val(); | |
| 926 | - //} | |
| 927 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 928 | - var tm = target_market[j]; | |
| 929 | - for( var i = 0; i < pref[tm].length; i++ ){ | |
| 930 | - query += '&value_'+tm+'[]='+$("input[name=\"shipping_charge_value_"+tm+"\["+pref[tm][i]+"\]\"]").val(); | |
| 931 | - } | |
| 932 | - } | |
| 933 | -//20120710ysk end | |
| 934 | -//20110317ysk end | |
| 935 | - var s = operation.settings; | |
| 936 | -//20110317ysk start | |
| 937 | - //s.data = "action=shop_options_ajax&mode=update_shipping_charge&id=" + id + "&name=" + name + query; | |
| 938 | -//20120710ysk start 0000472 | |
| 939 | - //s.data = "action=shop_options_ajax&mode=update_shipping_charge&id=" + id + "&name=" + name + "&country=" + country + query; | |
| 940 | - s.data = "action=shop_options_ajax&mode=update_shipping_charge&id="+id+"&name="+name+query; | |
| 941 | -//20120710ysk end | |
| 942 | -//20110317ysk end | |
| 943 | - s.success = function(data, dataType){ | |
| 944 | -//20120710ysk start 0000472 | |
| 945 | - //var strs = data.split('#usces#'); | |
| 946 | - //var id = strs[0] - 0; | |
| 947 | - var id = data - 0; | |
| 948 | - //var name = strs[1]; | |
| 949 | -//20110317ysk start | |
| 950 | - //var country = strs[2]; | |
| 951 | - //var value = strs[2].split(','); | |
| 952 | - //var value = strs[3].split(','); | |
| 953 | -//20120710ysk end | |
| 954 | -//20110317ysk end | |
| 955 | - for(var i=0; i<shipping_charge.length; i++){ | |
| 956 | - if(id === shipping_charge[i]['id']){ | |
| 957 | - index = i; | |
| 958 | - } | |
| 959 | - } | |
| 960 | -//20120710ysk start 0000472 | |
| 961 | -// shipping_charge[index]['name'] = name; | |
| 962 | - shipping_charge[index]['name'] = $("input[name='shipping_charge_name']").val(); | |
| 963 | -//20110317ysk start | |
| 964 | -// shipping_charge[index]['value'] = []; | |
| 965 | -// shipping_charge[index]['country'] = country; | |
| 966 | -// //for(var i=0; i<pref.length; i++){ | |
| 967 | -// // shipping_charge[index]['value'][pref[i]] = value[i]; | |
| 968 | -// //} | |
| 969 | -// for(var i=0; i<pref[country].length; i++){ | |
| 970 | -// shipping_charge[index]['value'][pref[country][i]] = value[i]; | |
| 971 | -// } | |
| 972 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 973 | - var tm = target_market[j]; | |
| 974 | - for( var i = 0; i < pref[tm].length; i++ ) { | |
| 975 | - var p = pref[tm][i]; | |
| 976 | - shipping_charge[index][tm][p] = $("input[name=\"shipping_charge_value_"+tm+"\["+p+"\]\"]").val(); | |
| 977 | - } | |
| 978 | - } | |
| 979 | -//20120710ysk end | |
| 980 | -//20110317ysk end | |
| 981 | - operation.disp_shipping_charge(id); | |
| 982 | - operation.make_delivery_method_charge(get_delivery_method_charge(selected_method)); | |
| 983 | - $("#shipping_charge_loading").html(''); | |
| 984 | - }; | |
| 985 | - $.ajax( s ); | |
| 986 | - return false; | |
| 987 | - }, | |
| 988 | - | |
| 989 | - delete_shipping_charge : function() { | |
| 990 | - var delname = $("#shipping_charge_name_select option:selected").html(); | |
| 991 | - if(!confirm(<?php _e("'Are you sure of deleting shipping [' + delname + ']?'", 'usces'); ?>)) return false; | |
| 992 | - | |
| 993 | - $("#shipping_charge_loading").html('<img src="<?php echo USCES_PLUGIN_URL; ?>/images/loading-publish.gif" />'); | |
| 994 | - var id = $("#shipping_charge_name_select option:selected").val(); | |
| 995 | - var s = operation.settings; | |
| 996 | - s.data = "action=shop_options_ajax&mode=delete_shipping_charge&id=" + id; | |
| 997 | - s.success = function(data, dataType){ | |
| 998 | - var strs = data.split('#usces#'); | |
| 999 | - var id = strs[0] - 0; | |
| 1000 | - for(var i=0; i<shipping_charge.length; i++){ | |
| 1001 | - if(id === shipping_charge[i]['id']){ | |
| 1002 | - index = i; | |
| 1003 | - } | |
| 1004 | - } | |
| 1005 | - shipping_charge.splice(index, 1); | |
| 1006 | - operation.disp_shipping_charge(0); | |
| 1007 | - operation.make_delivery_method_charge(get_delivery_method_charge(selected_method)); | |
| 1008 | - $("#shipping_charge_loading").html(''); | |
| 1009 | - }; | |
| 1010 | - $.ajax( s ); | |
| 1011 | - return false; | |
| 1012 | - }, | |
| 1013 | - | |
| 1014 | - onchange_shipping_charge : function(index) { | |
| 1015 | - var id = $("#shipping_charge_name_select option:eq("+index+")").val()-0; | |
| 1016 | - operation.disp_shipping_charge(id); | |
| 1017 | - }, | |
| 1018 | - | |
| 1019 | - allCharge : function () { | |
| 1020 | - var charge = $("#allcharge").val(); | |
| 1021 | - if( charge == '' ) return; | |
| 1022 | - if( confirm(<?php echo sprintf(__("'Are you sure of setting shiping to %s' + charge + ' for all the prefecture?'", 'usces'), esc_js(usces_crsymbol('return', 'js'))); ?>) ){ | |
| 1023 | -//20110317ysk start | |
| 1024 | - var country = $("#shipping_charge_country option:selected").val(); | |
| 1025 | - //for(var i=0; i<pref.length; i++){ | |
| 1026 | - // $("input[name='shipping_charge_value\[" + pref[i] + "\]']").val(charge); | |
| 1027 | - //} | |
| 1028 | -//20120710ysk start 0000472 | |
| 1029 | - //for(var i=0; i<pref[country].length; i++){ | |
| 1030 | - // $("input[name='shipping_charge_value\[" + pref[country][i] + "\]']").val(charge); | |
| 1031 | - //} | |
| 1032 | - for( var i = 0; i < pref[country].length; i++ ) { | |
| 1033 | - $("input[name=\"shipping_charge_value_"+country+"\["+pref[country][i]+"\]\"]").val(charge); | |
| 1034 | - } | |
| 1035 | -//20120710ysk end | |
| 1036 | -//20110317ysk end | |
| 1037 | - $("#allcharge").val(""); | |
| 1038 | - } | |
| 1039 | - }, | |
| 1040 | - | |
| 1041 | -//20101208ysk start | |
| 1042 | - disp_delivery_days :function (id){ | |
| 1043 | - var valuehtml = ''; | |
| 1044 | - if(delivery_days.length === 0) { | |
| 1045 | -//20110317ysk start | |
| 1046 | - //for(var i=0; i<pref.length; i++){ | |
| 1047 | - // valuehtml += "<div class='clearfix'><label class='delivery_days_label'>" + pref[i] + "</label><input type='text' name='delivery_days_value[" + pref[i] + "]' value='' class='days_text' /><?php _e('day', 'usces'); ?></div>\n"; | |
| 1048 | - //} | |
| 1049 | -//20120710ysk start 0000472 | |
| 1050 | - //for(var i=0; i<pref[base_country].length; i++){ | |
| 1051 | - // valuehtml += "<div class='clearfix'><label class='delivery_days_label'>" + pref[base_country][i] + "</label><input type='text' name='delivery_days_value[" + pref[base_country][i] + "]' value='' class='days_text' /><?php _e('day', 'usces'); ?></div>\n"; | |
| 1052 | - //} | |
| 1053 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 1054 | - var tm = target_market[j]; | |
| 1055 | - valuehtml += "<div id='delivery_days_"+tm+"'>"; | |
| 1056 | - for( var i = 0; i < pref[tm].length; i++ ) { | |
| 1057 | - var p = pref[tm][i]; | |
| 1058 | - valuehtml += "<div class='clearfix'><label class='delivery_days_label'>"+p+"</label><input type='text' name=\"delivery_days_value_"+tm+"["+p+"]\" value='' class='charge_text' /><?php _e('day', 'usces'); ?></div>\n"; | |
| 1059 | - } | |
| 1060 | - valuehtml += "</div>"; | |
| 1061 | - } | |
| 1062 | - //$("#delivery_days_country").val(base_country); | |
| 1063 | -//20110317ysk end | |
| 1064 | - $("#delivery_days_name").html('<input name="delivery_days_name" type="text" value="" />'); | |
| 1065 | - $("#delivery_days_name2").html(''); | |
| 1066 | - $("#delivery_days_value").html(valuehtml); | |
| 1067 | - $("#delivery_days_button").html('<input name="add_delivery_days" id="add_delivery_days" type="button" value="<?php _e('Add', 'usces'); ?>" onclick="operation.add_delivery_days();" />'); | |
| 1068 | - }else{ | |
| 1069 | - var selected = 0; | |
| 1070 | -//20110317ysk start | |
| 1071 | - //var country = base_country;//20120710ysk 0000472 | |
| 1072 | -//20110317ysk end | |
| 1073 | - var name_select = '<select name="delivery_days_name_select" id="delivery_days_name_select" onchange="operation.onchange_delivery_days(this.selectedIndex);">'+"\n"; | |
| 1074 | - for(var i=0; i<delivery_days.length; i++){ | |
| 1075 | - if(delivery_days[i]['id'] === id){ | |
| 1076 | - selected = i; | |
| 1077 | -//20110317ysk start | |
| 1078 | - //country = delivery_days[i]['country'];//20120710ysk 0000472 | |
| 1079 | -//20110317ysk end | |
| 1080 | - name_select += '<option value="'+delivery_days[i]['id']+'" selected="selected">'+delivery_days[i]['name']+'</option>'+"\n"; | |
| 1081 | - }else{ | |
| 1082 | - name_select += '<option value="'+delivery_days[i]['id']+'">'+delivery_days[i]['name']+'</option>'+"\n"; | |
| 1083 | - } | |
| 1084 | - } | |
| 1085 | - name_select += "</select>\n"; | |
| 1086 | -//20110317ysk start | |
| 1087 | - var value = ''; | |
| 1088 | - //for(var i=0; i<pref.length; i++){ | |
| 1089 | - // valuehtml += "<div class='clearfix'><label class='delivery_days_label'>" + pref[i] + "</label><input type='text' name='delivery_days_value[" + pref[i] + "]' value='" + delivery_days[selected]['value'][pref[i]] + "' class='days_text' /><?php _e('day', 'usces'); ?></div>\n"; | |
| 1090 | - //} | |
| 1091 | -//20120710ysk start 0000472 | |
| 1092 | - //for(var i=0; i<pref[country].length; i++){ | |
| 1093 | - // //value = (delivery_days[selected]['value'][pref[country][i]] == undefined) ? '' : delivery_days[selected]['value'][pref[country][i]]; | |
| 1094 | - // value = (delivery_days[selected] == undefined || delivery_days[selected]['value'][pref[country][i]] == undefined) ? '' : delivery_days[selected]['value'][pref[country][i]]; | |
| 1095 | - // valuehtml += "<div class='clearfix'><label class='delivery_days_label'>" + pref[country][i] + "</label><input type='text' name='delivery_days_value[" + pref[country][i] + "]' value='" + value + "' class='days_text' /><?php _e('day', 'usces'); ?></div>\n"; | |
| 1096 | - //} | |
| 1097 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 1098 | - var tm = target_market[j]; | |
| 1099 | - valuehtml += "<div id='delivery_days_"+tm+"'>"; | |
| 1100 | - for( var i = 0; i < pref[tm].length; i++ ) { | |
| 1101 | - var p = pref[tm][i]; | |
| 1102 | - value = ( delivery_days[selected][tm][p] == undefined ) ? '' : delivery_days[selected][tm][p]; | |
| 1103 | - valuehtml += "<div class='clearfix'><label class='delivery_days_label'>"+p+"</label><input type='text' name=\"delivery_days_value_"+tm+"["+p+"]\" value='"+value+"' class='charge_text' /><?php _e('day', 'usces'); ?></div>\n"; | |
| 1104 | - } | |
| 1105 | - valuehtml += "</div>"; | |
| 1106 | - } | |
| 1107 | - //$("#delivery_days_country").val(country); | |
| 1108 | -//20120710ysk end | |
| 1109 | -//20110317ysk end | |
| 1110 | - $("#delivery_days_name").html(name_select); | |
| 1111 | - $("#delivery_days_name2").html('<input name="delivery_days_name" type="text" value="'+delivery_days[selected]['name']+'" />'); | |
| 1112 | - $("#delivery_days_value").html(valuehtml); | |
| 1113 | - $("#delivery_days_button").html("<input name='delete_delivery_days' id='delete_delivery_days' type='button' value='<?php _e('Delete', 'usces'); ?>' onclick='operation.delete_delivery_days();' /><input name='update_delivery_days' id='update_delivery_days' type='button' value='<?php _e('update', 'usces'); ?>' onclick='operation.update_delivery_days();' />"); | |
| 1114 | - } | |
| 1115 | - $(".days_text").bind("change", function(){ usces_check_num($(this)); }); | |
| 1116 | -//20120710ysk start 0000472 | |
| 1117 | - var country = $("#delivery_days_country option:selected").val(); | |
| 1118 | - for( var i = 0; i < target_market.length; i++ ) { | |
| 1119 | - if( country == target_market[i] ) { | |
| 1120 | - $("#delivery_days_"+target_market[i]).css("display",""); | |
| 1121 | - } else { | |
| 1122 | - $("#delivery_days_"+target_market[i]).css("display","none"); | |
| 1123 | - } | |
| 1124 | - } | |
| 1125 | -//20120710ysk end | |
| 1126 | - }, | |
| 1127 | - | |
| 1128 | - add_delivery_days : function() { | |
| 1129 | - var error = 0; | |
| 1130 | - if($("input[name='delivery_days_name']").val() == "") { | |
| 1131 | - error++; | |
| 1132 | - $("input[name='delivery_days_name']").css({'background-color': '#FFA'}).click(function() { | |
| 1133 | - $(this).css({'background-color': '#FFF'}); | |
| 1134 | - }); | |
| 1135 | - } | |
| 1136 | -//20120710ysk start 0000472 | |
| 1137 | - //var country = $("#delivery_days_country").val(); | |
| 1138 | - //for(var i=0; i<pref[country].length; i++){ | |
| 1139 | - // var value = $("input[name='delivery_days_value\[" + pref[country][i] + "\]']").val(); | |
| 1140 | - // if( "" == value || !checkNum(value) ) { | |
| 1141 | - // error++; | |
| 1142 | - // $("input[name='delivery_days_value\[" + pref[country][i] + "\]']").css({'background-color': '#FFA'}).click(function() { | |
| 1143 | - // $(this).css({'background-color': '#FFF'}); | |
| 1144 | - // }); | |
| 1145 | - // } | |
| 1146 | - //} | |
| 1147 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 1148 | - var tm = target_market[j]; | |
| 1149 | - for( var i = 0; i < pref[tm].length; i++ ) { | |
| 1150 | - var p = pref[tm][i]; | |
| 1151 | - var value = $("input[name=\"delivery_days_value_"+tm+"\["+p+"\]\"]").val(); | |
| 1152 | - if( "" == value || !checkNum(value) ) { | |
| 1153 | - error++; | |
| 1154 | - $("input[name=\"delivery_days_value_"+tm+"\["+p+"\]\"]").css({'background-color': '#FFA'}).click(function() { | |
| 1155 | - $(this).css({'background-color': '#FFF'}); | |
| 1156 | - }); | |
| 1157 | - } | |
| 1158 | - } | |
| 1159 | - } | |
| 1160 | -//20120710ysk end | |
| 1161 | - if( 0 < error ) { | |
| 1162 | - alert("<?php _e("There is incomplete data.","usces"); ?>"); | |
| 1163 | - return false; | |
| 1164 | - } | |
| 1165 | - | |
| 1166 | - $("#delivery_days_loading").html('<img src="<?php echo USCES_PLUGIN_URL; ?>/images/loading-publish.gif" />'); | |
| 1167 | - var name = $("input[name='delivery_days_name']").val(); | |
| 1168 | - var query = ''; | |
| 1169 | -//20110317ysk start | |
| 1170 | - //var country = $("#delivery_days_country").val(); | |
| 1171 | - //for(var i=0; i<pref.length; i++){ | |
| 1172 | - // query += '&value[]=' + $("input[name='delivery_days_value\[" + pref[i] + "\]']").val(); | |
| 1173 | - //} | |
| 1174 | -//20120710ysk start 0000472 | |
| 1175 | - //for(var i=0; i<pref[country].length; i++){ | |
| 1176 | - // query += '&value[]=' + $("input[name='delivery_days_value\[" + pref[country][i] + "\]']").val(); | |
| 1177 | - //} | |
| 1178 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 1179 | - var tm = target_market[j]; | |
| 1180 | - for( var i = 0; i < pref[tm].length; i++ ) { | |
| 1181 | - query += '&value_'+tm+'[]='+$("input[name=\"delivery_days_value_"+tm+"\["+pref[tm][i]+"\]\"]").val(); | |
| 1182 | - } | |
| 1183 | - } | |
| 1184 | -//20120710ysk end | |
| 1185 | -//20110317ysk end | |
| 1186 | - | |
| 1187 | - var s = operation.settings; | |
| 1188 | -//20110317ysk start | |
| 1189 | - //s.data = "action=shop_options_ajax&mode=add_delivery_days&name=" + name + query; | |
| 1190 | -//20120710ysk start 0000472 | |
| 1191 | - //s.data = "action=shop_options_ajax&mode=add_delivery_days&name=" + name + "&country=" + country + query; | |
| 1192 | - s.data = "action=shop_options_ajax&mode=add_delivery_days&name="+name+query; | |
| 1193 | -//20120710ysk end | |
| 1194 | -//20110317ysk end | |
| 1195 | - s.success = function(data, dataType){ | |
| 1196 | -//20120710ysk start 0000472 | |
| 1197 | - //var strs = data.split('#usces#'); | |
| 1198 | - //var id = strs[0] - 0; | |
| 1199 | - var id = data - 0; | |
| 1200 | - //var name = strs[1]; | |
| 1201 | -//20110317ysk start | |
| 1202 | - //var country = strs[2]; | |
| 1203 | - //var value = strs[2].split(','); | |
| 1204 | - //var value = strs[3].split(','); | |
| 1205 | -//20120710ysk end | |
| 1206 | -//20110317ysk end | |
| 1207 | - var index = delivery_days.length; | |
| 1208 | - delivery_days[index] = []; | |
| 1209 | - delivery_days[index]['id'] = id; | |
| 1210 | -//20120710ysk start 0000472 | |
| 1211 | - //delivery_days[index]['name'] = name; | |
| 1212 | - delivery_days[index]['name'] = $("input[name='delivery_days_name']").val(); | |
| 1213 | - //delivery_days[index]['value'] = []; | |
| 1214 | -//20110317ysk start | |
| 1215 | - //delivery_days[index]['country'] = country; | |
| 1216 | - //for(var i=0; i<pref.length; i++){ | |
| 1217 | - // delivery_days[index]['value'][pref[i]] = value[i]; | |
| 1218 | - //} | |
| 1219 | - //for(var i=0; i<pref[country].length; i++){ | |
| 1220 | - // delivery_days[index]['value'][pref[country][i]] = value[i]; | |
| 1221 | - //} | |
| 1222 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 1223 | - var tm = target_market[j]; | |
| 1224 | - delivery_days[index][tm] = []; | |
| 1225 | - for( var i = 0; i < pref[tm].length; i++ ) { | |
| 1226 | - var p = pref[tm][i]; | |
| 1227 | - delivery_days[index][tm][p] = $("input[name=\"delivery_days_value_"+tm+"\["+p+"\]\"]").val(); | |
| 1228 | - } | |
| 1229 | - } | |
| 1230 | -//20120710ysk end | |
| 1231 | -//20110317ysk end | |
| 1232 | - operation.disp_delivery_days(id); | |
| 1233 | - operation.make_delivery_method_days(get_delivery_method_days(selected_method)); | |
| 1234 | - $("#delivery_days_loading").html(''); | |
| 1235 | - | |
| 1236 | - }; | |
| 1237 | - $.ajax( s ); | |
| 1238 | - return false; | |
| 1239 | - }, | |
| 1240 | - | |
| 1241 | - update_delivery_days : function() { | |
| 1242 | - var error = 0; | |
| 1243 | - if($("input[name='delivery_days_name']").val() == "") { | |
| 1244 | - error++; | |
| 1245 | - $("input[name='delivery_days_name']").css({'background-color': '#FFA'}).click(function() { | |
| 1246 | - $(this).css({'background-color': '#FFF'}); | |
| 1247 | - }); | |
| 1248 | - } | |
| 1249 | -//20120710ysk start 0000472 | |
| 1250 | - //var country = $("#delivery_days_country").val(); | |
| 1251 | - //for(var i=0; i<pref[country].length; i++){ | |
| 1252 | - // var value = $("input[name='delivery_days_value\[" + pref[country][i] + "\]']").val(); | |
| 1253 | - // if( "" == value || !checkNum(value) ) { | |
| 1254 | - // error++; | |
| 1255 | - // $("input[name='delivery_days_value\[" + pref[country][i] + "\]']").css({'background-color': '#FFA'}).click(function() { | |
| 1256 | - // $(this).css({'background-color': '#FFF'}); | |
| 1257 | - // }); | |
| 1258 | - // } | |
| 1259 | - //} | |
| 1260 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 1261 | - var tm = target_market[j]; | |
| 1262 | - for( var i = 0; i < pref[tm].length; i++ ) { | |
| 1263 | - var p = pref[tm][i]; | |
| 1264 | - var value = $("input[name=\"delivery_days_value_"+tm+"\["+p+"\]\"]").val(); | |
| 1265 | - if( "" == value || !checkNum(value) ) { | |
| 1266 | - error++; | |
| 1267 | - $("input[name=\"delivery_days_value_"+tm+"\["+p+"\]\"]").css({'background-color': '#FFA'}).click(function() { | |
| 1268 | - $(this).css({'background-color': '#FFF'}); | |
| 1269 | - }); | |
| 1270 | - } | |
| 1271 | - } | |
| 1272 | - } | |
| 1273 | -//20120710ysk end | |
| 1274 | - if( 0 < error ) { | |
| 1275 | - alert("<?php _e("There is incomplete data.","usces"); ?>"); | |
| 1276 | - return false; | |
| 1277 | - } | |
| 1278 | - | |
| 1279 | - $("#delivery_days_loading").html('<img src="<?php echo USCES_PLUGIN_URL; ?>/images/loading-publish.gif" />'); | |
| 1280 | - var id = $("#delivery_days_name_select option:selected").val(); | |
| 1281 | - var name = $("input[name='delivery_days_name']").val(); | |
| 1282 | - var query = ''; | |
| 1283 | -//20110317ysk start | |
| 1284 | -//20120710ysk start 0000472 | |
| 1285 | - //var country = $("#delivery_days_country").val(); | |
| 1286 | - //for(var i=0; i<pref.length; i++){ | |
| 1287 | - // query += '&value[]=' + $("input[name='delivery_days_value\[" + pref[i] + "\]']").val(); | |
| 1288 | - //} | |
| 1289 | - //for(var i=0; i<pref[country].length; i++){ | |
| 1290 | - // query += '&value[]=' + $("input[name='delivery_days_value\[" + pref[country][i] + "\]']").val(); | |
| 1291 | - //} | |
| 1292 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 1293 | - var tm = target_market[j]; | |
| 1294 | - for( var i = 0; i < pref[tm].length; i++ ){ | |
| 1295 | - query += '&value_'+tm+'[]='+$("input[name=\"delivery_days_value_"+tm+"\["+pref[tm][i]+"\]\"]").val(); | |
| 1296 | - } | |
| 1297 | - } | |
| 1298 | -//20120710ysk end | |
| 1299 | -//20110317ysk end | |
| 1300 | - var s = operation.settings; | |
| 1301 | -//20110317ysk start | |
| 1302 | - //s.data = "action=shop_options_ajax&mode=update_delivery_days&id=" + id + "&name=" + name + query; | |
| 1303 | -//20120710ysk start 0000472 | |
| 1304 | - //s.data = "action=shop_options_ajax&mode=update_delivery_days&id=" + id + "&name=" + name + "&country=" + country + query; | |
| 1305 | - s.data = "action=shop_options_ajax&mode=update_delivery_days&id="+id+"&name="+name+query; | |
| 1306 | -//20120710ysk end | |
| 1307 | -//20110317ysk end | |
| 1308 | - s.success = function(data, dataType){ | |
| 1309 | -//20120710ysk start 0000472 | |
| 1310 | - //var strs = data.split('#usces#'); | |
| 1311 | - //var id = strs[0] - 0; | |
| 1312 | - var id = data - 0; | |
| 1313 | - //var name = strs[1]; | |
| 1314 | -//20110317ysk start | |
| 1315 | - //var country = strs[2]; | |
| 1316 | - //var value = strs[2].split(','); | |
| 1317 | - //var value = strs[3].split(','); | |
| 1318 | -//20120710ysk end | |
| 1319 | -//20110317ysk end | |
| 1320 | - for(var i=0; i<delivery_days.length; i++){ | |
| 1321 | - if(id === delivery_days[i]['id']){ | |
| 1322 | - index = i; | |
| 1323 | - } | |
| 1324 | - } | |
| 1325 | -//20120710ysk start 0000472 | |
| 1326 | - //delivery_days[index]['name'] = name; | |
| 1327 | - delivery_days[index]['name'] = $("input[name='delivery_days_name']").val(); | |
| 1328 | -//20110317ysk start | |
| 1329 | - //delivery_days[index]['value'] = []; | |
| 1330 | - //delivery_days[index]['country'] = country; | |
| 1331 | - //for(var i=0; i<pref.length; i++){ | |
| 1332 | - // delivery_days[index]['value'][pref[i]] = value[i]; | |
| 1333 | - //} | |
| 1334 | - //for(var i=0; i<pref[country].length; i++){ | |
| 1335 | - // delivery_days[index]['value'][pref[country][i]] = value[i]; | |
| 1336 | - //} | |
| 1337 | - for( var j = 0; j < target_market.length; j++ ) { | |
| 1338 | - var tm = target_market[j]; | |
| 1339 | - for( var i = 0; i < pref[tm].length; i++ ) { | |
| 1340 | - var p = pref[tm][i]; | |
| 1341 | - delivery_days[index][tm][p] = $("input[name=\"delivery_days_value_"+tm+"\["+p+"\]\"]").val(); | |
| 1342 | - } | |
| 1343 | - } | |
| 1344 | -//20120710ysk end | |
| 1345 | -//20110317ysk end | |
| 1346 | - operation.disp_delivery_days(id); | |
| 1347 | - operation.make_delivery_method_days(get_delivery_method_days(selected_method)); | |
| 1348 | - $("#delivery_days_loading").html(''); | |
| 1349 | - }; | |
| 1350 | - $.ajax( s ); | |
| 1351 | - return false; | |
| 1352 | - }, | |
| 1353 | - | |
| 1354 | - delete_delivery_days : function() { | |
| 1355 | - var delname = $("#delivery_days_name_select option:selected").html(); | |
| 1356 | - if(!confirm(<?php _e("'Okay to Delete Delivery Days Setting ' + delname + '?'", 'usces'); ?>)) return false; | |
| 1357 | - | |
| 1358 | - $("#delivery_days_loading").html('<img src="<?php echo USCES_PLUGIN_URL; ?>/images/loading-publish.gif" />'); | |
| 1359 | - var id = $("#delivery_days_name_select option:selected").val(); | |
| 1360 | - var s = operation.settings; | |
| 1361 | - s.data = "action=shop_options_ajax&mode=delete_delivery_days&id=" + id; | |
| 1362 | - s.success = function(data, dataType){ | |
| 1363 | - var strs = data.split('#usces#'); | |
| 1364 | - var id = strs[0] - 0; | |
| 1365 | - for(var i=0; i<delivery_days.length; i++){ | |
| 1366 | - if(id === delivery_days[i]['id']){ | |
| 1367 | - index = i; | |
| 1368 | - } | |
| 1369 | - } | |
| 1370 | - delivery_days.splice(index, 1); | |
| 1371 | - operation.disp_delivery_days(0); | |
| 1372 | - operation.make_delivery_method_days(get_delivery_method_days(selected_method)); | |
| 1373 | - $("#delivery_days_loading").html(''); | |
| 1374 | - }; | |
| 1375 | - $.ajax( s ); | |
| 1376 | - return false; | |
| 1377 | - }, | |
| 1378 | - | |
| 1379 | - onchange_delivery_days : function(index) { | |
| 1380 | - var id = $("#delivery_days_name_select option:eq("+index+")").val()-0; | |
| 1381 | - operation.disp_delivery_days(id); | |
| 1382 | - }, | |
| 1383 | - | |
| 1384 | - allDeliveryDays : function () { | |
| 1385 | - var days = $("#all_delivery_days").val();//20110106ysk [all]->[days] | |
| 1386 | - if( days == '' ) return; | |
| 1387 | - if( confirm(<?php _e("'Okay to Change All Delivery Days to ' + days + '?'", 'usces'); ?>) ){ | |
| 1388 | -//20110317ysk start | |
| 1389 | - var country = $("#delivery_days_country option:selected").val(); | |
| 1390 | - //for(var i=0; i<pref.length; i++){ | |
| 1391 | - // $("input[name='delivery_days_value\[" + pref[i] + "\]']").val(days); | |
| 1392 | - //} | |
| 1393 | -//20120710ysk start 0000472 | |
| 1394 | - //for(var i=0; i<pref[country].length; i++){ | |
| 1395 | - // $("input[name='delivery_days_value\[" + pref[country][i] + "\]']").val(days); | |
| 1396 | - //} | |
| 1397 | - for( var i = 0; i < pref[country].length; i++ ) { | |
| 1398 | - $("input[name=\"delivery_days_value_"+country+"\["+pref[country][i]+"\]\"]").val(days); | |
| 1399 | - } | |
| 1400 | -//20120710ysk end | |
| 1401 | -//20110317ysk end | |
| 1402 | - $("#all_delivery_days").val(""); | |
| 1403 | - } | |
| 1404 | - }, | |
| 1405 | -//20101208ysk end | |
| 1406 | - | |
| 1407 | - settings: { | |
| 1408 | - url: uscesL10n.requestFile, | |
| 1409 | - type: 'POST', | |
| 1410 | - cache: false, | |
| 1411 | - success: function(data, dataType){ | |
| 1412 | - $("#delivery_method_loading").html(''); | |
| 1413 | - }, | |
| 1414 | - error: function(msg){ | |
| 1415 | - //$("#ajax-response").html(msg); | |
| 1416 | - $("#delivery_method_loading").html(''); | |
| 1417 | - } | |
| 1418 | - } | |
| 1419 | - }; | |
| 1420 | - | |
| 1421 | -//20110317ysk start | |
| 1422 | - $("#shipping_charge_country").change(function () { | |
| 1423 | -//20120710ysk start 0000472 | |
| 1424 | - //var id = $("#shipping_charge_name_select").val()-0; | |
| 1425 | - //var selected = 0; | |
| 1426 | - //for(var i=0; i<shipping_charge.length; i++){ | |
| 1427 | - // if(shipping_charge[i]['id'] === id){ | |
| 1428 | - // selected = i; | |
| 1429 | - // } | |
| 1430 | - //} | |
| 1431 | - //var country = $("#shipping_charge_country").val(); | |
| 1432 | - //var value = ''; | |
| 1433 | - //var valuehtml = ''; | |
| 1434 | - //for(var i=0; i<pref[country].length; i++){ | |
| 1435 | - // value = (shipping_charge[selected]['value'][pref[country][i]] == undefined) ? '' : shipping_charge[selected]['value'][pref[country][i]]; | |
| 1436 | - // valuehtml += "<div class='clearfix'><label class='shipping_charge_label'>" + pref[country][i] + "</label><input type='text' name='shipping_charge_value[" + pref[country][i] + "]' value='" + value + "' class='charge_text' /><?php usces_crcode(); ?></div>\n"; | |
| 1437 | - //} | |
| 1438 | - //$("#shipping_charge_value").html(valuehtml); | |
| 1439 | - //$(".charge_text").bind("change", function(){ usces_check_num($(this)); }); | |
| 1440 | - var country = $("#shipping_charge_country option:selected").val(); | |
| 1441 | - for( var i = 0; i < target_market.length; i++ ) { | |
| 1442 | - if( country == target_market[i] ) { | |
| 1443 | - $("#shipping_charge_"+target_market[i]).css("display",""); | |
| 1444 | - } else { | |
| 1445 | - $("#shipping_charge_"+target_market[i]).css("display","none"); | |
| 1446 | - } | |
| 1447 | - } | |
| 1448 | -//20120710ysk end | |
| 1449 | - }); | |
| 1450 | - | |
| 1451 | - $("#delivery_days_country").change(function () { | |
| 1452 | -//20120710ysk start 0000472 | |
| 1453 | - //var id = $("#delivery_days_name_select").val()-0; | |
| 1454 | - //var selected = 0; | |
| 1455 | - //for(var i=0; i<delivery_days.length; i++){ | |
| 1456 | - // if(delivery_days[i]['id'] === id){ | |
| 1457 | - // selected = i; | |
| 1458 | - // } | |
| 1459 | - //} | |
| 1460 | - //var country = $("#delivery_days_country").val(); | |
| 1461 | - //var value = ''; | |
| 1462 | - //var valuehtml = ''; | |
| 1463 | - //for(var i=0; i<pref[country].length; i++){ | |
| 1464 | - // //value = (delivery_days[selected]['value'][pref[country][i]] == undefined) ? '' : delivery_days[selected]['value'][pref[country][i]]; | |
| 1465 | - // value = (delivery_days[selected] == undefined || delivery_days[selected]['value'][pref[country][i]] == undefined) ? '' : delivery_days[selected]['value'][pref[country][i]]; | |
| 1466 | - // valuehtml += "<div class='clearfix'><label class='delivery_days_label'>" + pref[country][i] + "</label><input type='text' name='delivery_days_value[" + pref[country][i] + "]' value='" + value + "' class='days_text' /><?php _e('day', 'usces'); ?></div>\n"; | |
| 1467 | - //} | |
| 1468 | - //$("#delivery_days_value").html(valuehtml); | |
| 1469 | - //$(".days_text").bind("change", function(){ usces_check_num($(this)); }); | |
| 1470 | - var country = $("#delivery_days_country option:selected").val(); | |
| 1471 | - for( var i = 0; i < target_market.length; i++ ) { | |
| 1472 | - if( country == target_market[i] ) { | |
| 1473 | - $("#delivery_days_"+target_market[i]).css("display",""); | |
| 1474 | - } else { | |
| 1475 | - $("#delivery_days_"+target_market[i]).css("display","none"); | |
| 1476 | - } | |
| 1477 | - } | |
| 1478 | -//20120710ysk end | |
| 1479 | - }); | |
| 1480 | -//20110317ysk end | |
| 1481 | -}); | |
| 1482 | - | |
| 1483 | -function toggleVisibility(id) { | |
| 1484 | - var e = document.getElementById(id); | |
| 1485 | - if(e.style.display == 'block') | |
| 1486 | - e.style.display = 'none'; | |
| 1487 | - else | |
| 1488 | - e.style.display = 'block'; | |
| 1489 | -} | |
| 1490 | - | |
| 1491 | -jQuery(document).ready(function($){ | |
| 1492 | - operation.disp_delivery_method(-1); | |
| 1493 | - operation.disp_shipping_charge(-1); | |
| 1494 | -//20101208ysk start | |
| 1495 | - operation.disp_delivery_days(-1); | |
| 1496 | - | |
| 1497 | - if( $.fn.jquery < "1.10" ) { | |
| 1498 | - var $tabs = $('#uscestabs_delivery').tabs({ | |
| 1499 | - cookie: { | |
| 1500 | - // store cookie for a day, without, it would be a session cookie | |
| 1501 | - expires: 1 | |
| 1502 | - } | |
| 1503 | - }); | |
| 1504 | - } else { | |
| 1505 | - $( "#uscestabs_delivery" ).tabs({ | |
| 1506 | - active: ($.cookie("uscestabs_delivery")) ? $.cookie("uscestabs_delivery") : 0 | |
| 1507 | - , activate: function( event, ui ){ | |
| 1508 | - $.cookie("uscestabs_delivery", $(this).tabs("option", "active")); | |
| 1509 | - } | |
| 1510 | - }); | |
| 1511 | - } | |
| 1512 | -//20101208ysk end | |
| 1513 | -}); | |
| 1514 | -</script> | |
| 1515 | -<div class="wrap"> | |
| 1516 | -<div class="usces_admin"> | |
| 1517 | -<h2>Welcart Shop <?php _e('Shipping Setting','usces'); ?></h2> | |
| 1518 | -<div id="aniboxStatus" class="<?php echo $status; ?>"> | |
| 1519 | - <div id="anibox" class="clearfix"> | |
| 1520 | - <img src="<?php echo USCES_PLUGIN_URL; ?>/images/list_message_<?php echo $status; ?>.gif" /> | |
| 1521 | - <div class="mes" id="info_massage"><?php echo $message; ?></div> | |
| 1522 | - </div> | |
| 1523 | -</div> | |
| 1524 | -<p><?php _e('* It is necessary to perform the delivery setting before than the item registration.','usces'); ?><br /> | |
| 1525 | -<?php _e('* When you performed the addition and deletion of the delivery method after item registration, please be careful because the update of all items is necessary.','usces'); ?></p> | |
| 1526 | -<div id="poststuff" class="metabox-holder"> | |
| 1527 | - | |
| 1528 | -<!--20101208ysk start--> | |
| 1529 | -<div class="postbox"> | |
| 1530 | -<h3 class="hndle"><?php _e('Shipping Setting', 'usces'); ?></h3> | |
| 1531 | -<div class="inside"> | |
| 1532 | -<form action="" method="post" name="option_form" id="option_form"> | |
| 1533 | -<table class="form_table"> | |
| 1534 | - <tr style="height:40px;"> | |
| 1535 | - <th><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting01');"><?php _e('Deadline for Delivery', 'usces'); ?></a></th> | |
| 1536 | - <td> | |
| 1537 | - <select name="delivery_time_limit[hour]"> | |
| 1538 | -<?php | |
| 1539 | - for($i = 0; $i < 24; $i++) { | |
| 1540 | - $hour = sprintf('%02d', $i); | |
| 1541 | -?> | |
| 1542 | - <option value="<?php echo $hour; ?>"<?php if($delivery_time_limit['hour'] == $hour) echo ' selected'; ?>><?php echo $hour; ?></option> | |
| 1543 | -<?php | |
| 1544 | - } | |
| 1545 | -?> | |
| 1546 | - </select> | |
| 1547 | - </td> | |
| 1548 | - <td>: </td> | |
| 1549 | - <td> | |
| 1550 | - <select name="delivery_time_limit[min]"> | |
| 1551 | -<?php | |
| 1552 | - $i = 0; | |
| 1553 | - while($i < 60) { | |
| 1554 | - $min = sprintf('%02d', $i); | |
| 1555 | -?> | |
| 1556 | - <option value="<?php echo $min; ?>"<?php if($delivery_time_limit['min'] == $min) echo ' selected'; ?>><?php echo $min; ?></option> | |
| 1557 | -<?php | |
| 1558 | - $i += 10; | |
| 1559 | - } | |
| 1560 | -?> | |
| 1561 | - </select> | |
| 1562 | - </td> | |
| 1563 | - <td><div id="ex_shipping_setting01" class="explanation"><?php _e('Set deadline for merchandise delivery. This number is used to calculate the earliest delivery date.', 'usces'); ?></div></td> | |
| 1564 | - </tr> | |
| 1565 | - <tr style="height:40px;"> | |
| 1566 | - <th><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting02');"><?php _e('Morning Delivery Option', 'usces'); ?></a></th> | |
| 1567 | - <td colspan="3"> | |
| 1568 | - <select name="shortest_delivery_time"> | |
| 1569 | - <option value="0"<?php if($shortest_delivery_time == '0') echo ' selected'; ?>><?php _e('Do Not Apply', 'usces'); ?></option> | |
| 1570 | - <option value="1"<?php if($shortest_delivery_time == '1') echo ' selected'; ?>><?php _e('Morning Delivery', 'usces'); ?></option> | |
| 1571 | - <option value="2"<?php if($shortest_delivery_time == '2') echo ' selected'; ?>><?php _e('No Morning Delivery', 'usces'); ?></option> | |
| 1572 | - </select> | |
| 1573 | - </td> | |
| 1574 | - <td><div id="ex_shipping_setting02" class="explanation"><?php _e('Set if the merchandise can be delivered on the morning of earliest possible delivery date.', 'usces'); ?></div></td> | |
| 1575 | - </tr> | |
| 1576 | - <tr style="height:40px;"> | |
| 1577 | - <th><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting03');"><?php _e('Set Delivery Dates', 'usces'); ?></a></th> | |
| 1578 | - <td colspan="3"> | |
| 1579 | - <input name="delivery_after_days" type="text" class="charge_text" value="<?php echo $delivery_after_days; ?>"> | |
| 1580 | - </td> | |
| 1581 | - <td><div id="ex_shipping_setting03" class="explanation"><?php _e('Set the choices of possible delivery dates for the customer.', 'usces'); ?></div></td> | |
| 1582 | - </tr> | |
| 1583 | - <tr> | |
| 1584 | - <th></th> | |
| 1585 | - <td colspan="3"> | |
| 1586 | - <input name="usces_option_update" type="submit" class="button" value="<?php _e('change decision','usces'); ?>" /> | |
| 1587 | - </td> | |
| 1588 | - </tr> | |
| 1589 | -</table> | |
| 1590 | -</form> | |
| 1591 | -</div> | |
| 1592 | -</div><!--postbox--> | |
| 1593 | -<!--20101208ysk end--> | |
| 1594 | - | |
| 1595 | -<div class="postbox"> | |
| 1596 | -<h3 class="hndle"><span><?php _e('shipping option','usces'); ?></span><a style="cursor:pointer;" onclick="toggleVisibility('ex_delivery_method');"> (<?php _e('explanation', 'usces'); ?>) </a></h3> | |
| 1597 | -<div class="inside"> | |
| 1598 | -<table class="form_table" style="width:290px; margin-left:10px; float:left;"> | |
| 1599 | - <tr style="height:20px;"> | |
| 1600 | - <th class="sec"> </th> | |
| 1601 | - <td><a href="javascript:void(0);" id="new_delivery_method_action"><?php _e('New addition', 'usces'); ?></a></td> | |
| 1602 | - </tr> | |
| 1603 | - <tr style="height:40px;"> | |
| 1604 | - <th><?php _e('Shipping name', 'usces'); ?></th> | |
| 1605 | - <td width="150" height="30" id="delivery_method_name"></td> | |
| 1606 | - </tr> | |
| 1607 | - <tr style="height:30px;"> | |
| 1608 | - <th class="sec"> </th> | |
| 1609 | - <td id="delivery_method_name2"></td> | |
| 1610 | - </tr> | |
| 1611 | - <tr style="height:30px;"> | |
| 1612 | - <th class="sec" id="delivery_method_loading"> </th> | |
| 1613 | - <td id="delivery_method_button"></td> | |
| 1614 | - </tr> | |
| 1615 | - <tr style="height:20px;"> | |
| 1616 | - <th class="sec"></th> | |
| 1617 | - <td><a href="#" id="moveup_action"><?php _e('Raise the priority', 'usces'); ?></a></td> | |
| 1618 | - </tr> | |
| 1619 | - <tr style="height:20px;"> | |
| 1620 | - <th class="sec"></th> | |
| 1621 | - <td><a href="#" id="movedown_action"><?php _e('Lower the priority', 'usces'); ?></a></td> | |
| 1622 | - </tr> | |
| 1623 | -</table> | |
| 1624 | - | |
| 1625 | -<table class="form_table"> | |
| 1626 | - <tr style="height:20px;"> | |
| 1627 | - <th class="sec"></th> | |
| 1628 | - <td></td> | |
| 1629 | - </tr> | |
| 1630 | - <tr style="height:40px;"> | |
| 1631 | - <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting10');"><?php _e('Possible Delivery Area', 'usces'); ?></a></th> | |
| 1632 | -<!--20110317ysk start--> | |
| 1633 | -<!-- <td><input name="flights" type="radio" value="domestic" id="domestic_flights" /><label for="domestic_flights" style="margin-right:20px;"><?php _e('Domestic Shipment', 'usces'); ?></label><input name="flights" type="radio" value="internationa" id="internationa_flights" /><label for="internationa_flights"><?php _e('International Shipment', 'usces'); ?></label></td>--> | |
| 1634 | - <td><div id="delivery_method_intl"></div></td> | |
| 1635 | - <td><div id="ex_shipping_setting10" class="explanation"><?php _e('Choose possible delivery area for this shipment method.', 'usces'); ?></div></td> | |
| 1636 | -<!--20110317ysk end--> | |
| 1637 | - </tr> | |
| 1638 | -<!-- <tr> | |
| 1639 | - <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting11');"><?php _e('Applied Module', 'usces'); ?></a></th> | |
| 1640 | - <td><select name="shipping_module"> | |
| 1641 | - <option value="none"><?php _e('No possible Module', 'usces'); ?></option> | |
| 1642 | - </select></td> | |
| 1643 | - <td><div id="ex_shipping_setting11" class="explanation"><?php _e('When delivery module is chosen, the module overrules all rules including shipping fee.', 'usces'); ?></div></td> | |
| 1644 | - </tr>--> | |
| 1645 | - <tr style="height:40px;"> | |
| 1646 | - <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting12');"><?php _e('Deliverly time', 'usces'); ?></a></th> | |
| 1647 | - <td><textarea name="delivery_method_time" id="delivery_method_time" style="height:100px;"></textarea></td> | |
| 1648 | - <td><div id="ex_shipping_setting12" class="explanation"><?php _e("Input possible delivery hours. Leave it blank when the customer cannot choose delivery time. <br />example)<br />morning<br />12:00~14:00<br />14:00~16:00<br />16:00~18:00", 'usces'); ?></div></td> | |
| 1649 | - </tr> | |
| 1650 | - <tr style="height:40px;"> | |
| 1651 | - <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting13');"><?php _e('Postage fixation', 'usces'); ?></a></th> | |
| 1652 | - <td id="delivery_method_charge_td"></td> | |
| 1653 | - <td><div id="ex_shipping_setting13" class="explanation"><?php _e("It is fixed for above rate setting when I choose postage fixation. The postage set by an article is applied in the case of 'non-fixation'.", 'usces'); ?></div></td> | |
| 1654 | - </tr> | |
| 1655 | -<!-- <tr style="height:40px;"> | |
| 1656 | - <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting14');"><?php _e('Weight Added', 'usces'); ?></th> | |
| 1657 | - <td id="delivery_method_weight_td"></td> | |
| 1658 | - <td><div id="ex_shipping_setting14" class="explanation"><?php _e("Add shipment fee by the total weight of merchandise.", 'usces'); ?></div></td> | |
| 1659 | - </tr>--> | |
| 1660 | -<!--20101208ysk start--> | |
| 1661 | - <tr style="height:40px;"> | |
| 1662 | - <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting15');"><?php _e('Delivery Days', 'usces'); ?></a></th> | |
| 1663 | - <td id="delivery_method_days_td"></td> | |
| 1664 | - <td><div id="ex_shipping_setting15" class="explanation"><?php _e("Choose the Name of 'Delivery Days' registered in Delivery Days setting below. To be used to calculate the fastest delivery date. If you're not letting the customer set the delivery date, set to 'Delivery Date Not Specified'.", 'usces'); ?></div></td> | |
| 1665 | - </tr> | |
| 1666 | -<!--20101208ysk end--> | |
| 1667 | -<!--20101119ysk start--> | |
| 1668 | - <tr style="height:40px;"> | |
| 1669 | - <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting16');"><?php _e('No COD', 'usces'); ?></a></th> | |
| 1670 | - <td><div id="delivery_method_nocod"></div></td> | |
| 1671 | - <td><div id="ex_shipping_setting16" class="explanation"><?php _e("Check for no COD.", 'usces'); ?></div></td> | |
| 1672 | - </tr> | |
| 1673 | -<!--20101119ysk end--> | |
| 1674 | -</table> | |
| 1675 | - | |
| 1676 | -<hr size="1" color="#CCCCCC" /> | |
| 1677 | -<div id="ex_delivery_method" class="explanation"><?php _e('Please make entry of appointment time to a party by one.', 'usces'); ?></div> | |
| 1678 | -</div> | |
| 1679 | -</div><!--postbox--> | |
| 1680 | - | |
| 1681 | -<!--20101208ysk start--> | |
| 1682 | -<div class="uscestabs" id="uscestabs_delivery"> | |
| 1683 | - <ul> | |
| 1684 | - <li><a href="#delivery_page_setting_1"><?php _e('Shipping','usces'); ?></a></li> | |
| 1685 | - <!--<li><a href="#delivery_page_setting_3"><?php _e('Weight Added','usces'); ?></a></li>--> | |
| 1686 | - <li><a href="#delivery_page_setting_2"><?php _e('Delivery Days','usces'); ?></a></li> | |
| 1687 | - </ul> | |
| 1688 | - | |
| 1689 | -<div id="delivery_page_setting_1"> | |
| 1690 | -<!--20101208ysk end--> | |
| 1691 | - | |
| 1692 | -<div class="postbox"> | |
| 1693 | -<h3 class="hndle"><span><?php _e('Shipping', 'usces'); ?></span><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_charge');"> (<?php _e('explanation', 'usces'); ?>) </a></h3> | |
| 1694 | -<div class="inside"> | |
| 1695 | -<table class="form_table" style="width:290px; margin-left:10px; float:left;"> | |
| 1696 | - <tr style="height:20px;"> | |
| 1697 | - <th class="sec"> </th> | |
| 1698 | - <td><a href="javascript:void(0);" id="new_shipping_charge_action"><?php _e('New addition', 'usces'); ?></a></td> | |
| 1699 | - </tr> | |
| 1700 | - <tr style="height:30px;"> | |
| 1701 | - <th class="sec"><?php _e('Shipping charge name', 'usces'); ?></th> | |
| 1702 | - <td width="150" height="30" id="shipping_charge_name"></td> | |
| 1703 | - </tr> | |
| 1704 | - <tr style="height:30px;"> | |
| 1705 | - <th class="sec"> </th> | |
| 1706 | - <td width="150" height="30" id="shipping_charge_name2"></td> | |
| 1707 | - </tr> | |
| 1708 | - <tr style="height:30px;"> | |
| 1709 | - <th class="sec" id="shipping_charge_loading"> </th> | |
| 1710 | - <td id="shipping_charge_button"></td> | |
| 1711 | - </tr> | |
| 1712 | -</table> | |
| 1713 | -<table class="form_table"> | |
| 1714 | - <tr style="height:20px;"> | |
| 1715 | - <th class="sec"></th> | |
| 1716 | - <td></td> | |
| 1717 | - </tr> | |
| 1718 | - <tr style="height:40px;"> | |
| 1719 | - <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting20');"><?php _e('Country', 'usces'); ?></a></th> | |
| 1720 | - <td><label class="shipping_charge_label"></label><select name="shipping_charge_country" id="shipping_charge_country"> | |
| 1721 | - <?php usces_shipping_country_option( '' ); ?> | |
| 1722 | - </select></td> | |
| 1723 | -<!--20110317ysk start--> | |
| 1724 | - <td><div id="ex_shipping_setting20" class="explanation"><?php _e('Choose countries to apply this shipment fee.', 'usces'); ?></div></td> | |
| 1725 | -<!--20110317ysk end--> | |
| 1726 | - </tr> | |
| 1727 | - <tr style="height:40px;"> | |
| 1728 | - <th class="sec"><?php _e('Shipping', 'usces'); ?></th> | |
| 1729 | - <td><label class="shipping_charge_label"><input name="allbutton" type="button" class="allbutton" onclick="operation.allCharge();" value="<?php _e('same as', 'usces'); ?>" /></label><input name="allcharge" id="allcharge" type="text" class='charge_text' /><?php usces_crcode(); ?></td> | |
| 1730 | - </tr> | |
| 1731 | - <tr> | |
| 1732 | - <th class="sec"></th> | |
| 1733 | - <td><div id="shipping_charge_value"></div></td> | |
| 1734 | - </tr> | |
| 1735 | -</table> | |
| 1736 | -<hr size="1" color="#CCCCCC" /> | |
| 1737 | -<div id="ex_shipping_charge" class="explanation"><?php _e('You can choose the shipping every item.', 'usces'); ?></div> | |
| 1738 | -</div> | |
| 1739 | -</div><!--postbox--> | |
| 1740 | - | |
| 1741 | -<!--20101208ysk start--> | |
| 1742 | -</div><!--delivery_page_setting_1--> | |
| 1743 | -<div id="delivery_page_setting_2"> | |
| 1744 | -<div class="postbox"> | |
| 1745 | -<h3 class="hndle"><span><?php _e('Delivery Days', 'usces'); ?></span><a style="cursor:pointer;" onclick="toggleVisibility('ex_delivery_days');"> (<?php _e('explanation', 'usces'); ?>) </a></h3> | |
| 1746 | -<div class="inside"> | |
| 1747 | -<table class="form_table" style="width:280px; margin-left:10px; float:left;"> | |
| 1748 | - <tr style="height:20px;"> | |
| 1749 | - <th class="sec"> </th> | |
| 1750 | - <td><a href="javascript:void(0);" id="new_delivery_days_action"><?php _e('New addition', 'usces'); ?></a></td> | |
| 1751 | - </tr> | |
| 1752 | - <tr style="height:30px;"> | |
| 1753 | - <th class="sec"><?php _e("Name of 'Delivery Days'", 'usces'); ?></th> | |
| 1754 | - <td width="150" height="30" id="delivery_days_name"></td> | |
| 1755 | - </tr> | |
| 1756 | - <tr style="height:30px;"> | |
| 1757 | - <th class="sec"> </th> | |
| 1758 | - <td width="150" height="30" id="delivery_days_name2"></td> | |
| 1759 | - </tr> | |
| 1760 | - <tr style="height:30px;"> | |
| 1761 | - <th class="sec" id="delivery_days_loading"> </th> | |
| 1762 | - <td id="delivery_days_button"></td> | |
| 1763 | - </tr> | |
| 1764 | -</table> | |
| 1765 | -<table class="form_table"> | |
| 1766 | - <tr style="height:20px;"> | |
| 1767 | - <th class="sec"></th> | |
| 1768 | - <td></td> | |
| 1769 | - </tr> | |
| 1770 | - <tr style="height:40px;"> | |
| 1771 | -<!--20110317ysk start--> | |
| 1772 | -<!-- <th class="sec"></th> | |
| 1773 | - <td></td>--> | |
| 1774 | - <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_delivery_days_setting20');"><?php _e('Country', 'usces'); ?></a></th> | |
| 1775 | - <td><label class="shipping_charge_label"></label><select name="delivery_days_country" id="delivery_days_country"> | |
| 1776 | - <?php usces_shipping_country_option( '' ); ?> | |
| 1777 | - </select></td> | |
| 1778 | - <td><div id="ex_delivery_days_setting20" class="explanation"><?php _e('Choose countries to apply this Delivery Days.', 'usces'); ?></div></td> | |
| 1779 | -<!--20110317ysk end--> | |
| 1780 | - </tr> | |
| 1781 | - <tr style="height:40px;"> | |
| 1782 | - <th class="sec"><?php _e('Delivery Days', 'usces'); ?></th> | |
| 1783 | - <td><label class="delivery_days_label"><input name="allbutton_delivery_days" type="button" class="allbutton" onclick="operation.allDeliveryDays();" value="<?php _e('same as', 'usces'); ?>" /></label><input name="all_delivery_days" id="all_delivery_days" type="text" class='days_text' /><?php _e('day', 'usces'); ?></td> | |
| 1784 | - </tr> | |
| 1785 | - <tr> | |
| 1786 | - <th class="sec"></th> | |
| 1787 | - <td><div id="delivery_days_value"></div></td> | |
| 1788 | - </tr> | |
| 1789 | -</table> | |
| 1790 | -<hr size="1" color="#CCCCCC" /> | |
| 1791 | -<div id="ex_delivery_days" class="explanation"><?php _e('You can choose Delivery Days for each merchandise.', 'usces'); ?></div> | |
| 1792 | -</div> | |
| 1793 | -</div><!--postbox--> | |
| 1794 | -</div><!--delivery_page_setting_2--> | |
| 1795 | -<!-- | |
| 1796 | -<div id="delivery_page_setting_3"> | |
| 1797 | -<div class="postbox"> | |
| 1798 | -<h3 class="hndle"><span><?php _e('Weight Added', 'usces'); ?></span><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_weight');"> (<?php _e('explanation', 'usces'); ?>) </a></h3> | |
| 1799 | -<div class="inside"> | |
| 1800 | -<table class="form_table" style="width:280px; margin-left:10px; float:left;"> | |
| 1801 | - <tr> | |
| 1802 | - <th class="sec"> </th> | |
| 1803 | - <td><a href="javascript:void(0);" id="new_delivery_days_action"><?php _e('New addition', 'usces'); ?></a></td> | |
| 1804 | - </tr> | |
| 1805 | - <tr> | |
| 1806 | - <th class="sec"><?php _e('Name of the Additional Fee', 'usces'); ?></th> | |
| 1807 | - <td width="150" height="30" id="shipping_weight_name"></td> | |
| 1808 | - </tr> | |
| 1809 | - <tr> | |
| 1810 | - <th class="sec"> </th> | |
| 1811 | - <td width="150" height="30" id="shipping_weight_name2"></td> | |
| 1812 | - </tr> | |
| 1813 | - <tr> | |
| 1814 | - <th class="sec" id="shipping_weight_loading"> </th> | |
| 1815 | - <td id="shipping_weight_button"></td> | |
| 1816 | - </tr> | |
| 1817 | -</table> | |
| 1818 | -<table class="form_table"> | |
| 1819 | - <tr> | |
| 1820 | - <th class="sec"></th> | |
| 1821 | - <td></td> | |
| 1822 | - </tr> | |
| 1823 | - <tr> | |
| 1824 | - <th class="sec"><?php _e('Amount of the Additional Fee', 'usces'); ?></th> | |
| 1825 | - <td><label class="delivery_days_label"><input name="allbutton_shipping_weight" type="button" class="allbutton" onclick="operation.allShippingWeight();" value="<?php _e('same as', 'usces'); ?>" /></label><input name="all_shipping_weight" id="all_shipping_weight" type="text" class='days_text' /><?php usces_crcode(); ?></td> | |
| 1826 | - </tr> | |
| 1827 | - <tr> | |
| 1828 | - <th class="sec"></th> | |
| 1829 | - <td></td> | |
| 1830 | - </tr> | |
| 1831 | - <tr> | |
| 1832 | - <th class="sec"></th> | |
| 1833 | - <td><div id="shipping_weight_value"></div></td> | |
| 1834 | - </tr> | |
| 1835 | -</table> | |
| 1836 | -<hr size="1" color="#CCCCCC" /> | |
| 1837 | -<div id="ex_shipping_weight" class="explanation"><?php _e('Calculate the shipping fee based on the total weight of the merchandises.', 'usces'); ?></div> | |
| 1838 | -</div> | |
| 1839 | -</div> | |
| 1840 | -</div> | |
| 1841 | - | |
| 1842 | -</div><!--tabs--> | |
| 1843 | -<!--20101208ysk end--> | |
| 1844 | - | |
| 1845 | -</div><!--poststuff--> | |
| 1846 | - | |
| 1847 | -</div><!--usces_admin--> | |
| 1848 | -</div><!--wrap--> | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Admin - Delivery Setting Page. | |
| 4 | + * | |
| 5 | + * @package Welcart | |
| 6 | + */ | |
| 7 | + | |
| 8 | +$delivery_method = isset( $this->options['delivery_method'] ) ? $this->options['delivery_method'] : array(); | |
| 9 | +$shipping_charge = isset( $this->options['shipping_charge'] ) ? $this->options['shipping_charge'] : array(); | |
| 10 | +$target_market = ( isset( $this->options['system']['target_market'] ) && ! empty( $this->options['system']['target_market'] ) ) ? $this->options['system']['target_market'] : usces_get_local_target_market(); | |
| 11 | +foreach ( (array) $target_market as $tm ) { | |
| 12 | + $prefs[ $tm ] = get_usces_states( $tm ); | |
| 13 | + array_shift( $prefs[ $tm ] ); | |
| 14 | +} | |
| 15 | +$shipping_charge = apply_filters( 'usces_filter_admin_shipping_charge', $shipping_charge, $target_market, $prefs ); | |
| 16 | +$delivery_time_limit['hour'] = isset( $this->options['delivery_time_limit']['hour'] ) ? $this->options['delivery_time_limit']['hour'] : '00'; | |
| 17 | +$delivery_time_limit['min'] = isset( $this->options['delivery_time_limit']['min'] ) ? $this->options['delivery_time_limit']['min'] : '00'; | |
| 18 | +$shortest_delivery_time = isset( $this->options['shortest_delivery_time'] ) ? $this->options['shortest_delivery_time'] : '0'; | |
| 19 | +$delivery_after_days = ( empty( $this->options['delivery_after_days'] ) ) ? 15 : (int) $this->options['delivery_after_days']; | |
| 20 | +$delivery_days = isset( $this->options['delivery_days'] ) ? $this->options['delivery_days'] : array(); | |
| 21 | +$base_country = $this->options['system']['base_country']; | |
| 22 | +?> | |
| 23 | +<script type="text/javascript"> | |
| 24 | +jQuery(function($){ | |
| 25 | + | |
| 26 | + $(".charge_text").bind("change", function(){ usces_check_money($(this)); }); | |
| 27 | + $(".days_text").bind("change", function(){ usces_check_num($(this)); }); | |
| 28 | + | |
| 29 | +<?php | |
| 30 | +if ( ! array_key_exists( $base_country, (array) $target_market ) ) { | |
| 31 | + $base_country = $target_market[0]; | |
| 32 | +} | |
| 33 | +$i = 0; | |
| 34 | +?> | |
| 35 | + var target_market = []; | |
| 36 | +<?php foreach ( (array) $target_market as $tm ) : ?> | |
| 37 | + target_market[<?php echo esc_js( $i ); ?>] = "<?php echo esc_js( $tm ); ?>"; | |
| 38 | + <?php $i++; ?> | |
| 39 | +<?php endforeach; ?> | |
| 40 | + var base_country = "<?php echo esc_js( $base_country ); ?>"; | |
| 41 | + | |
| 42 | + var delivery_method = []; | |
| 43 | +<?php | |
| 44 | +$delivery_method_count = ( is_array( $delivery_method ) ) ? count( $delivery_method ) : 0; | |
| 45 | +for ( $i = 0; $i < $delivery_method_count; $i++ ) { | |
| 46 | + $delivery_method[ $i ]['time'] = usces_change_line_break( $delivery_method[ $i ]['time'] ); | |
| 47 | + $lines = explode( "\n", $delivery_method[ $i ]['time'] ); | |
| 48 | + ?> | |
| 49 | + delivery_method[<?php echo esc_js( $i ); ?>] = []; | |
| 50 | + delivery_method[<?php echo esc_js( $i ); ?>]['id'] = <?php echo esc_js( (int) $delivery_method[ $i ]['id'] ); ?>; | |
| 51 | + delivery_method[<?php echo esc_js( $i ); ?>]['name'] = "<?php echo esc_js( $delivery_method[ $i ]['name'] ); ?>"; | |
| 52 | + delivery_method[<?php echo esc_js( $i ); ?>]['charge'] = <?php echo esc_js( (int) $delivery_method[ $i ]['charge'] ); ?>; | |
| 53 | + delivery_method[<?php echo esc_js( $i ); ?>]['days'] = <?php echo esc_js( (int) $delivery_method[ $i ]['days'] ); ?>; | |
| 54 | + sttr = ''; | |
| 55 | + <?php | |
| 56 | + foreach ( (array) $lines as $line ) { | |
| 57 | + if ( trim( $line ) != '' ) { | |
| 58 | + ?> | |
| 59 | + sttr += "<?php echo esc_js( trim( $line ) ); ?>\n"; | |
| 60 | + <?php | |
| 61 | + } | |
| 62 | + } | |
| 63 | + ?> | |
| 64 | + delivery_method[<?php echo esc_js( $i ); ?>]['time'] = sttr; | |
| 65 | + delivery_method[<?php echo esc_js( $i ); ?>]['nocod'] = "<?php echo esc_js( $delivery_method[ $i ]['nocod'] ); ?>"; | |
| 66 | + delivery_method[<?php echo esc_js( $i ); ?>]['intl'] = "<?php echo ( ! empty( $delivery_method[ $i ]['intl'] ) ) ? esc_js( $delivery_method[ $i ]['intl'] ) : '0'; ?>"; | |
| 67 | + delivery_method[<?php echo esc_js( $i ); ?>]['cool_category'] = "<?php echo ( ! empty( $delivery_method[ $i ]['cool_category'] ) ) ? esc_js( $delivery_method[ $i ]['cool_category'] ) : '0'; ?>"; | |
| 68 | +<?php } ?> | |
| 69 | + | |
| 70 | + var pref = []; | |
| 71 | +<?php foreach ( (array) $target_market as $tm ) { ?> | |
| 72 | + pref["<?php echo esc_js( $tm ); ?>"] = []; | |
| 73 | + <?php foreach ( (array) $prefs[ $tm ] as $pref ) { ?> | |
| 74 | + pref["<?php echo esc_js( $tm ); ?>"].push("<?php echo esc_js( $pref ); ?>"); | |
| 75 | + <?php | |
| 76 | + } | |
| 77 | +} | |
| 78 | +?> | |
| 79 | + | |
| 80 | + var shipping_charge = []; | |
| 81 | +<?php | |
| 82 | +$shipping_charge_count = ( is_array( $shipping_charge ) ) ? count( $shipping_charge ) : 0; | |
| 83 | +for ( $i = 0; $i < $shipping_charge_count; $i++ ) { | |
| 84 | + ?> | |
| 85 | + shipping_charge[<?php echo esc_js( $i ); ?>] = []; | |
| 86 | + shipping_charge[<?php echo esc_js( $i ); ?>]["id"] = <?php echo esc_js( (int) $shipping_charge[ $i ]['id'] ); ?>; | |
| 87 | + shipping_charge[<?php echo esc_js( $i ); ?>]["name"] = "<?php echo esc_js( $shipping_charge[ $i ]['name'] ); ?>"; | |
| 88 | + <?php foreach ( (array) $target_market as $tm ) { ?> | |
| 89 | + shipping_charge[<?php echo esc_js( $i ); ?>]["<?php echo esc_js( $tm ); ?>"] = []; | |
| 90 | + | |
| 91 | + <?php $target_prefs = apply_filters( 'usces_filter_admin_shipping_prefs', $prefs, $shipping_charge[ $i ], $target_market ); ?> | |
| 92 | + | |
| 93 | + <?php foreach ( (array) $target_prefs[ $tm ] as $pref ) { ?> | |
| 94 | + <?php if ( isset( $shipping_charge[ $i ][ $tm ][ $pref ] ) ) : ?> | |
| 95 | + shipping_charge[<?php echo esc_js( $i ); ?>]["<?php echo esc_js( $tm ); ?>"]["<?php echo esc_js( $pref ); ?>"] = "<?php echo esc_js( (float) $shipping_charge[ $i ][ $tm ][ $pref ] ); ?>"; | |
| 96 | + <?php else : ?> | |
| 97 | + shipping_charge[<?php echo esc_js( $i ); ?>]["<?php echo esc_js( $tm ); ?>"]["<?php echo esc_js( $pref ); ?>"] = "0"; | |
| 98 | + <?php endif; ?> | |
| 99 | + <?php | |
| 100 | + } | |
| 101 | + } | |
| 102 | +} | |
| 103 | +?> | |
| 104 | + | |
| 105 | + var delivery_days = []; | |
| 106 | +<?php | |
| 107 | +$delivery_days_count = ( is_array( $delivery_days ) ) ? count( $delivery_days ) : 0; | |
| 108 | +for ( $i = 0; $i < $delivery_days_count; $i++ ) { | |
| 109 | + ?> | |
| 110 | + delivery_days[<?php echo esc_js( $i ); ?>] = []; | |
| 111 | + delivery_days[<?php echo esc_js( $i ); ?>]["id"] = <?php echo esc_js( (int) $delivery_days[ $i ]['id'] ); ?>; | |
| 112 | + delivery_days[<?php echo esc_js( $i ); ?>]["name"] = "<?php echo esc_js( $delivery_days[ $i ]['name'] ); ?>"; | |
| 113 | + <?php foreach ( (array) $target_market as $tm ) { ?> | |
| 114 | + delivery_days[<?php echo esc_js( $i ); ?>]["<?php echo esc_js( $tm ); ?>"] = []; | |
| 115 | + <?php foreach ( (array) $prefs[ $tm ] as $pref ) { ?> | |
| 116 | + <?php if ( isset( $delivery_days[ $i ][ $tm ][ $pref ] ) ) : ?> | |
| 117 | + delivery_days[<?php echo esc_js( $i ); ?>]["<?php echo esc_js( $tm ); ?>"]["<?php echo esc_js( $pref ); ?>"] = "<?php echo esc_js( (int) $delivery_days[ $i ][ $tm ][ $pref ] ); ?>"; | |
| 118 | + <?php else : ?> | |
| 119 | + delivery_days[<?php echo esc_js( $i ); ?>]["<?php echo esc_js( $tm ); ?>"]["<?php echo esc_js( $pref ); ?>"] = "0"; | |
| 120 | + <?php endif; ?> | |
| 121 | + <?php | |
| 122 | + } | |
| 123 | + } | |
| 124 | +} | |
| 125 | + | |
| 126 | +$cool_categories = array( | |
| 127 | + array( | |
| 128 | + 'id' => 0, | |
| 129 | + 'name' => __( 'normal', 'usces' ), | |
| 130 | + ), | |
| 131 | + array( | |
| 132 | + 'id' => 1, | |
| 133 | + 'name' => __( 'frozen', 'usces' ), | |
| 134 | + ), | |
| 135 | + array( | |
| 136 | + 'id' => 2, | |
| 137 | + 'name' => __( 'refrige', 'usces' ), | |
| 138 | + ), | |
| 139 | +); | |
| 140 | +?> | |
| 141 | + var cool_categories = <?php echo json_encode( $cool_categories ); ?> | |
| 142 | + | |
| 143 | + var selected_method = 0; | |
| 144 | + function get_delivery_method_charge(selected){ | |
| 145 | + var index = 0; | |
| 146 | + for(var i=0; i<delivery_method.length; i++){ | |
| 147 | + if(selected === delivery_method[i]['id']){ | |
| 148 | + index = i; | |
| 149 | + } | |
| 150 | + } | |
| 151 | + if(undefined === delivery_method[index]){ | |
| 152 | + return -1; | |
| 153 | + }else{ | |
| 154 | + return delivery_method[index]['charge']; | |
| 155 | + } | |
| 156 | + } | |
| 157 | + | |
| 158 | + $("#delivery_method_charge").click(function () { | |
| 159 | + if(shipping_charge.length == 0){ | |
| 160 | + alert('<?php esc_html_e( 'Please set the shipping price', 'usces' ); ?>'); | |
| 161 | + } | |
| 162 | + }); | |
| 163 | + | |
| 164 | + function get_delivery_method_days(selected){ | |
| 165 | + var index = 0; | |
| 166 | + for(var i=0; i<delivery_method.length; i++){ | |
| 167 | + if(selected === delivery_method[i]['id']){ | |
| 168 | + index = i; | |
| 169 | + } | |
| 170 | + } | |
| 171 | + if(undefined === delivery_method[index]){ | |
| 172 | + return -1; | |
| 173 | + }else{ | |
| 174 | + return delivery_method[index]['days']; | |
| 175 | + } | |
| 176 | + } | |
| 177 | + | |
| 178 | + $("#delivery_method_days").click(function () { | |
| 179 | + if(delivery_days.length == 0){ | |
| 180 | + alert('<?php esc_html_e( 'Please set the delivery days', 'usces' ); ?>'); | |
| 181 | + } | |
| 182 | + }); | |
| 183 | + | |
| 184 | + function get_delivery_cool_category(selected){ | |
| 185 | + var index = 0; | |
| 186 | + for(var i=0; i<delivery_method.length; i++){ | |
| 187 | + if(selected === delivery_method[i]['id']){ | |
| 188 | + index = i; | |
| 189 | + } | |
| 190 | + } | |
| 191 | + if(undefined === delivery_method[index] || undefined === delivery_method[index]['cool_category']){ | |
| 192 | + return 0; | |
| 193 | + }else{ | |
| 194 | + return delivery_method[index]['cool_category']; | |
| 195 | + } | |
| 196 | + } | |
| 197 | + | |
| 198 | + $("#new_delivery_method_action").click(function () { | |
| 199 | + if(delivery_method.length === 0) return false; | |
| 200 | + $("#delivery_method_name").html('<input name="delivery_method_name" type="text" value="" />'); | |
| 201 | + $("#delivery_method_name2").html(''); | |
| 202 | + $("#delivery_method_time").val(''); | |
| 203 | + $("#delivery_method_button").html('<input name="cancel_delivery_method" id="cancel_delivery_method" type="button" class="button" value="<?php esc_attr_e( 'Cancel', 'usces' ); ?>" onclick="operation.disp_delivery_method(0);" /> <input name="add_delivery_method" id="add_delivery_method" type="button" class="button" value="<?php esc_attr_e( 'Add', 'usces' ); ?>" onclick="operation.add_delivery_method();" />'); | |
| 204 | + $("#delivery_method_nocod").html('<input name="delivery_method_nocod" type="checkbox" value="1" />'); | |
| 205 | + $("#delivery_method_intl").html('<input name="delivery_method_intl" id="delivery_method_intl_0" type="radio" value="0" checked /><label for="delivery_method_intl_0"><?php esc_html_e( 'Domestic Shipment', 'usces' ); ?></label> <input name="delivery_method_intl" id="delivery_method_intl_1" type="radio" value="1" /><label for="delivery_method_intl_1"><?php esc_html_e( 'International Shipment', 'usces' ); ?></label>'); | |
| 206 | + $("input[name='delivery_method_name']").focus().select(); | |
| 207 | + operation.make_delivery_method_charge(-1); | |
| 208 | + operation.make_delivery_method_days(-1); | |
| 209 | + operation.make_delivery_cool_category(0); | |
| 210 | + }); | |
| 211 | + | |
| 212 | + $("#moveup_action").click(function () { | |
| 213 | + var id = $("#delivery_method_name_select option:selected").val()-0; | |
| 214 | + operation.moveup_delivery_method(id); | |
| 215 | + operation.disp_delivery_method(id); | |
| 216 | + }); | |
| 217 | + | |
| 218 | + $("#movedown_action").click(function () { | |
| 219 | + var id = $("#delivery_method_name_select option:selected").val()-0; | |
| 220 | + operation.movedown_delivery_method(id); | |
| 221 | + operation.disp_delivery_method(id); | |
| 222 | + }); | |
| 223 | + | |
| 224 | + $("#new_shipping_charge_action").click(function () { | |
| 225 | + var valuehtml = ''; | |
| 226 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 227 | + var tm = target_market[j]; | |
| 228 | + valuehtml += "<div id='shipping_charge_"+tm+"'>"; | |
| 229 | + for( var i = 0; i < pref[tm].length; i++ ) { | |
| 230 | + var p = pref[tm][i]; | |
| 231 | + valuehtml += "<div class='clearfix'><label class='shipping_charge_label'>"+p+"</label><input type='text' name=\"shipping_charge_value_"+tm+"["+p+"]\" value='' class='charge_text' /><?php usces_crcode(); ?></div>\n"; | |
| 232 | + } | |
| 233 | + valuehtml += "</div>"; | |
| 234 | + } | |
| 235 | + $("#shipping_charge_country").val(base_country); | |
| 236 | + $("#shipping_charge_name").html('<input name="shipping_charge_name" type="text" value="" />'); | |
| 237 | + $("#shipping_charge_name2").html(''); | |
| 238 | + $("#shipping_charge_value").html(valuehtml); | |
| 239 | + $("#shipping_charge_button").html('<input name="cancel_shipping_charge" id="cancel_shipping_charge" type="button" class="button" value="<?php esc_attr_e( 'Cancel', 'usces' ); ?>" onclick="operation.disp_shipping_charge(0);" /> <input name="add_shipping_charge" id="add_shipping_charge" type="button" class="button" value="<?php esc_attr_e( 'Add', 'usces' ); ?>" onclick="operation.add_shipping_charge();" />'); | |
| 240 | + $("input[name='shipping_charge_name']").focus().select(); | |
| 241 | + $(".charge_text").bind("change", function(){ usces_check_money($(this)); }); | |
| 242 | + for( var i = 0; i < target_market.length; i++ ) { | |
| 243 | + if( base_country == target_market[i] ) { | |
| 244 | + $("#shipping_charge_"+target_market[i]).css("display",""); | |
| 245 | + } else { | |
| 246 | + $("#shipping_charge_"+target_market[i]).css("display","none"); | |
| 247 | + } | |
| 248 | + } | |
| 249 | + }); | |
| 250 | + | |
| 251 | + $("#new_delivery_days_action").click(function () { | |
| 252 | + var valuehtml = ''; | |
| 253 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 254 | + var tm = target_market[j]; | |
| 255 | + valuehtml += "<div id='delivery_days_"+tm+"'>"; | |
| 256 | + for( var i = 0; i < pref[tm].length; i++ ) { | |
| 257 | + var p = pref[tm][i]; | |
| 258 | + valuehtml += "<div class='clearfix'><label class='delivery_days_label'>"+p+"</label><input type='text' name=\"delivery_days_value_"+tm+"["+p+"]\" value='' class='days_text' /><?php esc_html_e( 'day', 'usces' ); ?></div>\n"; | |
| 259 | + } | |
| 260 | + valuehtml += "</div>"; | |
| 261 | + } | |
| 262 | + $("#delivery_days_country").val(base_country); | |
| 263 | + $("#delivery_days_name").html('<input name="delivery_days_name" type="text" value="" />'); | |
| 264 | + $("#delivery_days_name2").html(''); | |
| 265 | + $("#delivery_days_value").html(valuehtml); | |
| 266 | + $("#delivery_days_button").html('<input name="cancel_delivery_days" id="cancel_delivery_days" type="button" class="button" value="<?php esc_attr_e( 'Cancel', 'usces' ); ?>" onclick="operation.disp_delivery_days(0);" /> <input name="add_delivery_days" id="add_delivery_days" type="button" class="button" value="<?php esc_attr_e( 'Add', 'usces' ); ?>" onclick="operation.add_delivery_days();" />'); | |
| 267 | + $("input[name='delivery_days_name']").focus().select(); | |
| 268 | + $(".days_text").bind("change", function(){ usces_check_num($(this)); }); | |
| 269 | + for( var i = 0; i < target_market.length; i++ ) { | |
| 270 | + if( base_country == target_market[i] ) { | |
| 271 | + $("#delivery_days_"+target_market[i]).css("display",""); | |
| 272 | + } else { | |
| 273 | + $("#delivery_days_"+target_market[i]).css("display","none"); | |
| 274 | + } | |
| 275 | + } | |
| 276 | + }); | |
| 277 | + | |
| 278 | + operation = { | |
| 279 | + disp_delivery_method :function (id){ | |
| 280 | + selected_method = id; | |
| 281 | + var index = false; | |
| 282 | + for(var i=0; i<delivery_method.length; i++){ | |
| 283 | + if(id === delivery_method[i]['id']){ | |
| 284 | + index = i; | |
| 285 | + } | |
| 286 | + } | |
| 287 | + if(false === index){ | |
| 288 | + selected = 0; | |
| 289 | + }else{ | |
| 290 | + selected = index; | |
| 291 | + } | |
| 292 | + if(delivery_method.length === 0) { | |
| 293 | + $("#delivery_method_name").html('<input name="delivery_method_name" type="text" value="" />'); | |
| 294 | + $("#delivery_method_name2").html(''); | |
| 295 | + $("#delivery_method_time").val(''); | |
| 296 | + $("#delivery_method_button").html('<input name="add_delivery_method" id="add_delivery_method" type="button" class="button" value="<?php esc_attr_e( 'Add', 'usces' ); ?>" onclick="operation.add_delivery_method();" />'); | |
| 297 | + $("#delivery_method_nocod").html('<input name="delivery_method_nocod" type="checkbox" value="1" />'); | |
| 298 | + $("#delivery_method_intl").html('<input name="delivery_method_intl" id="delivery_method_intl_0" type="radio" value="0" checked /><label for="delivery_method_intl_0"><?php esc_html_e( 'Domestic Shipment', 'usces' ); ?></label> <input name="delivery_method_intl" id="delivery_method_intl_1" type="radio" value="1" /><label for="delivery_method_intl_1"><?php esc_html_e( 'International Shipment', 'usces' ); ?></label>'); | |
| 299 | + operation.make_delivery_method_charge(-1); | |
| 300 | + operation.make_delivery_method_days(-1); | |
| 301 | + operation.make_delivery_cool_category(0); | |
| 302 | + }else{ | |
| 303 | + var name_select = '<select name="delivery_method_name_select" id="delivery_method_name_select" onchange="operation.onchange_delivery_select(this.selectedIndex);">'+"\n"; | |
| 304 | + for(var i=0; i<delivery_method.length; i++){ | |
| 305 | + if(selected === i){ | |
| 306 | + name_select += '<option value="'+delivery_method[i]['id']+'" selected="selected">'+delivery_method[i]['id']+' : ' + esc_js( delivery_method[i]['name'] ) + '</option>'+"\n"; | |
| 307 | + }else{ | |
| 308 | + name_select += '<option value="'+delivery_method[i]['id']+'">'+delivery_method[i]['id']+' : '+esc_js( delivery_method[i]['name'] )+'</option>'+"\n"; | |
| 309 | + } | |
| 310 | + } | |
| 311 | + name_select += "</select>\n"; | |
| 312 | + $("#delivery_method_name").html(name_select); | |
| 313 | + $("#delivery_method_name2").html('<input name="delivery_method_name" type="text" value="'+esc_js( delivery_method[selected]['name'] )+'" />'); | |
| 314 | + $("#delivery_method_time").val(delivery_method[selected]['time']); | |
| 315 | + $("#delivery_method_button").html("<input name='delete_delivery_method' id='delete_delivery_method' type='button' class='button' value='<?php esc_attr_e( 'Delete', 'usces' ); ?>' onclick='operation.delete_delivery_method();' /> <input name='update_delivery_method' id='update_delivery_method' type='button' class='button' value='<?php esc_attr_e( 'update', 'usces' ); ?>' onclick='operation.update_delivery_method();' />"); | |
| 316 | + var checked_nocod = (delivery_method[selected]['nocod'] == '1') ? ' checked' : ''; | |
| 317 | + $("#delivery_method_nocod").html('<input name="delivery_method_nocod" type="checkbox" value="1"'+checked_nocod+' />'); | |
| 318 | + var checked_intl_0 = (delivery_method[selected]['intl'] == '0') ? ' checked' : ''; | |
| 319 | + var checked_intl_1 = (delivery_method[selected]['intl'] == '1') ? ' checked' : ''; | |
| 320 | + $("#delivery_method_intl").html('<input name="delivery_method_intl" id="delivery_method_intl_0" type="radio" value="0"'+checked_intl_0+' /><label for="delivery_method_intl_0"><?php esc_html_e( 'Domestic Shipment', 'usces' ); ?></label> <input name="delivery_method_intl" id="delivery_method_intl_1" type="radio" value="1"'+checked_intl_1+' /><label for="delivery_method_intl_1"><?php esc_html_e( 'International Shipment', 'usces' ); ?></label>'); | |
| 321 | + operation.make_delivery_method_charge(get_delivery_method_charge(selected_method)); | |
| 322 | + operation.make_delivery_method_days(get_delivery_method_days(selected_method)); | |
| 323 | + operation.make_delivery_cool_category(get_delivery_cool_category(selected_method)); | |
| 324 | + } | |
| 325 | + }, | |
| 326 | + | |
| 327 | + add_delivery_method : function() { | |
| 328 | + if($("input[name='delivery_method_name']").val() == "") return; | |
| 329 | + | |
| 330 | + var wc_nonce = $("#wc_nonce").val(); | |
| 331 | + var _wp_http_referer = $("input[name='_wp_http_referer']").val(); | |
| 332 | + | |
| 333 | + $("#delivery_method_loading").html('<img src="<?php echo esc_url( USCES_PLUGIN_URL ); ?>/images/loading-publish.gif" />'); | |
| 334 | + var name = encodeURIComponent($("input[name='delivery_method_name']").val()); | |
| 335 | + var time = encodeURIComponent($("#delivery_method_time").val()); | |
| 336 | + var charge = $("#delivery_method_charge option:selected").val(); | |
| 337 | + var days = $("#delivery_method_days option:selected").val(); | |
| 338 | + var nocod = ($(':input[name=delivery_method_nocod]').prop('checked')) ? '1' : '0'; | |
| 339 | + var intl = $(':radio[name=delivery_method_intl]:checked').val(); | |
| 340 | + var cool_cat = $("#delivery_cool_category option:selected").val(); | |
| 341 | + | |
| 342 | + var s = operation.settings; | |
| 343 | + s.data = "action=shop_options_ajax&mode=add_delivery_method&name=" + name + "&timeband=" + time + "&charge=" + charge + "&days=" + days + "&nocod=" + nocod + "&intl=" + intl + "&cool_category=" + cool_cat + "&wc_nonce=" + encodeURIComponent(wc_nonce)+ "&_wp_http_referer=" + encodeURIComponent(_wp_http_referer); | |
| 344 | + $.ajax( s ).done(function( response ){ | |
| 345 | + var data = JSON.parse(response); | |
| 346 | + var index = delivery_method.length; | |
| 347 | + delivery_method[index] = []; | |
| 348 | + delivery_method[index]['id'] = data.id; | |
| 349 | + delivery_method[index]['name'] = esc_js( data.name ); | |
| 350 | + delivery_method[index]['time'] = data.time; | |
| 351 | + delivery_method[index]['charge'] = data.charge - 0; | |
| 352 | + delivery_method[index]['days'] = data.days - 0; | |
| 353 | + delivery_method[index]['nocod'] = data.nocod; | |
| 354 | + delivery_method[index]['intl'] = data.intl; | |
| 355 | + delivery_method[index]['cool_category'] = data.cool_cat - 0; | |
| 356 | + operation.disp_delivery_method(data.id); | |
| 357 | + $("#delivery_method_loading").html(''); | |
| 358 | + }).fail(function( msg ){ | |
| 359 | + $("#delivery_method_loading").html(''); | |
| 360 | + }); | |
| 361 | + return false; | |
| 362 | + }, | |
| 363 | + | |
| 364 | + update_delivery_method : function() { | |
| 365 | + if($("input[name='delivery_method_name']").val() == "") return; | |
| 366 | + | |
| 367 | + var wc_nonce = $("#wc_nonce").val(); | |
| 368 | + var _wp_http_referer = $("input[name='_wp_http_referer']").val(); | |
| 369 | + | |
| 370 | + $("#delivery_method_loading").html('<img src="<?php echo esc_url( USCES_PLUGIN_URL ); ?>/images/loading-publish.gif" />'); | |
| 371 | + var id = $("#delivery_method_name_select option:selected").val(); | |
| 372 | + var name = encodeURIComponent($("input[name='delivery_method_name']").val()); | |
| 373 | + var time = encodeURIComponent($("#delivery_method_time").val()); | |
| 374 | + var charge = $("#delivery_method_charge option:selected").val(); | |
| 375 | + var days = $("#delivery_method_days option:selected").val(); | |
| 376 | + var nocod = ($(':input[name=delivery_method_nocod]').prop('checked')) ? '1' : '0'; | |
| 377 | + var intl = $(':radio[name=delivery_method_intl]:checked').val(); | |
| 378 | + var cool_cat = $("#delivery_cool_category option:selected").val(); | |
| 379 | + | |
| 380 | + var s = operation.settings; | |
| 381 | + s.data = "action=shop_options_ajax&mode=update_delivery_method&name=" + name + "&id=" + id + "&timeband=" + time + "&charge=" + charge + "&days=" + days + "&nocod=" + nocod + "&intl=" + intl + "&cool_category=" + cool_cat + "&wc_nonce=" + encodeURIComponent(wc_nonce)+ "&_wp_http_referer=" + encodeURIComponent(_wp_http_referer); | |
| 382 | + $.ajax( s ).done(function( response ){ | |
| 383 | + var data = JSON.parse(response); | |
| 384 | + var id = data.id - 0; | |
| 385 | + for(var i = 0; i < delivery_method.length; i++){ | |
| 386 | + if(id === delivery_method[i]['id']){ | |
| 387 | + index = i; | |
| 388 | + break; | |
| 389 | + } | |
| 390 | + } | |
| 391 | + delivery_method[index] = []; | |
| 392 | + delivery_method[index]['id'] = id; | |
| 393 | + delivery_method[index]['name'] = esc_js( data.name ); | |
| 394 | + delivery_method[index]['time'] = data.time; | |
| 395 | + delivery_method[index]['charge'] = data.charge - 0; | |
| 396 | + delivery_method[index]['days'] = data.days - 0; | |
| 397 | + delivery_method[index]['nocod'] = data.nocod; | |
| 398 | + delivery_method[index]['intl'] = data.intl; | |
| 399 | + delivery_method[index]['cool_category'] = data.cool_category - 0; | |
| 400 | + operation.disp_delivery_method(data.id); | |
| 401 | + operation.disp_delivery_method(id); | |
| 402 | + $("#delivery_method_loading").html(''); | |
| 403 | + }).fail(function( msg ){ | |
| 404 | + $("#delivery_method_loading").html(''); | |
| 405 | + }); | |
| 406 | + return false; | |
| 407 | + }, | |
| 408 | + | |
| 409 | + delete_delivery_method : function() { | |
| 410 | + var delname = $("#delivery_method_name_select option:selected").html(); | |
| 411 | + | |
| 412 | + var wc_nonce = $("#wc_nonce").val(); | |
| 413 | + var _wp_http_referer = $("input[name='_wp_http_referer']").val(); | |
| 414 | + | |
| 415 | + if(!confirm(<?php _e( "'Are you sure of deleting the delivery method ' + delname + ' ?'", 'usces' ); ?>)) return false; | |
| 416 | + | |
| 417 | + $("#delivery_method_loading").html('<img src="<?php echo esc_url( USCES_PLUGIN_URL ); ?>/images/loading-publish.gif" />'); | |
| 418 | + var id = $("#delivery_method_name_select option:selected").val(); | |
| 419 | + | |
| 420 | + var s = operation.settings; | |
| 421 | + s.data = "action=shop_options_ajax&mode=delete_delivery_method&id=" + id + "&wc_nonce=" + encodeURIComponent(wc_nonce)+ "&_wp_http_referer=" + encodeURIComponent(_wp_http_referer); | |
| 422 | + $.ajax( s ).done(function( response ){ | |
| 423 | + data = JSON.parse(response); | |
| 424 | + var id = data.id - 0; | |
| 425 | + delivery_method = delivery_method.filter(function(method) { | |
| 426 | + return method['id'] != id; | |
| 427 | + }); | |
| 428 | + operation.disp_delivery_method(0); | |
| 429 | + $("#delivery_method_loading").html(''); | |
| 430 | + }).fail(function( msg ){ | |
| 431 | + $("#delivery_method_loading").html(''); | |
| 432 | + }); | |
| 433 | + return false; | |
| 434 | + }, | |
| 435 | + | |
| 436 | + onchange_delivery_select : function(index) { | |
| 437 | + var id = $("#delivery_method_name_select option:eq("+index+")").val()-0; | |
| 438 | + operation.disp_delivery_method(id); | |
| 439 | + }, | |
| 440 | + | |
| 441 | + make_delivery_method_charge : function(selected) { | |
| 442 | + var option = '<select name="delivery_method_charge" id="delivery_method_charge">'+"\n"; | |
| 443 | + | |
| 444 | + if(selected === -1){ | |
| 445 | + option += '<option value="-1" selected="selected"><?php esc_attr_e( 'Not fixing shipping.', 'usces' ); ?></option>'+"\n"; | |
| 446 | + }else{ | |
| 447 | + option += '<option value="-1"><?php esc_attr_e( 'Not fixing shipping.', 'usces' ); ?></option>'+"\n"; | |
| 448 | + } | |
| 449 | + for(var i=0; i<shipping_charge.length; i++){ | |
| 450 | + if(selected === shipping_charge[i]['id']){ | |
| 451 | + option += '<option value="'+shipping_charge[i]['id']+'" selected="selected">'+esc_js( shipping_charge[i]['name'] )+'</option>'+"\n"; | |
| 452 | + }else{ | |
| 453 | + option += '<option value="'+shipping_charge[i]['id']+'">'+esc_js( shipping_charge[i]['name'] )+'</option>'+"\n"; | |
| 454 | + } | |
| 455 | + } | |
| 456 | + option += '</select>'; | |
| 457 | + $("#delivery_method_charge_td").html(option); | |
| 458 | + }, | |
| 459 | + | |
| 460 | + make_delivery_method_days : function(selected) { | |
| 461 | + var option = '<select name="delivery_method_days" id="delivery_method_days">'+"\n"; | |
| 462 | + | |
| 463 | + if(selected === -1){ | |
| 464 | + option += '<option value="-1" selected="selected"><?php esc_attr_e( 'Delivery Date Not Specified', 'usces' ); ?></option>'+"\n"; | |
| 465 | + }else{ | |
| 466 | + option += '<option value="-1"><?php esc_attr_e( 'Delivery Date Not Specified', 'usces' ); ?></option>'+"\n"; | |
| 467 | + } | |
| 468 | + for(var i=0; i<delivery_days.length; i++){ | |
| 469 | + if(selected === delivery_days[i]['id']){ | |
| 470 | + option += '<option value="'+delivery_days[i]['id']+'" selected="selected">'+esc_js( delivery_days[i]['name'] )+'</option>'+"\n"; | |
| 471 | + }else{ | |
| 472 | + option += '<option value="'+delivery_days[i]['id']+'">'+esc_js( delivery_days[i]['name'] )+'</option>'+"\n"; | |
| 473 | + } | |
| 474 | + } | |
| 475 | + option += '</select>'; | |
| 476 | + $("#delivery_method_days_td").html(option); | |
| 477 | + }, | |
| 478 | + | |
| 479 | + make_delivery_cool_category : function(selected) { | |
| 480 | + selected = parseInt(selected); | |
| 481 | + var option = '<select name="delivery_cool_category" id="delivery_cool_category">'+"\n"; | |
| 482 | + | |
| 483 | + for(var i=0; i<cool_categories.length; i++){ | |
| 484 | + if(selected === cool_categories[i]['id']){ | |
| 485 | + option += '<option value="'+cool_categories[i]['id']+'" selected="selected">'+esc_js( cool_categories[i]['name'] )+'</option>'+"\n"; | |
| 486 | + }else{ | |
| 487 | + option += '<option value="'+cool_categories[i]['id']+'">'+esc_js( cool_categories[i]['name'] )+'</option>'+"\n"; | |
| 488 | + } | |
| 489 | + } | |
| 490 | + option += '</select>'; | |
| 491 | + $("#delivery_cool_category_td").html(option); | |
| 492 | + }, | |
| 493 | + | |
| 494 | + moveup_delivery_method : function(selected) { | |
| 495 | + var wc_nonce = $("#wc_nonce").val(); | |
| 496 | + var _wp_http_referer = $("input[name='_wp_http_referer']").val(); | |
| 497 | + | |
| 498 | + var index = 0; | |
| 499 | + for(var i=0; i<delivery_method.length; i++){ | |
| 500 | + if(selected === delivery_method[i]['id']){ | |
| 501 | + index = i; | |
| 502 | + } | |
| 503 | + } | |
| 504 | + if( 0 === index ) return; | |
| 505 | + | |
| 506 | + $("#delivery_method_loading").html('<img src="<?php echo esc_url( USCES_PLUGIN_URL ); ?>/images/loading-publish.gif" />'); | |
| 507 | + | |
| 508 | + var s = operation.settings; | |
| 509 | + s.data = "action=shop_options_ajax&mode=moveup_delivery_method&id=" + selected + "&wc_nonce=" + encodeURIComponent(wc_nonce)+ "&_wp_http_referer=" + encodeURIComponent(_wp_http_referer); | |
| 510 | + $.ajax( s ).done(function( response ){ | |
| 511 | + var data = JSON.parse(response); | |
| 512 | + var id = data.id.split(','); | |
| 513 | + var name = data.name.split(','); | |
| 514 | + var time = data.time.split(','); | |
| 515 | + var charge = data.charge.split(','); | |
| 516 | + var days = data.days.split(','); | |
| 517 | + var nocod = data.nocod.split(','); | |
| 518 | + var intl = data.intl.split(','); | |
| 519 | + var cool_cate = data.cool_category.split(','); | |
| 520 | + var selected = data.selected - 0; | |
| 521 | + var ct = delivery_method.length; | |
| 522 | + for(var i=0; i<ct; i++){ | |
| 523 | + delivery_method[i]['id'] = id[i]-0; | |
| 524 | + delivery_method[i]['name'] = esc_js( name[i] ); | |
| 525 | + delivery_method[i]['time'] = time[i]; | |
| 526 | + delivery_method[i]['charge'] = charge[i]-0; | |
| 527 | + delivery_method[i]['days'] = days[i]-0; | |
| 528 | + delivery_method[i]['nocod'] = nocod[i]; | |
| 529 | + delivery_method[i]['intl'] = intl[i]; | |
| 530 | + delivery_method[i]['cool_category'] = cool_cate[i]-0; | |
| 531 | + } | |
| 532 | + operation.disp_delivery_method(selected); | |
| 533 | + $("#delivery_method_loading").html(''); | |
| 534 | + }).fail(function( msg ){ | |
| 535 | + $("#delivery_method_loading").html(''); | |
| 536 | + }); | |
| 537 | + return false; | |
| 538 | + }, | |
| 539 | + | |
| 540 | + movedown_delivery_method : function(selected) { | |
| 541 | + var wc_nonce = $("#wc_nonce").val(); | |
| 542 | + var _wp_http_referer = $("input[name='_wp_http_referer']").val(); | |
| 543 | + | |
| 544 | + var index = 0; | |
| 545 | + var ct = delivery_method.length; | |
| 546 | + for(var i=0; i<ct; i++){ | |
| 547 | + if(selected === delivery_method[i]['id']){ | |
| 548 | + index = i; | |
| 549 | + } | |
| 550 | + } | |
| 551 | + if( index >= ct-1 ) return; | |
| 552 | + | |
| 553 | + $("#delivery_method_loading").html('<img src="<?php echo esc_url( USCES_PLUGIN_URL ); ?>/images/loading-publish.gif" />'); | |
| 554 | + | |
| 555 | + var s = operation.settings; | |
| 556 | + s.data = "action=shop_options_ajax&mode=movedown_delivery_method&id=" + selected + "&wc_nonce=" + encodeURIComponent(wc_nonce)+ "&_wp_http_referer=" + encodeURIComponent(_wp_http_referer); | |
| 557 | + $.ajax( s ).done(function( response ){ | |
| 558 | + var data = JSON.parse(response); | |
| 559 | + var id = data.id.split(','); | |
| 560 | + var name = data.name.split(','); | |
| 561 | + var time = data.time.split(','); | |
| 562 | + var charge = data.charge.split(','); | |
| 563 | + var days = data.days.split(','); | |
| 564 | + var nocod = data.nocod.split(','); | |
| 565 | + var intl = data.intl.split(','); | |
| 566 | + var cool_cate = data.cool_category.split(','); | |
| 567 | + var selected = data.selected - 0; | |
| 568 | + var ct = delivery_method.length; | |
| 569 | + for(var i=0; i<ct; i++){ | |
| 570 | + delivery_method[i]['id'] = id[i]-0; | |
| 571 | + delivery_method[i]['name'] = esc_js( name[i] ); | |
| 572 | + delivery_method[i]['time'] = time[i]; | |
| 573 | + delivery_method[i]['charge'] = charge[i]-0; | |
| 574 | + delivery_method[i]['days'] = days[i]-0; | |
| 575 | + delivery_method[i]['nocod'] = nocod[i]; | |
| 576 | + delivery_method[i]['intl'] = intl[i]; | |
| 577 | + delivery_method[i]['cool_category'] = cool_cate[i]-0; | |
| 578 | + } | |
| 579 | + operation.disp_delivery_method(selected); | |
| 580 | + $("#delivery_method_loading").html(''); | |
| 581 | + $("#delivery_method_loading").html(''); | |
| 582 | + }); | |
| 583 | + return false; | |
| 584 | + }, | |
| 585 | + | |
| 586 | + disp_shipping_charge : function (id){ | |
| 587 | + var valuehtml = ''; | |
| 588 | + if(shipping_charge.length === 0) { | |
| 589 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 590 | + var tm = target_market[j]; | |
| 591 | + valuehtml += "<div id='shipping_charge_"+tm+"'>"; | |
| 592 | + for( var i = 0; i < pref[tm].length; i++ ) { | |
| 593 | + var p = pref[tm][i]; | |
| 594 | + valuehtml += "<div class='clearfix'><label class='shipping_charge_label'>"+p+"</label><input type='text' name=\"shipping_charge_value_"+tm+"["+p+"]\" value='' class='charge_text' /><?php usces_crcode(); ?></div>\n"; | |
| 595 | + } | |
| 596 | + valuehtml += "</div>"; | |
| 597 | + } | |
| 598 | + $("#shipping_charge_name").html('<input name="shipping_charge_name" type="text" value="" />'); | |
| 599 | + $("#shipping_charge_name2").html(''); | |
| 600 | + $("#shipping_charge_value").html(valuehtml); | |
| 601 | + $("#shipping_charge_button").html('<input name="add_shipping_charge" id="add_shipping_charge" type="button" class="button" value="<?php esc_attr_e( 'Add', 'usces' ); ?>" onclick="operation.add_shipping_charge();" />'); | |
| 602 | + }else{ | |
| 603 | + var selected = 0; | |
| 604 | + var name_select = '<select name="shipping_charge_name_select" id="shipping_charge_name_select" onchange="operation.onchange_shipping_charge(this.selectedIndex);">'+"\n"; | |
| 605 | + for(var i=0; i<shipping_charge.length; i++){ | |
| 606 | + if(shipping_charge[i]['id'] === id){ | |
| 607 | + selected = i; | |
| 608 | + name_select += '<option value="'+shipping_charge[i]['id']+'" selected="selected">'+esc_js( shipping_charge[i]['name'] )+'</option>'+"\n"; | |
| 609 | + }else{ | |
| 610 | + name_select += '<option value="'+shipping_charge[i]['id']+'">'+esc_js( shipping_charge[i]['name'] )+'</option>'+"\n"; | |
| 611 | + } | |
| 612 | + } | |
| 613 | + name_select += "</select>\n"; | |
| 614 | + var value = ''; | |
| 615 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 616 | + var tm = target_market[j]; | |
| 617 | + valuehtml += "<div id='shipping_charge_"+tm+"'>"; | |
| 618 | + for( var i = 0; i < pref[tm].length; i++ ) { | |
| 619 | + var p = pref[tm][i]; | |
| 620 | + value = ( shipping_charge[selected][tm][p] == undefined ) ? '' : shipping_charge[selected][tm][p]; | |
| 621 | + valuehtml += "<div class='clearfix'><label class='shipping_charge_label'>"+p+"</label><input type='text' name=\"shipping_charge_value_"+tm+"["+p+"]\" value='"+esc_js( value )+"' class='charge_text' /><?php usces_crcode(); ?></div>\n"; | |
| 622 | + } | |
| 623 | + valuehtml += "</div>"; | |
| 624 | + } | |
| 625 | + $("#shipping_charge_name").html(name_select); | |
| 626 | + $("#shipping_charge_name2").html('<input name="shipping_charge_name" type="text" value="'+esc_js( shipping_charge[selected]['name'] )+'" />'); | |
| 627 | + $("#shipping_charge_value").html(valuehtml); | |
| 628 | + $("#shipping_charge_button").html("<input name='delete_shipping_charge' id='delete_shipping_charge' type='button' class='button' value='<?php esc_attr_e( 'Delete', 'usces' ); ?>' onclick='operation.delete_shipping_charge();' /> <input name='update_shipping_charge' id='update_shipping_charge' type='button' class='button' value='<?php esc_attr_e( 'update', 'usces' ); ?>' onclick='operation.update_shipping_charge();' />"); | |
| 629 | + } | |
| 630 | + $(".charge_text").bind("change", function(){ usces_check_money($(this)); }); | |
| 631 | + var country = $("#shipping_charge_country option:selected").val(); | |
| 632 | + for( var i = 0; i < target_market.length; i++ ) { | |
| 633 | + if( country == target_market[i] ) { | |
| 634 | + $("#shipping_charge_"+target_market[i]).css("display",""); | |
| 635 | + } else { | |
| 636 | + $("#shipping_charge_"+target_market[i]).css("display","none"); | |
| 637 | + } | |
| 638 | + } | |
| 639 | + }, | |
| 640 | + | |
| 641 | + add_shipping_charge : function() { | |
| 642 | + var wc_nonce = $("#wc_nonce").val(); | |
| 643 | + var _wp_http_referer = $("input[name='_wp_http_referer']").val(); | |
| 644 | + | |
| 645 | + var error = 0; | |
| 646 | + if($("input[name='shipping_charge_name']").val() == "") { | |
| 647 | + error++; | |
| 648 | + $("input[name='shipping_charge_name']").css({'background-color': '#FFA'}).click(function() { | |
| 649 | + $(this).css({'background-color': '#FFF'}); | |
| 650 | + }); | |
| 651 | + } | |
| 652 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 653 | + var tm = target_market[j]; | |
| 654 | + for( var i = 0; i < pref[tm].length; i++ ) { | |
| 655 | + var p = pref[tm][i]; | |
| 656 | + var value = $("input[name=\"shipping_charge_value_"+tm+"\["+p+"\]\"]").val(); | |
| 657 | + if( "" == value || !checkMoney(value) ) { | |
| 658 | + error++; | |
| 659 | + $("input[name=\"shipping_charge_value_"+tm+"\["+p+"\]\"]").css({'background-color': '#FFA'}).click(function() { | |
| 660 | + $(this).css({'background-color': '#FFF'}); | |
| 661 | + }); | |
| 662 | + } | |
| 663 | + } | |
| 664 | + } | |
| 665 | + if( 0 < error ) { | |
| 666 | + alert("<?php esc_html_e( 'There is incomplete data.', 'usces' ); ?>"); | |
| 667 | + return false; | |
| 668 | + } | |
| 669 | + | |
| 670 | + $("#shipping_charge_loading").html('<img src="<?php echo esc_url( USCES_PLUGIN_URL ); ?>/images/loading-publish.gif" />'); | |
| 671 | + var name = encodeURIComponent($("input[name='shipping_charge_name']").val()); | |
| 672 | + var query = ''; | |
| 673 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 674 | + var tm = target_market[j]; | |
| 675 | + for( var i = 0; i < pref[tm].length; i++ ) { | |
| 676 | + query += '&value_'+tm+'[]='+$("input[name=\"shipping_charge_value_"+tm+"\["+pref[tm][i]+"\]\"]").val(); | |
| 677 | + } | |
| 678 | + } | |
| 679 | + | |
| 680 | + var s = operation.settings; | |
| 681 | + s.data = "action=shop_options_ajax&mode=add_shipping_charge&name="+name+query + "&wc_nonce=" + encodeURIComponent(wc_nonce)+ "&_wp_http_referer=" + encodeURIComponent(_wp_http_referer); | |
| 682 | + $.ajax( s ).done(function ( data ){ | |
| 683 | + var id = data - 0; | |
| 684 | + var index = shipping_charge.length; | |
| 685 | + shipping_charge[index] = []; | |
| 686 | + shipping_charge[index]['id'] = id; | |
| 687 | + shipping_charge[index]['name'] = $("input[name='shipping_charge_name']").val(); | |
| 688 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 689 | + var tm = target_market[j]; | |
| 690 | + shipping_charge[index][tm] = []; | |
| 691 | + for( var i = 0; i < pref[tm].length; i++ ) { | |
| 692 | + var p = pref[tm][i]; | |
| 693 | + shipping_charge[index][tm][p] = $("input[name=\"shipping_charge_value_"+tm+"\["+p+"\]\"]").val(); | |
| 694 | + } | |
| 695 | + } | |
| 696 | + operation.disp_shipping_charge(id); | |
| 697 | + operation.make_delivery_method_charge(get_delivery_method_charge(selected_method)); | |
| 698 | + $("#shipping_charge_loading").html(''); | |
| 699 | + | |
| 700 | + }).fail(function( msg ){ | |
| 701 | + $("#delivery_method_loading").html(''); | |
| 702 | + }); | |
| 703 | + return false; | |
| 704 | + }, | |
| 705 | + | |
| 706 | + update_shipping_charge : function() { | |
| 707 | + var wc_nonce = $("#wc_nonce").val(); | |
| 708 | + var _wp_http_referer = $("input[name='_wp_http_referer']").val(); | |
| 709 | + | |
| 710 | + var error = 0; | |
| 711 | + if($("input[name='shipping_charge_name']").val() == "") { | |
| 712 | + error++; | |
| 713 | + $("input[name='shipping_charge_name']").css({'background-color': '#FFA'}).click(function() { | |
| 714 | + $(this).css({'background-color': '#FFF'}); | |
| 715 | + }); | |
| 716 | + } | |
| 717 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 718 | + var tm = target_market[j]; | |
| 719 | + for( var i = 0; i < pref[tm].length; i++ ) { | |
| 720 | + var p = pref[tm][i]; | |
| 721 | + var value = $("input[name=\"shipping_charge_value_"+tm+"\["+p+"\]\"]").val(); | |
| 722 | + if( "" == value || !checkMoney(value) ) { | |
| 723 | + error++; | |
| 724 | + $("input[name=\"shipping_charge_value_"+tm+"\["+p+"\]\"]").css({'background-color': '#FFA'}).click(function() { | |
| 725 | + $(this).css({'background-color': '#FFF'}); | |
| 726 | + }); | |
| 727 | + } | |
| 728 | + } | |
| 729 | + } | |
| 730 | + if( 0 < error ) { | |
| 731 | + alert("<?php esc_html_e( 'There is incomplete data.', 'usces' ); ?>"); | |
| 732 | + return false; | |
| 733 | + } | |
| 734 | + | |
| 735 | + $("#shipping_charge_loading").html('<img src="<?php echo esc_url( USCES_PLUGIN_URL ); ?>/images/loading-publish.gif" />'); | |
| 736 | + var id = $("#shipping_charge_name_select option:selected").val(); | |
| 737 | + var name = encodeURIComponent($("input[name='shipping_charge_name']").val()); | |
| 738 | + var query = ''; | |
| 739 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 740 | + var tm = target_market[j]; | |
| 741 | + for( var i = 0; i < pref[tm].length; i++ ){ | |
| 742 | + query += '&value_'+tm+'[]='+$("input[name=\"shipping_charge_value_"+tm+"\["+pref[tm][i]+"\]\"]").val(); | |
| 743 | + } | |
| 744 | + } | |
| 745 | + var s = operation.settings; | |
| 746 | + <?php do_action( 'usces_action_ajax_para_update_shipping_charge' ); ?> | |
| 747 | + | |
| 748 | + s.data = "action=shop_options_ajax&mode=update_shipping_charge&id="+id+"&name="+name+query + "&wc_nonce=" + encodeURIComponent(wc_nonce)+ "&_wp_http_referer=" + encodeURIComponent(_wp_http_referer); | |
| 749 | + $.ajax( s ).done(function( data ){ | |
| 750 | + var id = data - 0; | |
| 751 | + for(var i=0; i<shipping_charge.length; i++){ | |
| 752 | + if(id === shipping_charge[i]['id']){ | |
| 753 | + index = i; | |
| 754 | + } | |
| 755 | + } | |
| 756 | + shipping_charge[index]['name'] = $("input[name='shipping_charge_name']").val(); | |
| 757 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 758 | + var tm = target_market[j]; | |
| 759 | + for( var i = 0; i < pref[tm].length; i++ ) { | |
| 760 | + var p = pref[tm][i]; | |
| 761 | + shipping_charge[index][tm][p] = $("input[name=\"shipping_charge_value_"+tm+"\["+p+"\]\"]").val(); | |
| 762 | + } | |
| 763 | + } | |
| 764 | + operation.disp_shipping_charge(id); | |
| 765 | + operation.make_delivery_method_charge(get_delivery_method_charge(selected_method)); | |
| 766 | + $("#shipping_charge_loading").html(''); | |
| 767 | + }).fail(function( msg ){ | |
| 768 | + $("#delivery_method_loading").html(''); | |
| 769 | + }); | |
| 770 | + return false; | |
| 771 | + }, | |
| 772 | + | |
| 773 | + delete_shipping_charge : function() { | |
| 774 | + var wc_nonce = $("#wc_nonce").val(); | |
| 775 | + var _wp_http_referer = $("input[name='_wp_http_referer']").val(); | |
| 776 | + | |
| 777 | + var delname = $("#shipping_charge_name_select option:selected").html(); | |
| 778 | + if(!confirm(<?php _e( "'Are you sure of deleting shipping [' + delname + ']?'", 'usces' ); ?>)) return false; | |
| 779 | + | |
| 780 | + $("#shipping_charge_loading").html('<img src="<?php echo esc_url( USCES_PLUGIN_URL ); ?>/images/loading-publish.gif" />'); | |
| 781 | + var id = $("#shipping_charge_name_select option:selected").val(); | |
| 782 | + var s = operation.settings; | |
| 783 | + s.data = "action=shop_options_ajax&mode=delete_shipping_charge&id=" + id + "&wc_nonce=" + encodeURIComponent(wc_nonce)+ "&_wp_http_referer=" + encodeURIComponent(_wp_http_referer); | |
| 784 | + $.ajax( s ).done(function( data ){ | |
| 785 | + var id = data - 0; | |
| 786 | + shipping_charge = shipping_charge.filter(function(charge) { | |
| 787 | + return charge['id'] != id; | |
| 788 | + }); | |
| 789 | + operation.disp_shipping_charge(0); | |
| 790 | + operation.make_delivery_method_charge(get_delivery_method_charge(selected_method)); | |
| 791 | + $("#shipping_charge_loading").html(''); | |
| 792 | + }).fail(function( msg ){ | |
| 793 | + $("#delivery_method_loading").html(''); | |
| 794 | + }); | |
| 795 | + return false; | |
| 796 | + }, | |
| 797 | + | |
| 798 | + onchange_shipping_charge : function(index) { | |
| 799 | + var id = $("#shipping_charge_name_select option:eq("+index+")").val()-0; | |
| 800 | + operation.disp_shipping_charge(id); | |
| 801 | + }, | |
| 802 | + | |
| 803 | + allCharge : function () { | |
| 804 | + var charge = $("#allcharge").val(); | |
| 805 | + if( charge == '' ) return; | |
| 806 | + if( confirm(<?php echo sprintf( __( "'Are you sure of setting shiping to %s' + charge + ' for all the prefecture?'", 'usces' ), esc_js( usces_crsymbol( 'return', 'js' ) ) ); ?>) ){ | |
| 807 | + var country = $("#shipping_charge_country option:selected").val(); | |
| 808 | + for( var i = 0; i < pref[country].length; i++ ) { | |
| 809 | + $("input[name=\"shipping_charge_value_"+country+"\["+pref[country][i]+"\]\"]").val(charge); | |
| 810 | + } | |
| 811 | + $("#allcharge").val(""); | |
| 812 | + } | |
| 813 | + }, | |
| 814 | + | |
| 815 | + disp_delivery_days :function (id){ | |
| 816 | + var valuehtml = ''; | |
| 817 | + if(delivery_days.length === 0) { | |
| 818 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 819 | + var tm = target_market[j]; | |
| 820 | + valuehtml += "<div id='delivery_days_"+tm+"'>"; | |
| 821 | + for( var i = 0; i < pref[tm].length; i++ ) { | |
| 822 | + var p = pref[tm][i]; | |
| 823 | + valuehtml += "<div class='clearfix'><label class='delivery_days_label'>"+p+"</label><input type='text' name=\"delivery_days_value_"+tm+"["+p+"]\" value='' class='charge_text' /><?php esc_html_e( 'day', 'usces' ); ?></div>\n"; | |
| 824 | + } | |
| 825 | + valuehtml += "</div>"; | |
| 826 | + } | |
| 827 | + $("#delivery_days_name").html('<input name="delivery_days_name" type="text" value="" />'); | |
| 828 | + $("#delivery_days_name2").html(''); | |
| 829 | + $("#delivery_days_value").html(valuehtml); | |
| 830 | + $("#delivery_days_button").html('<input name="add_delivery_days" id="add_delivery_days" type="button" class="button" value="<?php esc_attr_e( 'Add', 'usces' ); ?>" onclick="operation.add_delivery_days();" />'); | |
| 831 | + }else{ | |
| 832 | + var selected = 0; | |
| 833 | + var name_select = '<select name="delivery_days_name_select" id="delivery_days_name_select" onchange="operation.onchange_delivery_days(this.selectedIndex);">'+"\n"; | |
| 834 | + for(var i=0; i<delivery_days.length; i++){ | |
| 835 | + if(delivery_days[i]['id'] === id){ | |
| 836 | + selected = i; | |
| 837 | + name_select += '<option value="'+delivery_days[i]['id']+'" selected="selected">'+esc_js( delivery_days[i]['name'] )+'</option>'+"\n"; | |
| 838 | + }else{ | |
| 839 | + name_select += '<option value="'+delivery_days[i]['id']+'">'+esc_js( delivery_days[i]['name'] )+'</option>'+"\n"; | |
| 840 | + } | |
| 841 | + } | |
| 842 | + name_select += "</select>\n"; | |
| 843 | + var value = ''; | |
| 844 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 845 | + var tm = target_market[j]; | |
| 846 | + valuehtml += "<div id='delivery_days_"+tm+"'>"; | |
| 847 | + for( var i = 0; i < pref[tm].length; i++ ) { | |
| 848 | + var p = pref[tm][i]; | |
| 849 | + value = ( delivery_days[selected][tm][p] == undefined ) ? '' : delivery_days[selected][tm][p]; | |
| 850 | + valuehtml += "<div class='clearfix'><label class='delivery_days_label'>"+p+"</label><input type='text' name=\"delivery_days_value_"+tm+"["+p+"]\" value='"+esc_js( value )+"' class='charge_text' /><?php esc_html_e( 'day', 'usces' ); ?></div>\n"; | |
| 851 | + } | |
| 852 | + valuehtml += "</div>"; | |
| 853 | + } | |
| 854 | + $("#delivery_days_name").html(name_select); | |
| 855 | + $("#delivery_days_name2").html('<input name="delivery_days_name" type="text" value="'+esc_js( delivery_days[selected]['name'] )+'" />'); | |
| 856 | + $("#delivery_days_value").html(valuehtml); | |
| 857 | + $("#delivery_days_button").html("<input name='delete_delivery_days' id='delete_delivery_days' type='button' class='button' value='<?php esc_attr_e( 'Delete', 'usces' ); ?>' onclick='operation.delete_delivery_days();' /> <input name='update_delivery_days' id='update_delivery_days' type='button' class='button' value='<?php esc_attr_e( 'update', 'usces' ); ?>' onclick='operation.update_delivery_days();' />"); | |
| 858 | + } | |
| 859 | + $(".days_text").bind("change", function(){ usces_check_num($(this)); }); | |
| 860 | + var country = $("#delivery_days_country option:selected").val(); | |
| 861 | + for( var i = 0; i < target_market.length; i++ ) { | |
| 862 | + if( country == target_market[i] ) { | |
| 863 | + $("#delivery_days_"+target_market[i]).css("display",""); | |
| 864 | + } else { | |
| 865 | + $("#delivery_days_"+target_market[i]).css("display","none"); | |
| 866 | + } | |
| 867 | + } | |
| 868 | + }, | |
| 869 | + | |
| 870 | + add_delivery_days : function() { | |
| 871 | + var wc_nonce = $("#wc_nonce").val(); | |
| 872 | + var _wp_http_referer = $("input[name='_wp_http_referer']").val(); | |
| 873 | + | |
| 874 | + var error = 0; | |
| 875 | + if($("input[name='delivery_days_name']").val() == "") { | |
| 876 | + error++; | |
| 877 | + $("input[name='delivery_days_name']").css({'background-color': '#FFA'}).click(function() { | |
| 878 | + $(this).css({'background-color': '#FFF'}); | |
| 879 | + }); | |
| 880 | + } | |
| 881 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 882 | + var tm = target_market[j]; | |
| 883 | + for( var i = 0; i < pref[tm].length; i++ ) { | |
| 884 | + var p = pref[tm][i]; | |
| 885 | + var value = $("input[name=\"delivery_days_value_"+tm+"\["+p+"\]\"]").val(); | |
| 886 | + if( "" == value || !checkNum(value) ) { | |
| 887 | + error++; | |
| 888 | + $("input[name=\"delivery_days_value_"+tm+"\["+p+"\]\"]").css({'background-color': '#FFA'}).click(function() { | |
| 889 | + $(this).css({'background-color': '#FFF'}); | |
| 890 | + }); | |
| 891 | + } | |
| 892 | + } | |
| 893 | + } | |
| 894 | + if( 0 < error ) { | |
| 895 | + alert("<?php esc_html_e( 'There is incomplete data.', 'usces' ); ?>"); | |
| 896 | + return false; | |
| 897 | + } | |
| 898 | + | |
| 899 | + $("#delivery_days_loading").html('<img src="<?php echo esc_url( USCES_PLUGIN_URL ); ?>/images/loading-publish.gif" />'); | |
| 900 | + var name = $("input[name='delivery_days_name']").val(); | |
| 901 | + var query = ''; | |
| 902 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 903 | + var tm = target_market[j]; | |
| 904 | + for( var i = 0; i < pref[tm].length; i++ ) { | |
| 905 | + query += '&value_'+tm+'[]='+$("input[name=\"delivery_days_value_"+tm+"\["+pref[tm][i]+"\]\"]").val(); | |
| 906 | + } | |
| 907 | + } | |
| 908 | + | |
| 909 | + var s = operation.settings; | |
| 910 | + s.data = "action=shop_options_ajax&mode=add_delivery_days&name="+name+query + "&wc_nonce=" + encodeURIComponent(wc_nonce)+ "&_wp_http_referer=" + encodeURIComponent(_wp_http_referer); | |
| 911 | + $.ajax( s ).done(function( data ){ | |
| 912 | + var id = data - 0; | |
| 913 | + var index = delivery_days.length; | |
| 914 | + delivery_days[index] = []; | |
| 915 | + delivery_days[index]['id'] = id; | |
| 916 | + delivery_days[index]['name'] = $("input[name='delivery_days_name']").val(); | |
| 917 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 918 | + var tm = target_market[j]; | |
| 919 | + delivery_days[index][tm] = []; | |
| 920 | + for( var i = 0; i < pref[tm].length; i++ ) { | |
| 921 | + var p = pref[tm][i]; | |
| 922 | + delivery_days[index][tm][p] = $("input[name=\"delivery_days_value_"+tm+"\["+p+"\]\"]").val(); | |
| 923 | + } | |
| 924 | + } | |
| 925 | + operation.disp_delivery_days(id); | |
| 926 | + operation.make_delivery_method_days(get_delivery_method_days(selected_method)); | |
| 927 | + $("#delivery_days_loading").html(''); | |
| 928 | + }).fail(function( msg ){ | |
| 929 | + $("#delivery_method_loading").html(''); | |
| 930 | + }); | |
| 931 | + return false; | |
| 932 | + }, | |
| 933 | + | |
| 934 | + update_delivery_days : function() { | |
| 935 | + var wc_nonce = $("#wc_nonce").val(); | |
| 936 | + var _wp_http_referer = $("input[name='_wp_http_referer']").val(); | |
| 937 | + | |
| 938 | + var error = 0; | |
| 939 | + if($("input[name='delivery_days_name']").val() == "") { | |
| 940 | + error++; | |
| 941 | + $("input[name='delivery_days_name']").css({'background-color': '#FFA'}).click(function() { | |
| 942 | + $(this).css({'background-color': '#FFF'}); | |
| 943 | + }); | |
| 944 | + } | |
| 945 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 946 | + var tm = target_market[j]; | |
| 947 | + for( var i = 0; i < pref[tm].length; i++ ) { | |
| 948 | + var p = pref[tm][i]; | |
| 949 | + var value = $("input[name=\"delivery_days_value_"+tm+"\["+p+"\]\"]").val(); | |
| 950 | + if( "" == value || !checkNum(value) ) { | |
| 951 | + error++; | |
| 952 | + $("input[name=\"delivery_days_value_"+tm+"\["+p+"\]\"]").css({'background-color': '#FFA'}).click(function() { | |
| 953 | + $(this).css({'background-color': '#FFF'}); | |
| 954 | + }); | |
| 955 | + } | |
| 956 | + } | |
| 957 | + } | |
| 958 | + if( 0 < error ) { | |
| 959 | + alert("<?php esc_html_e( 'There is incomplete data.', 'usces' ); ?>"); | |
| 960 | + return false; | |
| 961 | + } | |
| 962 | + | |
| 963 | + $("#delivery_days_loading").html('<img src="<?php echo esc_url( USCES_PLUGIN_URL ); ?>/images/loading-publish.gif" />'); | |
| 964 | + var id = $("#delivery_days_name_select option:selected").val(); | |
| 965 | + var name = $("input[name='delivery_days_name']").val(); | |
| 966 | + var query = ''; | |
| 967 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 968 | + var tm = target_market[j]; | |
| 969 | + for( var i = 0; i < pref[tm].length; i++ ){ | |
| 970 | + query += '&value_'+tm+'[]='+$("input[name=\"delivery_days_value_"+tm+"\["+pref[tm][i]+"\]\"]").val(); | |
| 971 | + } | |
| 972 | + } | |
| 973 | + var s = operation.settings; | |
| 974 | + s.data = "action=shop_options_ajax&mode=update_delivery_days&id="+id+"&name="+name+query + "&wc_nonce=" + encodeURIComponent(wc_nonce)+ "&_wp_http_referer=" + encodeURIComponent(_wp_http_referer); | |
| 975 | + $.ajax( s ).done(function( data ){ | |
| 976 | + var id = data - 0; | |
| 977 | + for(var i=0; i<delivery_days.length; i++){ | |
| 978 | + if(id === delivery_days[i]['id']){ | |
| 979 | + index = i; | |
| 980 | + } | |
| 981 | + } | |
| 982 | + delivery_days[index]['name'] = $("input[name='delivery_days_name']").val(); | |
| 983 | + for( var j = 0; j < target_market.length; j++ ) { | |
| 984 | + var tm = target_market[j]; | |
| 985 | + for( var i = 0; i < pref[tm].length; i++ ) { | |
| 986 | + var p = pref[tm][i]; | |
| 987 | + delivery_days[index][tm][p] = $("input[name=\"delivery_days_value_"+tm+"\["+p+"\]\"]").val(); | |
| 988 | + } | |
| 989 | + } | |
| 990 | + operation.disp_delivery_days(id); | |
| 991 | + operation.make_delivery_method_days(get_delivery_method_days(selected_method)); | |
| 992 | + $("#delivery_days_loading").html(''); | |
| 993 | + }).fail(function( msg ){ | |
| 994 | + $("#delivery_method_loading").html(''); | |
| 995 | + }); | |
| 996 | + return false; | |
| 997 | + }, | |
| 998 | + | |
| 999 | + delete_delivery_days : function() { | |
| 1000 | + var wc_nonce = $("#wc_nonce").val(); | |
| 1001 | + var _wp_http_referer = $("input[name='_wp_http_referer']").val(); | |
| 1002 | + | |
| 1003 | + var delname = $("#delivery_days_name_select option:selected").html(); | |
| 1004 | + if(!confirm(<?php _e( "'Okay to Delete Delivery Days Setting ' + delname + '?'", 'usces' ); ?>)) return false; | |
| 1005 | + | |
| 1006 | + $("#delivery_days_loading").html('<img src="<?php echo esc_url( USCES_PLUGIN_URL ); ?>/images/loading-publish.gif" />'); | |
| 1007 | + var id = $("#delivery_days_name_select option:selected").val(); | |
| 1008 | + var s = operation.settings; | |
| 1009 | + s.data = "action=shop_options_ajax&mode=delete_delivery_days&id=" + id + "&wc_nonce=" + encodeURIComponent(wc_nonce)+ "&_wp_http_referer=" + encodeURIComponent(_wp_http_referer); | |
| 1010 | + $.ajax( s ).done(function( data ){ | |
| 1011 | + var id = data - 0; | |
| 1012 | + delivery_days = delivery_days.filter(function(delivery_day) { | |
| 1013 | + return delivery_day['id'] != id; | |
| 1014 | + }); | |
| 1015 | + operation.disp_delivery_days(0); | |
| 1016 | + operation.make_delivery_method_days(get_delivery_method_days(selected_method)); | |
| 1017 | + $("#delivery_days_loading").html(''); | |
| 1018 | + }).fail(function( msg ){ | |
| 1019 | + $("#delivery_method_loading").html(''); | |
| 1020 | + }); | |
| 1021 | + return false; | |
| 1022 | + }, | |
| 1023 | + | |
| 1024 | + onchange_delivery_days : function(index) { | |
| 1025 | + var id = $("#delivery_days_name_select option:eq("+index+")").val()-0; | |
| 1026 | + operation.disp_delivery_days(id); | |
| 1027 | + }, | |
| 1028 | + | |
| 1029 | + allDeliveryDays : function () { | |
| 1030 | + var days = $("#all_delivery_days").val(); | |
| 1031 | + if( days == '' ) return; | |
| 1032 | + if( confirm(<?php _e( "'Okay to Change All Delivery Days to ' + days + '?'", 'usces' ); ?>) ){ | |
| 1033 | + var country = $("#delivery_days_country option:selected").val(); | |
| 1034 | + for( var i = 0; i < pref[country].length; i++ ) { | |
| 1035 | + $("input[name=\"delivery_days_value_"+country+"\["+pref[country][i]+"\]\"]").val(days); | |
| 1036 | + } | |
| 1037 | + $("#all_delivery_days").val(""); | |
| 1038 | + } | |
| 1039 | + }, | |
| 1040 | + | |
| 1041 | + settings: { | |
| 1042 | + url: uscesL10n.requestFile, | |
| 1043 | + type: 'POST', | |
| 1044 | + cache: false, | |
| 1045 | + } | |
| 1046 | + }; | |
| 1047 | + | |
| 1048 | + $("#shipping_charge_country").change(function () { | |
| 1049 | + var country = $("#shipping_charge_country option:selected").val(); | |
| 1050 | + for( var i = 0; i < target_market.length; i++ ) { | |
| 1051 | + if( country == target_market[i] ) { | |
| 1052 | + $("#shipping_charge_"+target_market[i]).css("display",""); | |
| 1053 | + } else { | |
| 1054 | + $("#shipping_charge_"+target_market[i]).css("display","none"); | |
| 1055 | + } | |
| 1056 | + } | |
| 1057 | + }); | |
| 1058 | + | |
| 1059 | + $("#delivery_days_country").change(function () { | |
| 1060 | + var country = $("#delivery_days_country option:selected").val(); | |
| 1061 | + for( var i = 0; i < target_market.length; i++ ) { | |
| 1062 | + if( country == target_market[i] ) { | |
| 1063 | + $("#delivery_days_"+target_market[i]).css("display",""); | |
| 1064 | + } else { | |
| 1065 | + $("#delivery_days_"+target_market[i]).css("display","none"); | |
| 1066 | + } | |
| 1067 | + } | |
| 1068 | + }); | |
| 1069 | +}); | |
| 1070 | + | |
| 1071 | +jQuery(document).ready(function($){ | |
| 1072 | + operation.disp_delivery_method(-1); | |
| 1073 | + operation.disp_shipping_charge(-1); | |
| 1074 | + operation.disp_delivery_days(-1); | |
| 1075 | + | |
| 1076 | + if( $.fn.jquery < "1.10" ) { | |
| 1077 | + var $tabs = $('#uscestabs_delivery').tabs({ | |
| 1078 | + cookie: { | |
| 1079 | + // store cookie for a day, without, it would be a session cookie | |
| 1080 | + expires: 1 | |
| 1081 | + } | |
| 1082 | + }); | |
| 1083 | + } else { | |
| 1084 | + $( "#uscestabs_delivery" ).tabs({ | |
| 1085 | + active: ($.cookie("uscestabs_delivery")) ? $.cookie("uscestabs_delivery") : 0 | |
| 1086 | + , activate: function( event, ui ){ | |
| 1087 | + $.cookie("uscestabs_delivery", $(this).tabs("option", "active")); | |
| 1088 | + } | |
| 1089 | + }); | |
| 1090 | + } | |
| 1091 | +}); | |
| 1092 | +</script> | |
| 1093 | +<div class="wrap"> | |
| 1094 | +<div class="usces_admin"> | |
| 1095 | +<h1>Welcart Shop <?php esc_html_e( 'Shipping Setting', 'usces' ); ?></h1> | |
| 1096 | +<?php usces_admin_action_status(); ?> | |
| 1097 | +<p><?php esc_html_e( '* It is necessary to perform the delivery setting before than the item registration.', 'usces' ); ?><br /> | |
| 1098 | +<?php esc_html_e( '* When you performed the addition and deletion of the delivery method after item registration, please be careful because the update of all items is necessary.', 'usces' ); ?></p> | |
| 1099 | +<div id="poststuff" class="metabox-holder"> | |
| 1100 | + | |
| 1101 | +<div class="postbox"> | |
| 1102 | +<h3><?php esc_html_e( 'Shipping Setting', 'usces' ); ?></h3> | |
| 1103 | +<div class="inside"> | |
| 1104 | +<form action="" method="post" name="option_form" id="option_form"> | |
| 1105 | +<table class="form_table"> | |
| 1106 | + <tr style="height:40px;"> | |
| 1107 | + <th><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting01');"><?php esc_html_e( 'Deadline for Delivery', 'usces' ); ?></a></th> | |
| 1108 | + <td> | |
| 1109 | + <select name="delivery_time_limit[hour]"> | |
| 1110 | + <?php | |
| 1111 | + for ( $i = 0; $i < 24; $i++ ) { | |
| 1112 | + $hour = sprintf( '%02d', $i ); | |
| 1113 | + ?> | |
| 1114 | + <option value="<?php echo esc_attr( $hour ); ?>"<?php selected( $delivery_time_limit['hour'], $hour ); ?>><?php echo esc_attr( $hour ); ?></option> | |
| 1115 | + <?php | |
| 1116 | + } | |
| 1117 | + ?> | |
| 1118 | + </select> | |
| 1119 | + </td> | |
| 1120 | + <td>: </td> | |
| 1121 | + <td> | |
| 1122 | + <select name="delivery_time_limit[min]"> | |
| 1123 | + <?php | |
| 1124 | + $i = 0; | |
| 1125 | + while ( $i < 60 ) { | |
| 1126 | + $min = sprintf( '%02d', $i ); | |
| 1127 | + ?> | |
| 1128 | + <option value="<?php echo esc_attr( $min ); ?>"<?php selected( $delivery_time_limit['min'], $min ); ?>><?php echo esc_attr( $min ); ?></option> | |
| 1129 | + <?php | |
| 1130 | + $i += 10; | |
| 1131 | + } | |
| 1132 | + ?> | |
| 1133 | + </select> | |
| 1134 | + </td> | |
| 1135 | + <td><div id="ex_shipping_setting01" class="explanation"><?php esc_html_e( 'Set deadline for merchandise delivery. This number is used to calculate the earliest delivery date.', 'usces' ); ?></div></td> | |
| 1136 | + </tr> | |
| 1137 | + <tr style="height:40px;"> | |
| 1138 | + <th><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting02');"><?php esc_html_e( 'Morning Delivery Option', 'usces' ); ?></a></th> | |
| 1139 | + <td colspan="3"> | |
| 1140 | + <select name="shortest_delivery_time"> | |
| 1141 | + <option value="0"<?php selected( $shortest_delivery_time, '0' ); ?>><?php esc_html_e( 'Do Not Apply', 'usces' ); ?></option> | |
| 1142 | + <option value="1"<?php selected( $shortest_delivery_time, '1' ); ?>><?php esc_html_e( 'Morning Delivery', 'usces' ); ?></option> | |
| 1143 | + <option value="2"<?php selected( $shortest_delivery_time, '2' ); ?>><?php esc_html_e( 'No Morning Delivery', 'usces' ); ?></option> | |
| 1144 | + </select> | |
| 1145 | + </td> | |
| 1146 | + <td><div id="ex_shipping_setting02" class="explanation"><?php esc_html_e( 'Set if the merchandise can be delivered on the morning of earliest possible delivery date.', 'usces' ); ?></div></td> | |
| 1147 | + </tr> | |
| 1148 | + <tr style="height:40px;"> | |
| 1149 | + <th><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting03');"><?php esc_html_e( 'Set Delivery Dates', 'usces' ); ?></a></th> | |
| 1150 | + <td colspan="3"> | |
| 1151 | + <input name="delivery_after_days" type="text" class="charge_text" value="<?php echo esc_attr( $delivery_after_days ); ?>"> | |
| 1152 | + </td> | |
| 1153 | + <td><div id="ex_shipping_setting03" class="explanation"><?php esc_html_e( 'Set the choices of possible delivery dates for the customer.', 'usces' ); ?></div></td> | |
| 1154 | + </tr> | |
| 1155 | + <?php do_action( 'usces_action_admin_shipping_setting' ); ?> | |
| 1156 | + <tr> | |
| 1157 | + <th></th> | |
| 1158 | + <td colspan="3"> | |
| 1159 | + <input name="usces_option_update" type="submit" class="button button-primary" value="<?php esc_attr_e( 'change decision', 'usces' ); ?>" /> | |
| 1160 | + </td> | |
| 1161 | + </tr> | |
| 1162 | +</table> | |
| 1163 | +<?php wp_nonce_field( 'admin_delivery', 'wc_nonce' ); ?> | |
| 1164 | +</form> | |
| 1165 | +</div> | |
| 1166 | +</div><!--postbox--> | |
| 1167 | + | |
| 1168 | +<div class="postbox"> | |
| 1169 | +<h3><span><?php esc_html_e( 'shipping option', 'usces' ); ?></span><a style="cursor:pointer;" onclick="toggleVisibility('ex_delivery_method');"> (<?php esc_html_e( 'explanation', 'usces' ); ?>) </a></h3> | |
| 1170 | +<div class="inside"> | |
| 1171 | +<table class="form_table" style="width:290px; margin-left:10px; float:left;"> | |
| 1172 | + <tr style="height:20px;"> | |
| 1173 | + <th class="sec"> </th> | |
| 1174 | + <td><a href="javascript:void(0);" id="new_delivery_method_action"><?php esc_html_e( 'New addition', 'usces' ); ?></a></td> | |
| 1175 | + </tr> | |
| 1176 | + <tr style="height:40px;"> | |
| 1177 | + <th><?php esc_html_e( 'Shipping name', 'usces' ); ?></th> | |
| 1178 | + <td width="150" height="30" id="delivery_method_name"></td> | |
| 1179 | + </tr> | |
| 1180 | + <tr style="height:30px;"> | |
| 1181 | + <th class="sec"> </th> | |
| 1182 | + <td id="delivery_method_name2"></td> | |
| 1183 | + </tr> | |
| 1184 | + <tr style="height:30px;"> | |
| 1185 | + <th class="sec" id="delivery_method_loading"> </th> | |
| 1186 | + <td id="delivery_method_button"></td> | |
| 1187 | + </tr> | |
| 1188 | + <tr style="height:20px;"> | |
| 1189 | + <th class="sec"></th> | |
| 1190 | + <td><a href="#" id="moveup_action"><?php esc_html_e( 'Raise the priority', 'usces' ); ?></a></td> | |
| 1191 | + </tr> | |
| 1192 | + <tr style="height:20px;"> | |
| 1193 | + <th class="sec"></th> | |
| 1194 | + <td><a href="#" id="movedown_action"><?php esc_html_e( 'Lower the priority', 'usces' ); ?></a></td> | |
| 1195 | + </tr> | |
| 1196 | +</table> | |
| 1197 | + | |
| 1198 | +<table class="form_table"> | |
| 1199 | + <tr style="height:20px;"> | |
| 1200 | + <th class="sec"></th> | |
| 1201 | + <td></td> | |
| 1202 | + </tr> | |
| 1203 | + <tr style="height:40px;"> | |
| 1204 | + <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting10');"><?php esc_html_e( 'Possible Delivery Area', 'usces' ); ?></a></th> | |
| 1205 | + <td><div id="delivery_method_intl"></div></td> | |
| 1206 | + <td><div id="ex_shipping_setting10" class="explanation"><?php esc_html_e( 'Choose possible delivery area for this shipment method.', 'usces' ); ?></div></td> | |
| 1207 | + </tr> | |
| 1208 | + <tr style="height:40px;"> | |
| 1209 | + <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting12');"><?php esc_html_e( 'Deliverly time', 'usces' ); ?></a></th> | |
| 1210 | + <td><textarea name="delivery_method_time" id="delivery_method_time" style="height:100px;"></textarea></td> | |
| 1211 | + <td><div id="ex_shipping_setting12" class="explanation"><?php _e( "Input possible delivery hours. Leave it blank when the customer cannot choose delivery time. <br />example)<br />morning<br />12:00-14:00<br />14:00-16:00<br />16:00-18:00", 'usces' ); ?></div></td> | |
| 1212 | + </tr> | |
| 1213 | + <tr style="height:40px;"> | |
| 1214 | + <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting13');"><?php esc_html_e( 'Postage fixation', 'usces' ); ?></a></th> | |
| 1215 | + <td id="delivery_method_charge_td"></td> | |
| 1216 | + <td><div id="ex_shipping_setting13" class="explanation"><?php esc_html_e( "It is fixed for above rate setting when I choose postage fixation. The postage set by an article is applied in the case of 'non-fixation'.", 'usces' ); ?></div></td> | |
| 1217 | + </tr> | |
| 1218 | + <tr style="height:40px;"> | |
| 1219 | + <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting15');"><?php esc_html_e( 'Delivery Days', 'usces' ); ?></a></th> | |
| 1220 | + <td id="delivery_method_days_td"></td> | |
| 1221 | + <td><div id="ex_shipping_setting15" class="explanation"><?php esc_html_e( "Choose the Name of 'Delivery Days' registered in Delivery Days setting below. To be used to calculate the fastest delivery date. If you're not letting the customer set the delivery date, set to 'Delivery Date Not Specified'.", 'usces' ); ?></div></td> | |
| 1222 | + </tr> | |
| 1223 | + <tr style="height:40px;"> | |
| 1224 | + <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting16');"><?php esc_html_e( 'No COD', 'usces' ); ?></a></th> | |
| 1225 | + <td><div id="delivery_method_nocod"></div></td> | |
| 1226 | + <td><div id="ex_shipping_setting16" class="explanation"><?php esc_html_e( 'Check for no COD.', 'usces' ); ?></div></td> | |
| 1227 | + </tr> | |
| 1228 | + <tr style="height:40px;"> | |
| 1229 | + <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting17');"><?php esc_html_e( 'Cool Category', 'usces' ); ?></a></th> | |
| 1230 | + <td><div id="delivery_cool_category_td"></div></td> | |
| 1231 | + <td><div id="ex_shipping_setting17" class="explanation"><?php esc_html_e( 'Add cool category option to shipping method.', 'usces' ); ?></div></td> | |
| 1232 | + </tr> | |
| 1233 | +</table> | |
| 1234 | + | |
| 1235 | +<hr size="1" color="#CCCCCC" /> | |
| 1236 | +<div id="ex_delivery_method" class="explanation"><?php esc_html_e( 'Please make entry of appointment time to a party by one.', 'usces' ); ?></div> | |
| 1237 | +</div> | |
| 1238 | +</div><!--postbox--> | |
| 1239 | + | |
| 1240 | +<?php do_action( 'usces_action_admin_deliveryform' ); ?> | |
| 1241 | + | |
| 1242 | +<div class="uscestabs" id="uscestabs_delivery"> | |
| 1243 | + <ul> | |
| 1244 | + <li><a href="#delivery_page_setting_1"><?php esc_html_e( 'Shipping', 'usces' ); ?></a></li> | |
| 1245 | + <li><a href="#delivery_page_setting_2"><?php esc_html_e( 'Delivery Days', 'usces' ); ?></a></li> | |
| 1246 | + </ul> | |
| 1247 | + | |
| 1248 | +<div id="delivery_page_setting_1"> | |
| 1249 | + | |
| 1250 | +<div class="postbox"> | |
| 1251 | +<h3><span><?php esc_html_e( 'Shipping', 'usces' ); ?></span><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_charge');"> (<?php esc_html_e( 'explanation', 'usces' ); ?>) </a></h3> | |
| 1252 | +<div class="inside"> | |
| 1253 | +<table class="form_table" style="width:290px; margin-left:10px; float:left;"> | |
| 1254 | + <tr style="height:20px;"> | |
| 1255 | + <th class="sec"> </th> | |
| 1256 | + <td><a href="javascript:void(0);" id="new_shipping_charge_action"><?php esc_html_e( 'New addition', 'usces' ); ?></a></td> | |
| 1257 | + </tr> | |
| 1258 | + <tr style="height:30px;"> | |
| 1259 | + <th class="sec"><?php esc_html_e( 'Shipping charge name', 'usces' ); ?></th> | |
| 1260 | + <td width="150" height="30" id="shipping_charge_name"></td> | |
| 1261 | + </tr> | |
| 1262 | + <tr style="height:30px;"> | |
| 1263 | + <th class="sec"> </th> | |
| 1264 | + <td width="150" height="30" id="shipping_charge_name2"></td> | |
| 1265 | + </tr> | |
| 1266 | + <tr style="height:30px;"> | |
| 1267 | + <th class="sec" id="shipping_charge_loading"> </th> | |
| 1268 | + <td id="shipping_charge_button"></td> | |
| 1269 | + </tr> | |
| 1270 | +</table> | |
| 1271 | +<table class="form_table"> | |
| 1272 | + <tr style="height:20px;"> | |
| 1273 | + <th class="sec"></th> | |
| 1274 | + <td></td> | |
| 1275 | + </tr> | |
| 1276 | + <tr style="height:40px;"> | |
| 1277 | + <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_setting20');"><?php esc_html_e( 'Country', 'usces' ); ?></a></th> | |
| 1278 | + <td><label class="shipping_charge_label"></label><select name="shipping_charge_country" id="shipping_charge_country"> | |
| 1279 | + <?php usces_shipping_country_option( '' ); ?> | |
| 1280 | + </select></td> | |
| 1281 | + <td><div id="ex_shipping_setting20" class="explanation"><?php esc_html_e( 'Choose countries to apply this shipment fee.', 'usces' ); ?></div></td> | |
| 1282 | + </tr> | |
| 1283 | + <tr style="height:40px;"> | |
| 1284 | + <th class="sec"><?php esc_html_e( 'Shipping', 'usces' ); ?></th> | |
| 1285 | + <td><label class="shipping_charge_label"><input name="allbutton" type="button" class="allbutton button" onclick="operation.allCharge();" value="<?php esc_attr_e( 'same as', 'usces' ); ?>" /></label><input name="allcharge" id="allcharge" type="text" class="charge_text" /><?php usces_crcode(); ?></td> | |
| 1286 | + </tr> | |
| 1287 | + <tr> | |
| 1288 | + <th class="sec"></th> | |
| 1289 | + <td><div id="shipping_charge_value"></div></td> | |
| 1290 | + </tr> | |
| 1291 | +</table> | |
| 1292 | +<hr size="1" color="#CCCCCC" /> | |
| 1293 | +<div id="ex_shipping_charge" class="explanation"><?php esc_html_e( 'You can choose the shipping every item.', 'usces' ); ?></div> | |
| 1294 | +</div> | |
| 1295 | +</div><!--postbox--> | |
| 1296 | + | |
| 1297 | +</div><!--delivery_page_setting_1--> | |
| 1298 | +<div id="delivery_page_setting_2"> | |
| 1299 | +<div class="postbox"> | |
| 1300 | +<h3><span><?php esc_html_e( 'Delivery Days', 'usces' ); ?></span><a style="cursor:pointer;" onclick="toggleVisibility('ex_delivery_days');"> (<?php esc_html_e( 'explanation', 'usces' ); ?>) </a></h3> | |
| 1301 | +<div class="inside"> | |
| 1302 | +<table class="form_table" style="width:280px; margin-left:10px; float:left;"> | |
| 1303 | + <tr style="height:20px;"> | |
| 1304 | + <th class="sec"> </th> | |
| 1305 | + <td><a href="javascript:void(0);" id="new_delivery_days_action"><?php esc_html_e( 'New addition', 'usces' ); ?></a></td> | |
| 1306 | + </tr> | |
| 1307 | + <tr style="height:30px;"> | |
| 1308 | + <th class="sec"><?php esc_html_e( "Name of 'Delivery Days'", 'usces' ); ?></th> | |
| 1309 | + <td width="150" height="30" id="delivery_days_name"></td> | |
| 1310 | + </tr> | |
| 1311 | + <tr style="height:30px;"> | |
| 1312 | + <th class="sec"> </th> | |
| 1313 | + <td width="150" height="30" id="delivery_days_name2"></td> | |
| 1314 | + </tr> | |
| 1315 | + <tr style="height:30px;"> | |
| 1316 | + <th class="sec" id="delivery_days_loading"> </th> | |
| 1317 | + <td id="delivery_days_button"></td> | |
| 1318 | + </tr> | |
| 1319 | +</table> | |
| 1320 | +<table class="form_table"> | |
| 1321 | + <tr style="height:20px;"> | |
| 1322 | + <th class="sec"></th> | |
| 1323 | + <td></td> | |
| 1324 | + </tr> | |
| 1325 | + <tr style="height:40px;"> | |
| 1326 | + <th class="sec"><a style="cursor:pointer;" onclick="toggleVisibility('ex_delivery_days_setting20');"><?php esc_html_e( 'Country', 'usces' ); ?></a></th> | |
| 1327 | + <td><label class="shipping_charge_label"></label><select name="delivery_days_country" id="delivery_days_country"> | |
| 1328 | + <?php usces_shipping_country_option( '' ); ?> | |
| 1329 | + </select></td> | |
| 1330 | + <td><div id="ex_delivery_days_setting20" class="explanation"><?php esc_html_e( 'Choose countries to apply this Delivery Days.', 'usces' ); ?></div></td> | |
| 1331 | + </tr> | |
| 1332 | + <tr style="height:40px;"> | |
| 1333 | + <th class="sec"><?php esc_html_e( 'Delivery Days', 'usces' ); ?></th> | |
| 1334 | + <td><label class="delivery_days_label"><input name="allbutton_delivery_days" type="button" class="allbutton button" onclick="operation.allDeliveryDays();" value="<?php esc_attr_e( 'same as', 'usces' ); ?>" /></label><input name="all_delivery_days" id="all_delivery_days" type="text" class="days_text" /><?php esc_html_e( 'day', 'usces' ); ?></td> | |
| 1335 | + </tr> | |
| 1336 | + <tr> | |
| 1337 | + <th class="sec"></th> | |
| 1338 | + <td><div id="delivery_days_value"></div></td> | |
| 1339 | + </tr> | |
| 1340 | +</table> | |
| 1341 | +<hr size="1" color="#CCCCCC" /> | |
| 1342 | +<div id="ex_delivery_days" class="explanation"><?php esc_html_e( 'You can choose Delivery Days for each merchandise.', 'usces' ); ?></div> | |
| 1343 | +</div> | |
| 1344 | +</div><!--postbox--> | |
| 1345 | +</div><!--delivery_page_setting_2--> | |
| 1346 | + | |
| 1347 | +</div><!--tabs--> | |
| 1348 | + | |
| 1349 | +</div><!--poststuff--> | |
| 1350 | + | |
| 1351 | +</div><!--usces_admin--> | |
| 1352 | +</div><!--wrap--> | |