PluginProbe
Welcart e-Commerce / 1.4.12
Welcart e-Commerce v1.4.12
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
usc-e-shop / functions / template_func.php

template_func.php in Welcart e-Commerce 1.4.12, at functions/template_func.php

3,398 lines 116.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 function usces_guid_tax( $out = '' ){
3 global $usces;
4
5 if( $out == 'return' ){
6 return $usces->getGuidTax();
7 }else{
8 echo $usces->getGuidTax();
9 }
10 }
11
12 function usces_tax_label( $data = array(), $out = '' ){
13 global $usces;
14
15 if( empty($data) || !array_key_exists('order_condition', $data) ){
16 $tax_mode = $usces->options['tax_mode'];
17 }else{
18 $condition = maybe_unserialize($data['order_condition']);
19 $tax_mode = isset($condition['tax_mode']) ? $condition['tax_mode'] : $usces->options['tax_mode'];
20 }
21 if( 'exclude' == $tax_mode ){
22 $label = __('consumption tax', 'usces');
23 }else{
24 if( isset($condition['tax_mode']) && !empty($data['ID']) ){
25 $materials = array(
26 'total_items_price' => $data['order_item_total_price'],
27 'discount' => $data['order_discount'],
28 'shipping_charge' => $data['order_shipping_charge'],
29 'cod_fee' => $data['order_cod_fee'],
30 );
31 $label = __('Internal tax', 'usces') . '(' . usces_crform( usces_internal_tax( $materials, 'return' ), true, false, 'return') . ')';
32 }else{
33 $label = __('Internal tax', 'usces');
34 }
35 }
36 $label = apply_filters( 'usces_filter_tax_label', $label);
37
38 if( $out == 'return' ){
39 return $label;
40 }else{
41 echo $label;
42 }
43 }
44
45 function usces_tax( $usces_entries, $out = '' ){
46 global $usces;
47
48 if( 'exclude' == $usces->options['tax_mode'] ){
49 $tax_str = usces_crform($usces_entries['order']['tax'], true, false,'return');
50 }else{
51 $materials = array(
52 'total_items_price' => $usces_entries['order']['total_items_price'],
53 'discount' => $usces_entries['order']['discount'],
54 'shipping_charge' => $usces_entries['order']['shipping_charge'],
55 'cod_fee' => $usces_entries['order']['cod_fee'],
56 );
57 $tax_str = '(' . usces_crform(usces_internal_tax( $materials, 'return' ), true, false,'return') . ')';
58 }
59 $tax_str = apply_filters( 'usces_filter_tax', $tax_str);
60
61 if( $out == 'return' ){
62 return $tax_str;
63 }else{
64 echo $tax_str;
65 }
66 }
67
68 function usces_internal_tax( $materials, $out = '' ){
69 global $usces, $usces_settings;
70
71 if( 'products' == $usces->options['tax_target'] ){
72 $total = $materials['total_items_price'] + $materials['discount'];
73 }else{
74 $total = $materials['total_items_price'] + $materials['discount'] + $materials['shipping_charge'] + $materials['cod_fee'];
75 }
76 $total = apply_filters( 'usces_filter_internal_tax_total', $total, $materials);
77
78 $tax = $total * $usces->options['tax_rate'] / 100;
79 $tax = $total - $total / (1 + ($usces->options['tax_rate'] / 100));
80 $cr = $usces->options['system']['currency'];
81 $decimal = $usces_settings['currency'][$cr][1];
82 $decipad = (int)str_pad( '1', $decimal+1, '0', STR_PAD_RIGHT );
83 switch( $usces->options['tax_method'] ){
84 case 'cutting':
85 $tax = floor($tax*$decipad)/$decipad;
86 break;
87 case 'bring':
88 $tax = ceil($tax*$decipad)/$decipad;
89 break;
90 case 'rounding':
91 if( 0 < $decimal ){
92 $tax = round($tax, (int)$decimal);
93 }else{
94 $tax = round($tax);
95 }
96 break;
97 }
98
99 $tax = apply_filters( 'usces_filter_internal_tax', $tax, $materials);
100
101 if( $out == 'return' ){
102 return $tax;
103 }else{
104 echo $tax;
105 }
106 }
107
108 function usces_currency_symbol( $out = '' ) {
109 global $usces;
110
111 if( $out == 'return' ){
112 return $usces->getCurrencySymbol();
113 }else{
114 echo esc_html($usces->getCurrencySymbol());
115 }
116 }
117
118 function usces_is_error_message() {
119 global $usces;
120 if ( $usces->error_message != '' )
121 return true;
122 else
123 return false;
124 }
125
126 function usces_is_item( $post_id = NULL ) {
127 if( NULL == $post_id ){
128 global $post;
129 }else{
130 $post = get_post($post_id);
131 }
132 if ( isset($post->post_mime_type) && $post->post_mime_type == 'item' )
133 return true;
134 else
135 return false;
136 }
137
138 function usces_the_itemCode( $out = '' ) {
139 global $post;
140 $post_id = $post->ID;
141
142 $str = get_post_meta($post_id, '_itemCode', true);
143
144 if( $out == 'return' ){
145 return $str;
146 }else{
147 echo esc_html($str);
148 }
149 }
150
151 function usces_the_itemName( $out = '', $post = NULL ) {
152 if($post == NULL)
153 global $post;
154
155 $post_id = $post->ID;
156
157 $str = get_post_meta($post_id, '_itemName', true);
158
159 if( $out == 'return' ){
160 return $str;
161 }else{
162 echo esc_html($str);
163 }
164 }
165
166 function usces_the_point_rate( $out = '' ){
167 global $post;
168 $post_id = $post->ID;
169
170 $str = get_post_meta($post_id, '_itemPointrate', true);
171 $rate = (int)$str;
172
173 if( $out == 'return' ){
174 return $rate;
175 }else{
176 echo esc_html($rate);
177 }
178 }
179
180 function usces_the_shipment_aim( $out = '' ){
181 global $post;
182 $post_id = $post->ID;
183
184 $str = get_post_meta($post_id, '_itemShipping', true);
185 $no = (int)$str;
186 if( 0 === $no ) return;
187
188 $rules = get_option('usces_shipping_rule');
189
190 if( $out == 'return' ){
191 return $rules[$no];
192 }else{
193 echo esc_html($rules[$no]);
194 }
195 }
196
197 function usces_the_item(){
198 global $usces, $post;
199
200 $usces->itemskus = $usces->get_skus($post->ID, 'sort');
201 $usces->itemopts = usces_get_opts($post->ID, 'sort');
202
203 return;
204 }
205
206 function usces_get_itemMeta($metakey, $post_id, $out = ''){
207 $str = get_post_meta($post_id, $metakey, true);
208 $value = $str;
209
210 if( $out == 'return' ){
211 return $value;
212 }else{
213 echo esc_html($value);
214 }
215 }
216
217 function usces_sku_num() {
218 global $usces;
219
220 return count($usces->itemskus);
221 }
222
223 function usces_is_skus() {
224 global $usces;
225
226 if( 0 < count($usces->itemskus) ){
227 reset($usces->itemskus);
228 $usces->itemsku = array();
229 return true;
230 }else{
231 return false;
232 }
233 }
234
235 function usces_reset_skus() {
236 global $usces;
237
238 reset($usces->itemskus);
239 }
240
241 function usces_have_skus() {
242 global $usces;
243
244 $res_each = each($usces->itemskus);
245 $usces->itemsku = $res_each['value'];
246 if($usces->itemsku) {
247 return true;
248 } else {
249 return false;
250 }
251 }
252
253 function usces_the_itemSku($out = '') {
254 global $usces;
255
256 if($out == 'return'){
257 return $usces->itemsku['code'];
258 }else{
259 echo esc_attr($usces->itemsku['code']);
260 }
261 }
262
263 function usces_the_itemPrice($out = '') {
264 global $usces;
265 if($out == 'return'){
266 return $usces->itemsku['price'];
267 }else{
268 echo number_format($usces->itemsku['price']);
269 }
270 }
271
272 function usces_the_itemCprice($out = '') {
273 global $usces;
274 if($out == 'return'){
275 return $usces->itemsku['cprice'];
276 }else{
277 echo number_format($usces->itemsku['cprice']);
278 }
279 }
280
281 function usces_the_itemPriceCr($out = '') {
282 global $usces;
283 $res = esc_html($usces->get_currency($usces->itemsku['price'], true, false ));
284
285 if($out == 'return'){
286 return $res;
287 }else{
288 echo $res;
289 }
290 }
291
292 function usces_the_itemCpriceCr($out = '') {
293 global $usces;
294 $res = esc_html($usces->get_currency($usces->itemsku['cprice'], true, false ));
295
296 if($out == 'return'){
297 return $res;
298 }else{
299 echo $res;
300 }
301 }
302
303 function usces_crcode( $out = '' ) {
304 global $usces;
305 $res = esc_html($usces->get_currency_code());
306
307 if($out == 'return'){
308 return $res;
309 }else{
310 echo __($res, 'usces');
311 }
312 }
313
314 function usces_crsymbol( $out = '', $js = NULL ) {
315 global $usces;
316 $res = $usces->getCurrencySymbol();
317 if( 'js' === $js && '&yen;' == $res ){
318 $res = mb_convert_encoding($res, 'UTF-8', 'HTML-ENTITIES');
319 }
320
321 if($out == 'return'){
322 return $res;
323 }else{
324 echo esc_html($res);
325 }
326 }
327
328 function usces_the_itemZaiko( $out = '' ) {
329 global $usces;
330 $num = (int)$usces->itemsku['stock'];
331
332 if( 1 < $num || ( 0 === (int)$usces->itemsku['stocknum'] && !WCUtils::is_blank($usces->itemsku['stocknum']) ) ){
333 $res = $usces->zaiko_status[$num];
334 }elseif( 1 >= $num && ( 0 === (int)$usces->itemsku['stocknum'] && !WCUtils::is_blank($usces->itemsku['stocknum']) ) ){
335 $res = $usces->zaiko_status[2];
336 }else{
337 $res = $usces->zaiko_status[$num];
338 }
339
340 if( $out == 'return' ){
341 return $res;
342 }else{
343 echo esc_html($res);
344 }
345 }
346
347 function usces_the_itemZaikoStatus( $out = '' ) {
348 global $usces;
349
350 if( $out == 'return' ){
351 return usces_get_itemZaiko( 'name' );
352 }else{
353 echo esc_html(usces_get_itemZaiko( 'name' ));
354 }
355 }
356
357 function usces_get_itemZaiko( $field = 'name', $post_id=NULL, $sku=NULL ) {
358 global $usces;
359 if( empty($sku) ){
360 $num = (int)$usces->itemsku['stock'];
361 }else{
362 $skus = $usces->get_skus( $post_id, 'code' );
363 $num = (int)$skus[$sku]['stock'];
364 }
365
366 if( 'id' == $field ){
367 $res = $num;
368 }else{
369 $res = $usces->zaiko_status[$num];
370 }
371 return $res;
372 }
373
374 function usces_the_itemZaikoNum( $out = '' ) {
375 global $usces;
376 $num = $usces->itemsku['stocknum'];
377
378 if( $out == 'return' ){
379 return $num;
380 }else{
381 echo number_format($num);
382 }
383 }
384
385 function usces_the_itemSkuDisp( $out = '' ) {
386 global $usces;
387
388 if( $out == 'return' ){
389 return $usces->itemsku['name'];
390 }else{
391 echo esc_html($usces->itemsku['name']);
392 }
393 }
394
395 function usces_the_itemSkuUnit( $out = '' ) {
396 global $usces;
397
398 if( $out == 'return' ){
399 return $usces->itemsku['unit'];
400 }else{
401 echo esc_html($usces->itemsku['unit']);
402 }
403 }
404
405 function usces_the_firstSku( $out = '' ) {
406 global $post, $usces;
407 $post_id = $post->ID;
408
409
410 $skus = $usces->get_skus( $post_id );
411
412
413 if($out == 'return'){
414 return $skus[0]['code'];
415 }else{
416 echo esc_html($skus[0]['code']);
417 }
418 }
419
420 function usces_the_firstPrice( $out = '', $post = NULL ) {
421 global $usces;
422 if($post == NULL)
423 global $post;
424 $post_id = $post->ID;
425
426 $skus = $usces->get_skus( $post_id );
427
428 if($out == 'return'){
429 return $skus[0]['price'];
430 }else{
431 echo number_format($skus[0]['price']);
432 }
433 }
434
435 function usces_the_firstCprice( $out = '', $post = NULL ) {
436 global $usces;
437 if($post == NULL)
438 global $post;
439 $post_id = $post->ID;
440
441 $skus = $usces->get_skus( $post_id );
442
443 if($out == 'return'){
444 return $skus[0]['cprice'];
445 }else{
446 echo number_format($skus[0]['cprice']);
447 }
448 }
449
450 function usces_the_firstPriceCr( $out = '', $post = NULL ) {
451 global $usces;
452 if($post == NULL)
453 global $post;
454 $post_id = $post->ID;
455
456 $skus = $usces->get_skus( $post_id );
457 $res = esc_html($usces->get_currency($skus[0]['price'], true, false ));
458
459 if($out == 'return'){
460 return $res;
461 }else{
462 echo $res;
463 }
464 }
465
466 function usces_the_firstCpriceCr( $out = '', $post = NULL ) {
467 global $usces;
468 if($post == NULL)
469 global $post;
470 $post_id = $post->ID;
471
472 $skus = $usces->get_skus( $post_id );
473 $res = esc_html($usces->get_currency($skus[0]['cprice'], true, false ));
474
475 if($out == 'return'){
476 return $res;
477 }else{
478 echo $res;
479 }
480 }
481
482 function usces_the_firstZaiko( $out = '' ) {
483 global $post, $usces;
484 $post_id = $post->ID;
485
486
487 $skus = $usces->get_skus( $post_id );
488
489 if($out == 'return'){
490 return $skus[0]['stock'];
491 }else{
492 echo esc_html($skus[0]['stock']);
493 }
494 }
495
496 function usces_the_lastSku( $out = '' ) {
497 global $post, $usces;
498 $post_id = $post->ID;
499
500
501 $skus = $usces->get_skus( $post_id );
502 $sku = end($skus);
503
504 if($out == 'return'){
505 return $sku['code'];
506 }else{
507 echo esc_html($sku['code']);
508 }
509 }
510
511 function usces_the_lastPrice( $out = '' ) {
512 global $post, $usces;
513 $post_id = $post->ID;
514
515
516 $skus = $usces->get_skus( $post_id );
517 $sku = end($skus);
518
519 if($out == 'return'){
520 return $sku['price'];
521 }else{
522 echo number_format($sku['price']);
523 }
524 }
525
526 function usces_the_lastZaiko( $out = '' ) {
527 global $post, $usces;
528 $post_id = $post->ID;
529
530
531 $skus = $usces->get_skus( $post_id );
532 $sku = end($skus);
533
534 if($out == 'return'){
535 return $sku['stock'];
536 }else{
537 echo esc_html($sku['stock']);
538 }
539 }
540
541 function usces_have_zaiko(){
542 global $post, $usces;
543 return $usces->is_item_zaiko( $post->ID, $usces->itemsku['code'] );
544 }
545
546 function usces_have_zaiko_anyone( $post_id = NULL ){
547 global $post, $usces;
548 if( NULL == $post_id ) $post_id = $post->ID;
549
550 $skus = $usces->get_skus($post_id);
551 $status = false;
552 foreach($skus as $sku){
553 if( (WCUtils::is_blank($sku['stocknum']) || 0 < (int)$sku['stocknum']) && 2 > (int)$sku['stock']) {
554 $status = true;
555 break;
556 }
557 }
558 return apply_filters( 'usces_have_zaiko_anyone', $status, $post_id, $skus );
559 }
560
561 function usces_is_gptekiyo( $post_id, $sku, $quant ){
562 global $usces;
563 return $usces->is_gptekiyo( $post_id, $sku, $quant );
564 }
565 function usces_the_itemGpExp( $out = '' ) {
566 global $post, $usces;
567 $post_id = $post->ID;
568 $sku = $usces->itemsku['code'];
569 $GpN1 = $usces->getItemGpNum1($post_id);
570 $GpN2 = $usces->getItemGpNum2($post_id);
571 $GpN3 = $usces->getItemGpNum3($post_id);
572 $GpD1 = $usces->getItemGpDis1($post_id);
573 $GpD2 = $usces->getItemGpDis2($post_id);
574 $GpD3 = $usces->getItemGpDis3($post_id);
575 $unit = $usces->getItemSkuUnit($post_id, $sku);
576 $price = $usces->getItemPrice($post_id, $sku);
577
578
579 if( ($usces->itemsku['gp'] == 0) || empty($GpN1) || empty($GpD1) ){
580 return;
581 }
582 $html = "<dl class='itemGpExp'>\n<dt>" . apply_filters( 'usces_filter_itemGpExp_title', __('Business package discount','usces')) . "</dt>\n<dd>\n<ul>\n";
583 if(!empty($GpN1) && !empty($GpD1)) {
584 if(empty($GpN2) || empty($GpD2)) {
585 $html .= "<li>";
586 $html .= sprintf( __('<span class=%5$s>%1$s</span>%2$s par 1%3$s for more than %4$s%3$s', 'usces'),
587 $usces->get_currency(round($price * (100 - $GpD1) / 100), true, false ),
588 $usces->getGuidTax(),
589 esc_html($unit),
590 $GpN1,
591 "'price'"
592 );
593 $html .= "</li>\n";
594 } else {
595
596 $html .= "<li>";
597 $html .= sprintf( __('<span class=%6$s>%1$s</span>%2$s par 1%3$s for %4$s-%5$s%3$s', 'usces'),
598 $usces->get_currency(round($price * (100 - $GpD1) / 100), true, false ),
599 $usces->getGuidTax(),
600 esc_html($unit),
601 $GpN1,
602 $GpN2-1,
603 "'price'"
604 );
605 $html .= "</li>\n";
606 if(empty($GpN3) || empty($GpD3)) {
607 //$html .= "<li>" . $GpN2 . $unit . __('for more than ','usces') . "1" . $unit . __('par','usces') . "<span class='price'>" . __('$', 'usces') . number_format(round($price * (100 - $GpD2) / 100)) . $usces->getGuidTax() . "</span></li>\n";
608 $html .= "<li>";
609 $html .= sprintf( __('<span class=%5$s>%1$s</span>%2$s par 1%3$s for more than %4$s%3$s', 'usces'),
610 $usces->get_currency(round($price * (100 - $GpD2) / 100), true, false ),
611 $usces->getGuidTax(),
612 esc_html($unit),
613 $GpN2,
614 "'price'"
615 );
616 $html .= "</li>\n";
617 } else {
618 $html .= "<li>";
619 $html .= sprintf( __('<span class=%6$s>%1$s</span>%2$s par 1%3$s for %4$s-%5$s%3$s', 'usces'),
620 $usces->get_currency(round($price * (100 - $GpD2) / 100), true, false ),
621 $usces->getGuidTax(),
622 esc_html($unit),
623 $GpN2,
624 $GpN3-1,
625 "'price'"
626 );
627 $html .= "</li>\n";
628 $html .= "<li>";
629 $html .= sprintf( __('<span class=%5$s>%1$s</span>%2$s par 1%3$s for more than %4$s%3$s', 'usces'),
630 $usces->get_currency(round($price * (100 - $GpD3) / 100), true, false ),
631 $usces->getGuidTax(),
632 esc_html($unit),
633 $GpN3,
634 "'price'"
635 );
636 $html .= "</li>\n";
637 }
638 }
639 }
640 $html .= "</ul></dd></dl>";
641
642 $html = apply_filters('usces_filter_itemGpExp', $html);
643
644 if( $out == 'return' ){
645 return $html;
646 }else{
647 echo $html;
648 }
649 }
650
651 function usces_the_itemQuant( $out = '' ) {
652 global $usces, $post;
653 $post_id = $post->ID;
654 $sku = esc_attr(urlencode($usces->itemsku['code']));
655 $value = isset( $_SESSION['usces_singleitem']['quant'][$post_id][$sku] ) ? $_SESSION['usces_singleitem']['quant'][$post_id][$sku] : 1;
656 $quant = "<input name=\"quant[{$post_id}][" . $sku . "]\" type=\"text\" id=\"quant[{$post_id}][" . $sku . "]\" class=\"skuquantity\" value=\"" . $value . "\" onKeyDown=\"if (event.keyCode == 13) {return false;}\" />";
657 $html = apply_filters('usces_filter_the_itemQuant', $quant, $post);
658
659 if( $out == 'return' ){
660 return $html;
661 }else{
662 echo $html;
663 }
664 }
665
666 function usces_the_itemSkuButton($value, $type=0, $out = '') {
667 global $usces, $post;
668 $post_id = $post->ID;
669 $zaikonum = $usces->itemsku['stocknum'];
670 $zaiko_status = $usces->itemsku['stock'];
671 $gptekiyo = $usces->itemsku['gp'];
672 $skuPrice = $usces->getItemPrice($post_id, $usces->itemsku['code']);
673 $value = esc_attr(apply_filters( 'usces_filter_incart_button_label', $value));
674 $sku = esc_attr(urlencode($usces->itemsku['code']));
675
676 if($type == 1)
677 $type = 'button';
678 else
679 $type = 'submit';
680
681 $html = "<input name=\"zaikonum[{$post_id}][{$sku}]\" type=\"hidden\" id=\"zaikonum[{$post_id}][{$sku}]\" value=\"{$zaikonum}\" />\n";
682 $html .= "<input name=\"zaiko[{$post_id}][{$sku}]\" type=\"hidden\" id=\"zaiko[{$post_id}][{$sku}]\" value=\"{$zaiko_status}\" />\n";
683 $html .= "<input name=\"gptekiyo[{$post_id}][{$sku}]\" type=\"hidden\" id=\"gptekiyo[{$post_id}][{$sku}]\" value=\"{$gptekiyo}\" />\n";
684 $html .= "<input name=\"skuPrice[{$post_id}][{$sku}]\" type=\"hidden\" id=\"skuPrice[{$post_id}][{$sku}]\" value=\"{$skuPrice}\" />\n";
685 if( $usces->use_js ){
686 $html .= "<input name=\"inCart[{$post_id}][{$sku}]\" type=\"{$type}\" id=\"inCart[{$post_id}][{$sku}]\" class=\"skubutton\" value=\"{$value}\" onclick=\"return uscesCart.intoCart('{$post_id}','{$sku}')\" />";
687 }else{
688 $html .= "<a name=\"cart_button\"></a><input name=\"inCart[{$post_id}][{$sku}]\" type=\"{$type}\" id=\"inCart[{$post_id}][{$sku}]\" class=\"skubutton\" value=\"{$value}\" />";
689 }
690 $html .= "<input name=\"usces_referer\" type=\"hidden\" value=\"" . $_SERVER['REQUEST_URI'] . "\" />\n";
691 $html = apply_filters( 'usces_filter_item_sku_button', $html, $value, $type );
692
693 if( $out == 'return' ){
694 return $html;
695 }else{
696 echo $html;
697 }
698 }
699
700 function usces_direct_intoCart($post_id, $sku, $force=false, $value=NULL, $options=NULL, $out = '') {
701 global $usces;
702 if( empty($value) )
703 $value = __('Add To Cart', 'usces');
704 $skus = $usces->get_skus( $post_id, 'code' );
705 $zaikonum = $skus[$sku]['stocknum'];
706 $zaiko = $skus[$sku]['stock'];
707 $gptekiyo = $skus[$sku]['gp'];
708 $skuPrice = $skus[$sku]['price'];
709 $enc_sku = urlencode($sku);
710
711 $html = "<form action=\"" . USCES_CART_URL . "\" method=\"post\" name=\"" . $post_id."-". $enc_sku . "\">\n";
712 $html .= "<input name=\"zaikonum[{$post_id}][{$enc_sku}]\" type=\"hidden\" id=\"zaikonum[{$post_id}][{$enc_sku}]\" value=\"{$zaikonum}\" />\n";
713 $html .= "<input name=\"zaiko[{$post_id}][{$enc_sku}]\" type=\"hidden\" id=\"zaiko[{$post_id}][{$enc_sku}]\" value=\"{$zaiko}\" />\n";
714 $html .= "<input name=\"gptekiyo[{$post_id}][{$enc_sku}]\" type=\"hidden\" id=\"gptekiyo[{$post_id}][{$enc_sku}]\" value=\"{$gptekiyo}\" />\n";
715 $html .= "<input name=\"skuPrice[{$post_id}][{$enc_sku}]\" type=\"hidden\" id=\"skuPrice[{$post_id}][{$enc_sku}]\" value=\"{$skuPrice}\" />\n";
716 $html .= "<a name=\"cart_button\"></a><input name=\"inCart[{$post_id}][{$enc_sku}]\" type=\"submit\" id=\"inCart[{$post_id}][{$enc_sku}]\" class=\"skubutton\" value=\"{$value}\" " . apply_filters('usces_filter_direct_intocart_button', NULL, $post_id, $sku, $force, $options) . " />";
717 $html .= "<input name=\"usces_referer\" type=\"hidden\" value=\"" . $_SERVER['REQUEST_URI'] . "\" />\n";
718 if( $force )
719 $html .= "<input name=\"usces_force\" type=\"hidden\" value=\"incart\" />\n";
720 $html = apply_filters('usces_filter_single_item_inform', $html);
721 $html .= "</form>";
722 $html .= '<div class="direct_error_message">' . usces_singleitem_error_message($post_id, $sku, 'return') . '</div>'."\n";
723
724 if( $out == 'return' ){
725 return $html;
726 }else{
727 echo $html;
728 }
729 }
730
731
732 function usces_the_itemImage($number = 0, $width = 60, $height = 60, $post = '', $out = '', $media = 'item' ) {
733 global $usces;
734 $ptitle = $number;
735 if($post == '') global $post;
736
737 $post_id = $post->ID;
738
739 if( $ptitle && 0 == (int)$number ){
740
741 $picposts = query_posts(array('post_type'=>'attachment','name'=>$ptitle));
742 $pictid = empty($picposts) ? 0 : $picposts[0]->ID;
743 $html = wp_get_attachment_image( $pictid, array($width, $height), false );
744 if( 'item' == $media ){
745 $alt = 'alt="'.esc_attr($code[0]).'"';
746 $alt = apply_filters('usces_filter_img_alt', $alt, $post_id, $pictid, $width, $height);
747 $html = preg_replace('/alt=\"[^\"]*\"/', $alt, $html);
748 $title = 'title="'.esc_attr($name[0]).'"';
749 $title = apply_filters('usces_filter_img_title', $title, $post_id, $pictid, $width, $height);
750 $html = preg_replace('/title=\"[^\"]+\"/', $title, $html);
751 $html = apply_filters( 'usces_filter_main_img', $html, $post_id, $pictid, $width, $height);
752 }
753
754 }else{
755
756
757 $code = get_post_meta($post_id, '_itemCode', true);
758 if(!$code) return false;
759
760 $name = get_post_meta($post_id, '_itemName', true);
761
762 if( 0 == $number ){
763 $pictid = (int)$usces->get_mainpictid($code);
764 $html = wp_get_attachment_image( $pictid, array($width, $height), true );//'<img src="#" height="60" width="60" alt="" />';
765 if( 'item' == $media ){
766 $alt = 'alt="'.esc_attr($code).'"';
767 $alt = apply_filters('usces_filter_img_alt', $alt, $post_id, $pictid, $width, $height);
768 $html = preg_replace('/alt=\"[^\"]*\"/', $alt, $html);
769 $title = 'title="'.esc_attr($name).'"';
770 $title = apply_filters('usces_filter_img_title', $title, $post_id, $pictid, $width, $height);
771 $html = preg_replace('/title=\"[^\"]+\"/', $title, $html);
772 $html = apply_filters( 'usces_filter_main_img', $html, $post_id, $pictid, $width, $height);
773 }
774 }else{
775 $pictids = $usces->get_pictids($code);
776 $ind = $number - 1;
777 $pictid = ( isset($pictids[$ind]) && (int)$pictids[$ind] ) ? $pictids[$ind] : 0;
778 $html = wp_get_attachment_image( $pictid, array($width, $height), false );//'<img src="#" height="60" width="60" alt="" />';
779 if( 'item' == $media ){
780 $alt = 'alt="'.esc_attr($code).'"';
781 $alt = apply_filters('usces_filter_img_alt', $alt, $post_id, $pictid, $width, $height);
782 $html = preg_replace('/alt=\"[^\"]*\"/', $alt, $html);
783 $title = 'title="'.esc_attr($name).'"';
784 $title = apply_filters('usces_filter_img_title', $title, $post_id, $pictid, $width, $height);
785 $html = preg_replace('/title=\"[^\"]+\"/', $title, $html);
786 $html = apply_filters( 'usces_filter_sub_img', $html, $post_id, $pictid, $width, $height);
787 }
788 }
789 }
790
791 if($out == 'return'){
792 return $html;
793 }else{
794 echo $html;
795 }
796 }
797
798 function usces_the_itemImageURL($number = 0, $out = '', $post = '' ) {
799 global $usces;
800 $ptitle = $number;
801
802 if( $ptitle && is_string($number) ){
803 $picposts = query_posts(array('post_type'=>'attachment','name'=>$ptitle));
804 $pictid = empty($picposts) ? 0 : $picposts[0]->ID;
805 $pictid = $picposts[0]->ID;
806 $html = wp_get_attachment_url( $pictid );
807 }else{
808
809 if($post == '') global $post;
810 $post_id = $post->ID;
811
812 $code = get_post_meta($post_id, '_itemCode', true);
813 if(!$code) return false;
814 $name = get_post_meta($post_id, '_itemName', true);
815 if( 0 == $number ){
816 $pictid = (int)$usces->get_mainpictid($code);
817 $html = wp_get_attachment_url( $pictid );
818 }else{
819 $pictids = $usces->get_pictids($code);
820 $ind = $number - 1;
821 $pictid = ( isset($pictids[$ind]) && (int)$pictids[$ind] ) ? $pictids[$ind] : 0;
822 $html = wp_get_attachment_url( $pictid );
823 }
824 }
825
826 if($out == 'return'){
827 return $html;
828 }else{
829 echo $html;
830 }
831 }
832
833 function usces_the_itemImageCaption($number = 0, $post = '', $out = '' ) {
834 global $usces;
835 $ptitle = $number;
836
837 if( $ptitle && 0 == (int)$number ){
838
839 $picposts = query_posts(array('post_type'=>'attachment','name'=>$ptitle));
840 $excerpt = empty($picposts) ? '' : $picposts[0]->post_excerpt;
841
842 }else{
843
844 if($post == '') global $post;
845
846 $post_id = $post->ID;
847
848 $code = get_post_meta($post_id, '_itemCode', true);
849 if(!$code) return false;
850
851 $name = get_post_meta($post_id, '_itemName', true);
852
853 if( 0 == $number ){
854 $pictid = $usces->get_mainpictid($code);
855 $attach_ob = get_post($pictid);
856 }else{
857 $pictids = $usces->get_pictids($code);
858 $ind = $number - 1;
859 $attach_ob = get_post($pictids[$ind]);
860 }
861 $excerpt = $attach_ob->post_excerpt;
862 }
863
864 if($out == 'return'){
865 return $excerpt;
866 }else{
867 echo esc_html($excerpt);
868 }
869 }
870
871 function usces_the_itemImageDescription($number = 0, $post = '', $out = '' ) {
872 global $usces;
873 $ptitle = $number;
874
875 if( $ptitle && 0 == (int)$number ){
876
877 $picposts = query_posts(array('post_type'=>'attachment','name'=>$ptitle));
878 $excerpt = empty($picposts) ? '' : $picposts[0]->post_content;
879
880 }else{
881
882 if($post == '') global $post;
883
884 $post_id = $post->ID;
885
886 $code = get_post_meta($post_id, '_itemCode', true);
887 if(!$code) return false;
888
889 $name = get_post_meta($post_id, '_itemName', true);
890
891 if( 0 == $number ){
892 $pictid = $usces->get_mainpictid($code);
893 $attach_ob = get_post($pictid);
894 }else{
895 $pictids = $usces->get_pictids($code);
896 $ind = $number - 1;
897 $attach_ob = get_post($pictids[$ind]);
898 }
899 $excerpt = $attach_ob->post_content;
900 }
901
902 if($out == 'return'){
903 return $excerpt;
904 }else{
905 echo esc_html($excerpt);
906 }
907 }
908
909 function usces_get_itemSubImageNums() {
910 global $post, $usces;
911 $post_id = $post->ID;
912 $res = array();
913
914 $code = get_post_meta($post_id, '_itemCode', true);
915 if(!$code) return false;
916 $name = get_post_meta($post_id, '_itemName', true);
917 $pictids = $usces->get_pictids($code);
918 for($i=1; $i<=count($pictids); $i++){
919 $res[] = $i;
920 }
921 return $res;
922 }
923
924 function usces_is_options() {
925 global $usces;
926
927 if( 0 < count($usces->itemopts) ){
928 reset($usces->itemopts);
929 $usces->itemopt = array();
930 return true;
931 }else{
932 return false;
933 }
934 }
935
936 function usces_have_options() {
937 global $usces;
938
939 $res_each = each($usces->itemopts);
940 $usces->itemopt = $res_each['value'];
941 if($usces->itemopt) {
942 return true;
943 } else {
944 return false;
945 }
946 }
947
948 function usces_getItemOptName() {
949 global $usces;
950 return $usces->itemopt['name'];
951 }
952
953 function usces_the_itemOptName($out = '') {
954 global $usces;
955
956 if($out == 'return'){
957 return $usces->itemopt['name'];
958 }else{
959 echo esc_html($usces->itemopt['name']);
960 }
961 }
962
963 function usces_the_itemOption( $name, $label = '#default#', $out = '' ) {
964 global $post, $usces;
965 $post_id = $post->ID;
966
967 if($label == '#default#')
968 $label = $name;
969
970 $opts = usces_get_opts($post_id, 'name');
971 if(!$opts)
972 return false;
973
974 $opt = $opts[$name];
975 $means = (int)$opt['means'];
976 $essential = (int)$opt['essential'];
977
978 $html = '';
979 $sku = esc_attr(urlencode($usces->itemsku['code']));
980 $optcode = esc_attr(urlencode($name));
981 $name = esc_attr($name);
982 $label = esc_attr($label);
983 $session_value = isset( $_SESSION['usces_singleitem']['itemOption'][$post_id][$sku][$optcode] ) ? $_SESSION['usces_singleitem']['itemOption'][$post_id][$sku][$optcode] : NULL;
984 //20110715ysk start 0000208
985 $html .= "\n<label for='itemOption[{$post_id}][{$sku}][{$optcode}]' class='iopt_label'>{$label}</label>\n";
986 //20110715ysk end
987 //20100914ysk start
988 //if($means < 2){
989 switch($means) {
990 case 0://Single-select
991 case 1://Multi-select
992 //20100914ysk end
993 $selects = explode("\n", $opt['value']);
994 $multiple = ($means === 0) ? '' : ' multiple';
995 $multiple_array = ($means == 0) ? '' : '[]';//20110629ysk 0000190
996 //$html .= "\n<label for='itemOption[{$post_id}][{$sku}][{$name}]' class='iopt_label'>{$label}</label>\n";
997 //20110629ysk start 0000190
998 //$html .= "\n<select name='itemOption[{$post_id}][{$sku}][{$name}]' id='itemOption[{$post_id}][{$sku}][{$name}]' class='iopt_select'{$multiple} onKeyDown=\"if (event.keyCode == 13) {return false;}\">\n";
999 $html .= "\n<select name='itemOption[{$post_id}][{$sku}][{$optcode}]{$multiple_array}' id='itemOption[{$post_id}][{$sku}][{$optcode}]' class='iopt_select'{$multiple} onKeyDown=\"if (event.keyCode == 13) {return false;}\">\n";
1000 //20110629ysk end
1001 if($essential == 1){
1002 if( '#NONE#' == $session_value || NULL == $session_value )
1003 $selected = ' selected="selected"';
1004 else
1005 $selected = '';
1006 $html .= "\t<option value='#NONE#'{$selected}>" . __('Choose','usces') . "</option>\n";
1007 }
1008 $i=0;
1009 foreach($selects as $v) {
1010 $v = trim($v);
1011 if( ($i == 0 && $essential == 0 && NULL == $session_value) || esc_attr($v) == $session_value )
1012 $selected = ' selected="selected"';
1013 else
1014 $selected = '';
1015 $html .= "\t<option value='" . esc_attr($v) . "'{$selected}>" . esc_attr($v) . "</option>\n";
1016 $i++;
1017 }
1018 $html .= "</select>\n";
1019 //20100914ysk start
1020 //}else{
1021 break;
1022 case 2://Text
1023 //20100914ysk end
1024 $html .= "\n<input name='itemOption[{$post_id}][{$sku}][{$optcode}]' type='text' id='itemOption[{$post_id}][{$sku}][{$optcode}]' class='iopt_text' onKeyDown=\"if (event.keyCode == 13) {return false;}\" value=\"" . esc_attr($session_value) . "\" />\n";
1025 //20100914ysk start
1026 break;
1027 case 3://Radio-button
1028 $selects = explode("\n", $opt['value']);
1029
1030 $i=0;
1031 foreach($selects as $v) {
1032 $v = trim($v);
1033 if( $v == $session_value )
1034 $checked = ' checked="checked"';
1035 else
1036 $checked = '';
1037 $html .= "\t<label for='itemOption[{$post_id}][{$sku}][{$optcode}]{$i}' class='iopt_radio_label'><input name='itemOption[{$post_id}][{$sku}][{$optcode}]' id='itemOption[{$post_id}][{$sku}][{$optcode}]{$i}' class='iopt_radio' type='radio' value='" . urlencode($v) . "'{$checked}>" . esc_html($v) . "</label>\n";
1038 $i++;
1039 }
1040 break;
1041 case 4://Check-box
1042 $selects = explode("\n", $opt['value']);
1043
1044 $i=0;
1045 foreach($selects as $v) {
1046 $v = trim($v);
1047 if( $v == $session_value )
1048 $checked = ' checked="checked"';
1049 else
1050 $checked = '';
1051 $html .= "\t<label for='itemOption[{$post_id}][{$sku}][{$optcode}]{$i}' class='iopt_checkbox_label'><input name='itemOption[{$post_id}][{$sku}][{$optcode}][]' id='itemOption[{$post_id}][{$sku}][{$optcode}]{$i}' class='iopt_checkbox' type='checkbox' value='" . urlencode($v) . "'{$checked}>" . esc_html($v) . "</label><br />\n";
1052 $i++;
1053 }
1054 break;
1055 case 5://Text-area
1056 $html .= "\n<textarea name='itemOption[{$post_id}][{$sku}][{$optcode}]' id='itemOption[{$post_id}][{$sku}][{$optcode}]' class='iopt_textarea'>" . esc_attr($session_value) . "</textarea>\n";
1057 break;
1058 //20100914ysk end
1059 }
1060
1061 $html = apply_filters('usces_filter_the_itemOption', $html, $opts, $name, $label, $post_id, $usces->itemsku['code']);
1062
1063 if( $out == 'return' ){
1064 return $html;
1065 }else{
1066 echo $html;
1067 }
1068 }
1069
1070 function usces_the_cart() {
1071 global $usces;
1072
1073 $usces->display_cart();
1074
1075 }
1076
1077 function usces_is_cart() {
1078 global $usces;
1079
1080 if($usces->cart->num_row() > 0)
1081 if( apply_filters('usces_is_cart_check', true) ) {
1082 return true;
1083 }else{
1084 return false;
1085 }
1086 else
1087 return false;
1088
1089 }
1090
1091 function usces_is_category( $str ) {
1092 global $post;
1093
1094 //if( $post->post_type != 'post' ) return false;
1095
1096 $cat = get_the_category();
1097 $slugs = array();
1098 foreach($cat as $value){
1099 $slugs[] = $value->slug;
1100 }
1101
1102 $str = utf8_uri_encode($str);
1103
1104 if( in_array( $str, $slugs) )
1105 return true;
1106 else
1107 return false;
1108 }
1109
1110 function usces_the_pref( $flag, $out = '' ){
1111 global $usces;
1112
1113 $usces_members = $usces->get_member();
1114 $usces_entries = $usces->cart->get_entry();
1115 $name = esc_attr($flag) . '[pref]';
1116 $pref = $usces_entries[$flag]['pref'];
1117 if( 'member' == $flag)
1118 $pref = $usces_members['pref'];
1119
1120 $html = "<select name='" . esc_attr($name) . "' id='pref' class='pref'>\n";
1121 // $prefs = get_option('usces_pref');
1122 //20110331ysk start
1123 //$prefs = $usces->options['province'];
1124 $prefs = get_usces_states(usces_get_local_addressform());
1125 //20110331ysk end
1126 foreach($prefs as $value) {
1127 $selected = ($pref == $value) ? ' selected="selected"' : '';
1128 $html .= "\t<option value='" . esc_attr($value) . "'{$selected}>" . esc_html($value) . "</option>\n";
1129 }
1130 $html .= "</select>\n";
1131
1132 if( $out == 'return' ){
1133 return $html;
1134 }else{
1135 echo $html;
1136 }
1137 }
1138
1139 function usces_the_company_name(){
1140 global $usces;
1141 echo esc_html($usces->options['company_name']);
1142 }
1143
1144 function usces_the_zip_code(){
1145 global $usces;
1146 echo esc_html($usces->options['zip_code']);
1147 }
1148
1149 function usces_the_address1(){
1150 global $usces;
1151 echo esc_html($usces->options['address1']);
1152 }
1153
1154 function usces_the_address2(){
1155 global $usces;
1156 echo esc_html($usces->options['address2']);
1157 }
1158
1159 function usces_the_tel_number(){
1160 global $usces;
1161 echo esc_html($usces->options['tel_number']);
1162 }
1163
1164 function usces_the_fax_number(){
1165 global $usces;
1166 echo esc_html($usces->options['fax_number']);
1167 }
1168
1169 function usces_the_inquiry_mail(){
1170 global $usces;
1171 echo esc_html($usces->options['inquiry_mail']);
1172 }
1173
1174 function usces_the_postage_privilege(){
1175 global $usces;
1176 echo esc_html($usces->options['postage_privilege']);
1177 }
1178
1179 function usces_the_start_point(){
1180 global $usces;
1181 echo esc_html($usces->options['start_point']);
1182 }
1183
1184 function usces_point_rate( $post_id = NULL, $out = '' ){
1185 global $usces;
1186 if( $post_id == NULL ){
1187 $rate = $usces->options['point_rate'];
1188 }else{
1189 $str = get_post_meta($post_id, '_itemPointrate', true);
1190 $rate = (int)$str;
1191 }
1192 if( $out == 'return' ){
1193 return $rate;
1194 }else{
1195 echo $rate;
1196 }
1197 }
1198
1199 function usces_point_rate_discount( $post_id = NULL, $out = '' ) {
1200 global $post, $usces;
1201 if( $post_id == NULL )
1202 $post_id = $post->ID;
1203
1204 $str = get_post_meta( $post_id, '_itemPointrate', true );
1205 $rate = (int)$str;
1206 if( $usces->options['campaign_privilege'] == 'point' ) {
1207 if( in_category((int)$usces->options['campaign_category'], $post_id) ) {
1208 $rate *= $usces->options['privilege_point'];
1209 }
1210 }
1211 if( $out == 'return' ) {
1212 return $rate;
1213 } else {
1214 echo $rate;
1215 }
1216 }
1217
1218 function usces_get_point( $post_id, $sku_code ){
1219 global $usces;
1220 if( $post_id == NULL ){
1221 $rate = $usces->options['point_rate'];
1222 }else{
1223 $str = get_post_meta($post_id, '_itemPointrate', true);
1224 $rate = (int)$str;
1225 }
1226
1227 $skus = $usces->get_skus($post_id, 'code');
1228 $point = ceil($skus[$sku_code]['price'] * $rate / 100);
1229
1230 return $point;
1231 }
1232
1233 function usces_the_payment_method( $value = '', $out = '' ){
1234 global $usces;
1235 $payments = usces_get_system_option( 'usces_payment_method', 'sort' );
1236 $payments = apply_filters('usces_fiter_the_payment_method', $payments, $value);
1237 //if( empty($payments) ) return; 20120328ysk 0000454
1238
1239 $cart = $usces->cart->get_cart();
1240 //$charging_type = $usces->getItemChargingType($cart[0]['post_id']);
1241 $charging_type = $usces->getItemChargingType($cart[0]['post_id'], $cart);
1242 $html = "<dl>\n";
1243 $list = '';
1244 $payment_ct = count($payments);
1245 //20120328ysk start 0000454
1246 //foreach ($payments as $id => $payment) {
1247 foreach ((array)$payments as $id => $payment) {
1248 //20120328ysk end
1249 if( 'continue' == $charging_type ){
1250 //if( 'acting' != substr($payments['settlement'], 0, 6) )
1251 //20110412ysk start
1252 //if( 'acting_remise_card' != $payment['settlement'] && 'acting_paypal_ec' != $payment['settlement']) {
1253 $continue_payment_method = apply_filters( 'usces_filter_the_continue_payment_method', array( 'acting_remise_card', 'acting_paypal_ec' ) );
1254 if( !in_array( $payment['settlement'], $continue_payment_method ) ) {
1255 $payment_ct--;
1256 continue;
1257 }
1258 //if( 'on' !== $usces->options['acting_settings']['remise']['continuation'] && 'acting_remise_card' == $payment['settlement'])
1259 // continue;
1260 if( isset($usces->options['acting_settings']['remise']['continuation']) && 'on' !== $usces->options['acting_settings']['remise']['continuation'] && 'acting_remise_card' == $payment['settlement']) {
1261 $payment_ct--;
1262 continue;
1263 } elseif( isset($usces->options['acting_settings']['paypal']['continuation']) && 'on' !== $usces->options['acting_settings']['paypal']['continuation'] && 'acting_paypal_ec' == $payment['settlement']) {
1264 $payment_ct--;
1265 continue;
1266 }
1267 //20110412ysk end
1268 }
1269 if( $payment['name'] != '' and $payment['use'] != 'deactivate' ) {
1270 $module = trim($payment['module']);
1271 if( !WCUtils::is_blank($value) ){
1272 $checked = ($payment['name'] == $value) ? ' checked' : '';
1273 }else if( 1 == $payment_ct ){//0000428
1274 $checked = ' checked';
1275 }else{
1276 $checked = '';
1277 }
1278 $checked = apply_filters( 'usces_fiter_the_payment_method_checked', $checked, $payment, $value );
1279 if( (empty($module) || !file_exists($usces->options['settlement_path'] . $module)) && $payment['settlement'] == 'acting' ) {
1280 $checked = '';
1281 $list .= "\t".'<dt class="payment_'.$id.'"><label for="payment_name_' . $id . '"><input name="offer[payment_name]" id="payment_name_' . $id . '" type="radio" value="'.esc_attr($payment['name']).'"' . $checked . ' disabled onKeyDown="if (event.keyCode == 13) {return false;}" />'.esc_attr($payment['name'])."</label> <b> (" . __('cannot use this payment method now.','usces') . ") </b></dt>\n";
1282 }else{
1283 $list .= "\t".'<dt class="payment_'.$id.'"><label for="payment_name_' . $id . '"><input name="offer[payment_name]" id="payment_name_' . $id . '" type="radio" value="'.esc_attr($payment['name']).'"' . $checked . ' onKeyDown="if (event.keyCode == 13) {return false;}" />'.esc_attr($payment['name'])."</label></dt>\n";
1284 }
1285 $list .= "\t".'<dd class="payment_'.$id.'">'.$payment['explanation'].'</dd>'."\n";
1286 }
1287 }
1288
1289 $html .= $list . "</dl>\n";
1290
1291 if( empty($list) )
1292 $html = __('Not yet ready for the payment method. Please refer to a manager.', 'usces')."\n";
1293
1294 if( $out == 'return' ){
1295 return $html;
1296 }else{
1297 echo $html;
1298 }
1299 }
1300
1301 function usces_get_payments_by_name( $name ){
1302 global $usces;
1303 $payments = usces_get_system_option( 'usces_payment_method', 'name' );
1304 if( empty($payments) ) return false;
1305
1306 if( isset($payments[$name]) ) {
1307 return $payments[$name];
1308 }
1309
1310 return false;
1311 }
1312
1313 function usces_the_delivery_method( $value = '', $out = '' ){
1314 global $usces;
1315 $deli_id = apply_filters('usces_filter_get_available_delivery_method', $usces->get_available_delivery_method());
1316 if( empty($deli_id) ){
1317 $html = '<p>' . __('No valid shipping methods.', 'usces') . '</p>';
1318 }else{
1319 $cdeliid = count($deli_id);
1320 $html = '<select name="offer[delivery_method]" id="delivery_method_select" class="delivery_time" onKeyDown="if (event.keyCode == 13) {return false;}">'."\n";
1321 foreach ($deli_id as $id) {
1322 $index = $usces->get_delivery_method_index($id);
1323 $selected = ($id == $value || 1 === $cdeliid) ? ' selected="selected"' : '';
1324 $html .= "\t<option value='{$id}'{$selected}>" . esc_html($usces->options['delivery_method'][$index]['name']) . "</option>\n";
1325 }
1326
1327 $html .= "</select>\n";
1328 }
1329
1330 if( $out == 'return' ){
1331 return $html;
1332 }else{
1333 echo $html;
1334 }
1335 }
1336 //20101208ysk start
1337 function usces_the_delivery_date( $value = '', $out = '' ){
1338 global $usces;
1339
1340 $html = "<select name='offer[delivery_date]' id='delivery_date_select' class='delivery_date'>\n";
1341 $html .= "</select>\n";
1342
1343 if( $out == 'return' ){
1344 return $html;
1345 }else{
1346 echo $html;
1347 }
1348 }
1349 //20101208ysk end
1350 function usces_the_delivery_time( $value = '', $out = '' ){
1351 global $usces;
1352
1353 //20101208ysk start
1354 //$html = "<select name='offer[delivery_time]' id='delivery_time_select' class='delivery_time'>\n";
1355 $html = "<div id='delivery_time_limit_message'></div>\n";
1356 $html .= "<select name='offer[delivery_time]' id='delivery_time_select' class='delivery_time'>\n";
1357 //20101208ysk end
1358
1359 $html .= "</select>\n";
1360
1361 if( $out == 'return' ){
1362 return $html;
1363 }else{
1364 echo $html;
1365 }
1366 }
1367
1368 function usces_the_campaign_schedule($flag, $kind){
1369 global $usces;
1370 $startdate = $usces->options['campaign_schedule']['start']['year'] . __('year','usces') . $usces->options['campaign_schedule']['start']['month'] . __('month','usces') . $usces->options['campaign_schedule']['start']['day'] . __('day','usces');
1371 $starttime = $usces->options['campaign_schedule']['start']['hour'] . __('hour','usces') . $usces->options['campaign_schedule']['start']['min'] . __('min','usces');
1372 $enddate = $usces->options['campaign_schedule']['end']['year'] . __('year','usces') . $usces->options['campaign_schedule']['end']['month'] . __('month','usces') . $usces->options['campaign_schedule']['end']['day'] . __('day','usces');
1373 $endtime = $usces->options['campaign_schedule']['end']['hour'] . __('hour','usces') . $usces->options['campaign_schedule']['end']['min'] . __('min','usces');
1374 if( 'start' == $flag ) {
1375 if( 'date' == $kind ) {
1376 echo esc_html($startdate);
1377 }elseif( 'datetime' == $kind ) {
1378 echo esc_html($startdate . ' ' . $starttime);
1379 }
1380 } elseif ( 'end' == $flag ) {
1381 if( 'date' == $kind ) {
1382 echo esc_html($enddate);
1383 }elseif( 'datetime' == $kind ) {
1384 echo esc_html($enddate . ' ' . $endtime);
1385 }
1386 }
1387 }
1388
1389
1390 function usces_the_confirm() {
1391 global $usces;
1392
1393 $usces->display_cart_confirm();
1394 }
1395
1396 function usces_inquiry_condition() {
1397 global $error_message, $reserve, $inq_name, $inq_mailaddress, $inq_contents;
1398 require(USCES_PLUGIN_DIR.'/includes/inquiry_condition.php');
1399 }
1400
1401 function usces_the_inquiry_form() {
1402 global $usces;
1403 $error_message = '';
1404 if( isset($_POST['inq_name']) && !WCUtils::is_blank($_POST['inq_name']) ) {
1405 $inq_name = trim($_POST['inq_name']);
1406 }else{
1407 $inq_name = '';
1408 if($usces->page == 'deficiency')
1409 $error_message .= __('Please input your name.', 'usces') . "<br />";
1410 }
1411 if( isset($_POST['inq_mailaddress']) && is_email(trim($_POST['inq_mailaddress'])) ) {
1412 $inq_mailaddress = trim($_POST['inq_mailaddress']);
1413 }elseif( isset($_POST['inq_mailaddress']) && !is_email(trim($_POST['inq_mailaddress'])) ) {
1414 $inq_mailaddress = trim($_POST['inq_mailaddress']);
1415 if($usces->page == 'deficiency')
1416 $error_message .= __('E-mail address is not correct', 'usces') . "<br />";
1417 }else{
1418 $inq_mailaddress = '';
1419 if($usces->page == 'deficiency')
1420 $error_message .= __('Please input your e-mail address.', 'usces') . "<br />";
1421 }
1422 if( isset($_POST['inq_contents']) && !WCUtils::is_blank($_POST['inq_contents']) ) {
1423 $inq_contents = trim($_POST['inq_contents']);
1424 }else{
1425 $inq_contents = '';
1426 if($usces->page == 'deficiency')
1427 $error_message .= __('Please input contents.', 'usces');
1428 }
1429
1430
1431 if($usces->page == 'inquiry_comp') :
1432 $inq_message = apply_filters( 'usces_filter_inquiry_message_completion', __('I send a reply email to a visitor. I ask in a few minutes to be able to have you refer in there being the fear that e-mail address is different again when the email from this shop does not arrive.', 'usces') );
1433 ?>
1434 <div class="inquiry_comp"><?php _e('sending completed','usces') ?></div>
1435 <div class="compbox"><?php echo $inq_message; ?></div>
1436 <?php
1437 elseif($usces->page == 'inquiry_error') :
1438 ?>
1439 <div class="inquiry_comp"><?php _e('Failure in sending','usces') ?></div>
1440 <?php
1441 else :
1442 ?>
1443 <?php if( !empty($error_message) ): ?>
1444 <div class="error_message"><?php echo $error_message; ?></div>
1445 <?php endif; ?>
1446 <form name="inquiry_form" action="<?php //echo USCES_CART_URL; ?>" method="post">
1447 <input type="hidden" name="kakuninyou" />
1448 <table border="0" cellpadding="0" cellspacing="0" class="inquiry_table">
1449 <tr>
1450 <th scope="row"><?php _e('Full name','usces') ?></th>
1451 <td><input name="inq_name" type="text" class="inquiry_name" value="<?php echo esc_attr($inq_name); ?>" /></td>
1452 </tr>
1453 <tr>
1454 <th scope="row"><?php _e('e-mail adress','usces') ?></th>
1455 <td><input name="inq_mailaddress" type="text" class="inquiry_mailaddress" value="<?php echo esc_attr($inq_mailaddress); ?>" /></td>
1456 </tr>
1457 <tr>
1458 <th scope="row"><?php _e('contents','usces') ?></th>
1459 <td><textarea name="inq_contents" class="inquiry_contents"><?php echo esc_attr($inq_contents); ?></textarea></td>
1460 </tr>
1461 </table>
1462 <div class="send"><input name="inquiry_button" type="submit" value="<?php _e('Admit to send it with this information.','usces') ?>" /></div>
1463 </form>
1464 <?php
1465 endif;
1466 }
1467
1468 function usces_get_cat_id( $slug ) {
1469 $cat = get_category_by_slug( $slug );
1470 return $cat->term_id;
1471 }
1472
1473 function usces_the_calendar() {
1474 global $usces;
1475 include (USCES_PLUGIN_DIR . '/includes/widget_calendar.php');
1476 }
1477
1478 function usces_loginout( $out = '') {
1479 global $usces;
1480 if ( !$usces->is_member_logged_in() )
1481 $res = '<a href="' . apply_filters('usces_filter_login_uri', USCES_LOGIN_URL) . '" class="usces_login_a">' . apply_filters('usces_filter_loginlink_label', __('Log-in','usces')) . '</a>';
1482 else
1483 $res = '<a href="' . apply_filters('usces_filter_logout_uri', USCES_LOGOUT_URL) . '" class="usces_logout_a">' . apply_filters('usces_filter_logoutlink_label', __('Log out','usces')) . '</a>';
1484
1485 if( $out == 'return' ){
1486 return $res;
1487 }else{
1488 echo $res;
1489 }
1490 }
1491
1492 function usces_is_login() {
1493 global $usces;
1494
1495 if( false === $usces->is_member_logged_in() )
1496 $res = false;
1497 else
1498 $res = true;
1499
1500 return $res;
1501 }
1502
1503 function usces_the_member_name( $out = '') {
1504 global $usces;
1505 $usces->get_current_member();
1506 $res = esc_html($usces->current_member['name']);
1507 if( $out == 'return' ){
1508 return $res;
1509 }else{
1510 echo $res;
1511 }
1512
1513 }
1514
1515 function usces_the_member_point( $out = '' ) {
1516 global $usces;
1517
1518 if( !$usces->is_member_logged_in() ) return;
1519
1520 $member = $usces->get_member();
1521 if( $out == 'return' ){
1522 return $member['point'];
1523 }else{
1524 echo number_format($member['point']);
1525 }
1526 }
1527
1528 function usces_the_member_status( $out = '' ) {
1529 global $usces;
1530 if( !$usces->is_member_logged_in() ) return;
1531
1532 $usces->get_current_member();
1533 $member = $usces->get_member_info($usces->current_member['id']);
1534 $status_name = $usces->member_status[$member['mem_status']];
1535
1536 if( $out == 'return' ){
1537 return $status_name;
1538 }else{
1539 echo esc_html($status_name);
1540 }
1541 }
1542
1543 function usces_get_assistance_id_list($post_id) {
1544 global $usces;
1545 $names = $usces->get_tag_names($post_id);
1546 $list = '';
1547 foreach ( $names as $itemname )
1548 $list .= $usces->get_ID_byItemName($itemname, 'publish') . ',';
1549
1550 $list = trim($list, ',');
1551
1552 return $list;
1553 }
1554 function usces_get_assistance_ids($post_id) {
1555 global $usces;
1556 $names = $usces->get_tag_names($post_id);
1557 $ids = array();
1558 foreach ( $names as $itemname )
1559 $ids[] = $usces->get_ID_byItemName($itemname, 'publish');
1560
1561 return $ids;
1562 }
1563 function usces_remembername( $out = '' ){
1564 global $usces;
1565 $value = $usces->get_cookie();
1566
1567 if( $out == 'return' ){
1568 if(isset($value['name']))
1569 return $value['name'];
1570 else
1571 return '';
1572 }else{
1573 if(isset($value['name']))
1574 echo esc_html($value['name']);
1575 else
1576 echo '';
1577 }
1578 }
1579 function usces_rememberpass( $out = '' ){
1580 global $usces;
1581 $value = $usces->get_cookie();
1582
1583 if( $out == 'return' ){
1584 if(isset($value['pass']))
1585 return $value['pass'];
1586 else
1587 return '';
1588 }else{
1589 if(isset($value['pass']))
1590 echo esc_html($value['pass']);
1591 else
1592 echo '';
1593 }
1594 }
1595 function usces_remembercheck( $out = '' ){
1596 global $usces;
1597 $value = $usces->get_cookie();
1598
1599 if( $out == 'return' ){
1600 if(isset($value['name']) && $value['name'] != '')
1601 return ' checked="checked"';
1602 else
1603 return '';
1604 }else{
1605 if(isset($value['name']) && $value['name'] != '')
1606 echo ' checked="checked"';
1607 else
1608 echo '';
1609 }
1610 }
1611 function usces_shippingchargeTR( $index='' ) {
1612 global $usces;
1613 if($index == ""){
1614 $index = 0;
1615 }
1616 $list = '';
1617 if( !isset($usces->options['shipping_charge'][$index]) ) return;
1618 $shipping_charge = $usces->options['shipping_charge'][$index];
1619 //20120710ysk start 0000472
1620 $entry = $usces->cart->get_entry();
1621 $country = (isset($entry['delivery']['country']) && !empty($entry['delivery']['country'])) ? $entry['delivery']['country'] : $entry['customer']['country'];//20120710ysk 0000472
1622 //foreach ($shipping_charge['value'] as $pref => $value) {
1623 foreach ($shipping_charge[$country] as $pref => $value) {
1624 //20120710ysk end
1625 $list .= "<tr><th>" . esc_html($pref) . "</th>\n";
1626 $list .= "<td class='rightnum'>" . number_format($value) . "</td>\n";
1627 $list .= "</tr>\n";
1628 }
1629 echo $list;
1630 }
1631 function usces_sc_shipping_charge() {
1632 global $usces;
1633 echo esc_html($usces->sc_shipping_charge());
1634 }
1635 function usces_sc_postage_privilege() {
1636 global $usces;
1637 echo esc_html($usces->sc_postage_privilege());
1638 }
1639 function usces_sc_payment_title() {
1640 global $usces;
1641 echo $usces->sc_payment_title();
1642 }
1643
1644
1645
1646 function usces_posts_random_offset( $posts ){
1647 $ids = array();
1648 foreach( (array)$posts as $post ){
1649 $ids[] = $post->ID;
1650 }
1651 $ct = count($ids);
1652 $index = rand(0, ($ct-1));
1653 return $index;
1654 }
1655
1656 function usces_get_category_link_by_slug( $slug ){
1657 $category = get_category_by_slug($slug);
1658 echo get_category_link( $category->term_id );
1659 }
1660
1661 function usces_get_page_ID_by_pname( $post_name, $return = 'echo' ){
1662 $page = get_page_by_path( $post_name );
1663 if($return == 'return')
1664 return $page->ID;
1665 else
1666 echo $page->ID;
1667 }
1668
1669 function usces_list_bestseller($num, $days = ''){
1670 global $usces;
1671 $ids = $usces->get_bestseller_ids( $days );
1672 $htm = "";
1673 for($i=0; $i<$num; $i++){
1674 if(isset($ids[$i])){
1675 $post = get_post($ids[$i]);
1676 if( !is_object($post) )
1677 continue;
1678
1679 $disp_text = apply_filters('usces_widget_bestseller_auto_text', esc_html($post->post_title), $ids[$i]);
1680 $list = "<li><a href='" . get_permalink($ids[$i]) . "'>" . $disp_text . "</a></li>\n";
1681 $htm .= apply_filters('usces_filter_bestseller', $list, $ids[$i], $i);
1682 }
1683 }
1684 wp_reset_postdata();
1685 echo $htm;
1686 }
1687
1688 function usces_list_post( $slug, $rownum, $widget_id=NULL ){
1689 global $usces, $post;
1690 usces_remove_filter();
1691
1692 $li = '';
1693 $infolist = new wp_query( array('category_name'=>$slug, 'post_status'=>'publish', 'posts_per_page'=>$rownum, 'order'=>'DESC', 'orderby'=>'date') );
1694 if( NULL != $widget_id && $infolist->have_posts() ){
1695 remove_filter( 'excerpt_length', 'welcart_excerpt_length' );
1696 remove_filter( 'excerpt_mblength', 'welcart_excerpt_mblength' );
1697 remove_filter( 'excerpt_more', 'welcart_auto_excerpt_more' );
1698 if( function_exists('welcart_widget_post_excerpt_length_'.$widget_id) )
1699 add_filter( 'excerpt_length', 'welcart_widget_post_excerpt_length_'.$widget_id );
1700 if( function_exists('welcart_widget_post_excerpt_mblength_'.$widget_id) )
1701 add_filter( 'excerpt_mblength', 'welcart_widget_post_excerpt_mblength_'.$widget_id );
1702 }
1703 $list_index = 0;
1704 while ($infolist->have_posts()) {
1705 $infolist->the_post();
1706 $list = '<li class="post_list'. apply_filters('usces_filter_post_list_class', NULL, $list_index, count($infolist)) . '">'."\n";
1707 $list .= "<div class='title'><a href='" . get_permalink($post->ID) . "'>" . get_the_title() . "</a></div>\n";
1708 $list .= "<p>" . get_the_excerpt() . "</p>\n";
1709 $list .= "</li>\n";
1710 $li .= apply_filters( 'usces_filter_widget_post', $list, $post, $slug, $list_index);
1711 $list_index++;
1712 }
1713 wp_reset_query();
1714 usces_reset_filter();
1715 if( NULL != $widget_id && $infolist->have_posts() ){
1716 add_filter( 'excerpt_length', 'welcart_excerpt_length' );
1717 add_filter( 'excerpt_mblength', 'welcart_excerpt_mblength' );
1718 add_filter( 'excerpt_more', 'welcart_auto_excerpt_more' );
1719 }
1720 echo $li;
1721 }
1722
1723 function usces_categories_checkbox($output=''){
1724 global $usces;
1725 $retcats = apply_filters('usces_search_retcats', usces_search_categories());
1726 $parent_id = apply_filters('usces_search_categories_checkbox_parent', USCES_ITEM_CAT_PARENT_ID);
1727 $htm = usces_get_categories_checkbox($parent_id);
1728 $htm = apply_filters('usces_filter_categories_checkbox', $htm, $parent_id);
1729
1730 if($output == '' || $output == 'echo')
1731 echo $htm;
1732 else
1733 return $htm;
1734 }
1735
1736 function usces_get_categories_checkbox($parent_id){
1737 global $usces;
1738 $htm = '';
1739 $retcats = usces_search_categories();
1740 $parent_cat = get_category($parent_id);
1741 $categories = get_categories('parent='.$parent_id . "&hide_empty=0&orderby=" . $usces->options['fukugo_category_orderby'] . "&order=" . $usces->options['fukugo_category_order']);
1742 $htm .= "<fieldset class='catfield-" . $parent_cat->term_id . "'><legend>" . $parent_cat->cat_name . "</legend><ul>\n";
1743 foreach ($categories as $cat) {
1744 $children = get_categories('parent='.$cat->term_id . "&hide_empty=0");
1745 if( 0 === count($children) ){
1746 $checked = in_array($cat->term_id, $retcats) ? " checked='checked'" : "";
1747 $htm .= "<li><input name='category[".$cat->term_id."]' type='checkbox' id='category[".$cat->term_id."]' value='".$cat->term_id."'".$checked." /><label for='category[".$cat->term_id."]' class='catlabel-" . $cat->term_id . "'>".esc_html($cat->cat_name)."</label></li>\n";
1748 }
1749 }
1750 $htm .= "</ul>\n";
1751 foreach ($categories as $cat) {
1752 $children = get_categories('parent='.$cat->term_id . "&hide_empty=0");
1753 if( 0 < count($children) ){
1754 $htm .= usces_get_categories_checkbox($cat->term_id);
1755 }
1756 }
1757 $htm .= "</fieldset>\n";
1758
1759 return $htm;
1760 }
1761
1762 function usces_search_categories(){
1763 $cats = array();
1764 //if(isset($_POST['category']))
1765 // $cats = $_POST['category'];
1766 if(isset($_REQUEST['category']))
1767 $cats = $_REQUEST['category'];
1768 else
1769 $cats[] = USCES_ITEM_CAT_PARENT_ID;
1770 sort($cats);
1771 return $cats;
1772 }
1773
1774 function usces_delivery_method_name( $id, $out = '' ){
1775 global $usces;
1776
1777 if($id > -1){
1778 $id =$usces->get_delivery_method_index($id);
1779 $name = $usces->options['delivery_method'][$id]['name'];
1780 }else{
1781 $name = __('No preference','usces');
1782 }
1783
1784 if($out == 'return'){
1785 return $name;
1786 }else{
1787 echo esc_html($name);
1788 }
1789 }
1790
1791 function usces_is_membersystem_state(){
1792 global $usces;
1793
1794 if($usces->options['membersystem_state'] == 'activate') {
1795 return true;
1796 }else{
1797 return false;
1798 }
1799 }
1800
1801 function usces_is_membersystem_point(){
1802 global $usces;
1803
1804 if($usces->options['membersystem_point'] == 'activate') {
1805 return true;
1806 }else{
1807 return false;
1808 }
1809 }
1810
1811 function usces_copyright(){
1812 global $usces;
1813
1814 echo esc_html($usces->options['copyright']);
1815 }
1816
1817 function usces_totalprice_in_cart(){
1818 global $usces;
1819
1820 echo number_format($usces->get_total_price());
1821 }
1822
1823 function usces_totalquantity_in_cart(){
1824 global $usces;
1825
1826 echo number_format($usces->get_total_quantity());
1827 }
1828
1829 function usces_get_page_mode(){
1830 global $usces;
1831
1832 return $usces->page;
1833 }
1834
1835 function usces_is_cat_of_item( $cat_id ){
1836 global $usces;
1837 $ids = $usces->get_item_cat_ids();
1838 $ids[] = USCES_ITEM_CAT_PARENT_ID;
1839 if(in_array($cat_id, $ids)){
1840 return true;
1841 }else{
1842 return false;
1843 }
1844 }
1845
1846 function usces_get_item_custom( $post_id, $type = 'list', $out = '' ){
1847 global $usces;
1848 $cfields = $usces->get_post_custom($post_id);
1849 switch( $type ){
1850 case 'list':
1851 $list = '';
1852 $html = '<ul class="item_custom_field">'."\n";
1853 foreach( $cfields as $key => $value ){
1854 if( 'wccs_' == substr($key, 0, 5) ){
1855 $list .= '<li>' . esc_html(substr($key, 5)) . ' : ' . nl2br(esc_html($value[0])) . '</li>'."\n";
1856 }
1857 }
1858 if(empty($list)){
1859 $html = '';
1860 }else{
1861 $html .= $list . '</ul>'."\n";
1862 }
1863 break;
1864
1865 case 'table':
1866 $list = '';
1867 $html = '<table class="item_custom_field">'."\n";
1868 foreach($cfields as $key => $value){
1869 if( 'wccs_' == substr($key, 0, 5) ){
1870 $list .= '<tr><th>' . esc_html(substr($key, 5)) . '</th><td>' . nl2br(esc_html($value[0])) . '</td></tr>'."\n";
1871 }
1872 }
1873 if(empty($list)){
1874 $html = '';
1875 }else{
1876 $html .= $list . '</table>'."\n";
1877 }
1878 break;
1879
1880 case 'notag':
1881 $list = '';
1882 foreach($cfields as $key => $value){
1883 if( 'wccs_' == substr($key, 0, 5) ){
1884 $list .= esc_html(substr($key, 5)) . ' : ' . nl2br(esc_html($value[0])) . "\r\n";
1885 }
1886 }
1887 if(empty($list)){
1888 $html = '';
1889 }else{
1890 $html = $list;
1891 }
1892 break;
1893 }
1894 $html = apply_filters( 'usces_filter_item_custom', $html, $post_id, $type );
1895
1896 if( 'return' == $out){
1897 return $html;
1898 }else{
1899 echo $html;
1900 }
1901 }
1902
1903 function usces_settle_info_field( $order_id, $type='nl', $out='echo' ){
1904 global $usces;
1905 $str = '';
1906 $fields = $usces->get_settle_info_field( $order_id );
1907 //20101018ysk start
1908 $acting = isset($fields['acting']) ? $fields['acting'] : '';
1909 foreach($fields as $key => $value){
1910 //20101018ysk end
1911 $keys = array(
1912 'acting','order_no','tracking_no','status','error_message','money',
1913 'pay_cvs', 'pay_no1', 'pay_no2', 'pay_limit', 'error_code',
1914 'settlement_id','RECDATE','JOB_ID','S_TORIHIKI_NO','TOTAL','CENDATE',
1915 'gid', 'rst', 'ap', 'ec', 'god', 'ta', 'cv', 'no', 'cu', 'mf', 'nk', 'nkd', 'bank', 'exp', 'txn_id',
1916 'order_number',
1917 'res_tracking_id', 'res_payment_date', 'res_payinfo_key',
1918 'SID', 'DATE', 'TIME', 'CVS', 'SHNO', 'FURL', 'settltment_status', 'settltment_errmsg',
1919 'stran', 'mbtran', 'bktrans', 'tranid', 'TransactionId',
1920 'mStatus', 'vResultCode', 'orderId', 'cvsType', 'receiptNo', 'receiptDate', 'rcvAmount',
1921 'trading_id', 'payment_type', 'seq_payment_id'
1922 );
1923 $keys = apply_filters( 'usces_filter_settle_info_field_keys', $keys );
1924 if( !in_array($key, $keys) ) {
1925 continue;
1926 }
1927
1928 switch($acting){
1929 case 'zeus_bank':
1930 if( 'status' == $key){
1931 if( '01' === $value ){
1932 $value = '受付中';
1933 }elseif( '02' === $value ){
1934 $value = '未�
1935 �金';
1936 }elseif( '03' === $value ){
1937 $value = '�
1938 �金済';
1939 }elseif( '04' === $value ){
1940 $value = 'エラー';
1941 }elseif( '05' === $value ){
1942 $value = '�
1943 �金失敗';
1944 }
1945 }elseif( 'error_message' == $key){
1946 if( '0002' === $value ){
1947 $value = '�
1948 �金不足';
1949 }elseif( '0003' === $value ){
1950 $value = '過剰�
1951 �金';
1952 }
1953 }
1954 break;
1955 case 'zeus_conv':
1956 if( 'pay_cvs' == $key){
1957 $value = esc_html(usces_get_conv_name($value));
1958 }elseif( 'status' == $key){
1959 if( '01' === $value ){
1960 $value = '未�
1961 �金';
1962 }elseif( '02' === $value ){
1963 $value = '申込エラー';
1964 }elseif( '03' === $value ){
1965 $value = '期日切';
1966 }elseif( '04' === $value ){
1967 $value = '�
1968 �金済';
1969 }elseif( '05' === $value ){
1970 $value = '売上確定';
1971 }elseif( '06' === $value ){
1972 $value = '�
1973 �金取消';
1974 }elseif( '11' === $value ){
1975 $value = 'キャンセル後�
1976 �金';
1977 }elseif( '12' === $value ){
1978 $value = 'キャンセル後売上';
1979 }elseif( '13' === $value ){
1980 $value = 'キャンセル後取消';
1981 }
1982 }elseif( 'pay_limit' == $key){
1983 $value = substr($value, 0, 4).'' . substr($value, 4, 2).'' . substr($value, 6, 2).'';
1984 }
1985 break;
1986 //20101018ysk start
1987 case 'jpayment_conv':
1988 switch($key) {
1989 case 'rst':
1990 switch($value) {
1991 case '1':
1992 $value = 'OK'; break;
1993 case '2':
1994 $value = 'NG'; break;
1995 }
1996 break;
1997 case 'ap':
1998 switch($value) {
1999 case 'CPL_PRE':
2000 $value = 'コンビニペーパーレス決済識別コード'; break;
2001 case 'CPL':
2002 $value = '�
2003 �金確定'; break;
2004 case 'CVS_CAN':
2005 $value = '�
2006 �金取消'; break;
2007 }
2008 break;
2009 case 'cv':
2010 $value = esc_html(usces_get_conv_name($value));
2011 break;
2012 case 'mf':
2013 case 'nk':
2014 case 'nkd':
2015 case 'bank':
2016 case 'exp':
2017 continue;
2018 break;
2019 }
2020 break;
2021
2022 case 'jpayment_bank':
2023 switch($key) {
2024 case 'rst':
2025 switch($value) {
2026 case '1':
2027 $value = 'OK'; break;
2028 case '2':
2029 $value = 'NG'; break;
2030 }
2031 break;
2032 case 'ap':
2033 switch($value) {
2034 case 'BANK':
2035 $value = '受付完了'; break;
2036 case 'BAN_SAL':
2037 $value = '�
2038 �金完了'; break;
2039 }
2040 break;
2041 case 'mf':
2042 switch($value) {
2043 case '1':
2044 $value = 'マッチ'; break;
2045 case '2':
2046 $value = '過少'; break;
2047 case '3':
2048 $value = '過剰'; break;
2049 }
2050 break;
2051 case 'nkd':
2052 $value = substr($value, 0, 4).''.substr($value, 4, 2).''.substr($value, 6, 2).'';
2053 break;
2054 case 'exp':
2055 $value = substr($value, 0, 4).''.substr($value, 4, 2).''.substr($value, 6, 2).'';
2056 break;
2057 case 'cv':
2058 case 'no':
2059 case 'cu':
2060 continue;
2061 break;
2062 }
2063 break;
2064 //20101018ysk end
2065 //20140206ysk start
2066 case 'veritrans_conv':
2067 if( 'cvsType' == $key ) {
2068 switch( $value ) {
2069 case 'sej':
2070 $value = 'セブン-イレブン';
2071 break;
2072 case 'econ-lw':
2073 $value = 'ローソン';
2074 break;
2075 case 'econ-fm':
2076 $value = 'ファミリーマート';
2077 break;
2078 case 'econ-mini':
2079 $value = 'ミニストップ';
2080 break;
2081 case 'econ-other':
2082 $value = 'セイコーマート';
2083 break;
2084 }
2085 }
2086 break;
2087 //20140206ysk end
2088 }
2089 $value = apply_filters( 'usces_filter_settle_info_field_value', $value, $key, $acting );
2090 switch($type){
2091 case 'nl':
2092 $str .= $key . ' : ' . $value . "<br />\n";
2093 break;
2094
2095 case 'tr':
2096 $str .= '<tr><td class="label">' . $key . '</td><td>' . $value . "</td></tr>\n";
2097 break;
2098
2099 case 'li':
2100 $str .= '<li>' . $key . ' : ' . $value . "</li>\n";
2101 break;
2102 }
2103 }
2104 if( 'return' == $out){
2105 return $str;
2106 }else{
2107 echo $str;
2108 }
2109 }
2110
2111 //20100818ysk start
2112 function usces_custom_field_input( $data, $custom_field, $position, $out = '' ) {
2113
2114 $html = '';
2115 switch($custom_field) {
2116 case 'order':
2117 $label = 'custom_order';
2118 $field = 'usces_custom_order_field';
2119 break;
2120 case 'customer':
2121 $label = 'custom_customer';
2122 $field = 'usces_custom_customer_field';
2123 break;
2124 case 'delivery':
2125 $label = 'custom_delivery';
2126 $field = 'usces_custom_delivery_field';
2127 break;
2128 case 'member':
2129 $label = 'custom_member';
2130 $field = 'usces_custom_member_field';
2131 break;
2132 default:
2133 return;
2134 }
2135
2136 $meta = usces_has_custom_field_meta($custom_field);
2137
2138 if(!empty($meta) and is_array($meta)) {
2139 foreach($meta as $key => $entry) {
2140 if($custom_field == 'order' or $entry['position'] == $position) {
2141 $name = $entry['name'];
2142 $means = $entry['means'];
2143 $essential = $entry['essential'];
2144 $value = '';
2145 if(is_array($entry['value'])) {
2146 foreach($entry['value'] as $k => $v) {
2147 $value .= $v."\n";
2148 }
2149 }
2150 $value = trim($value);
2151
2152 $e = ($essential == 1) ? '<em>' . __('*', 'usces') . '</em>' : '';
2153 $html .= '
2154 <tr class="customkey_' . $key . '">
2155 <th scope="row">'.$e.esc_html($name).apply_filters('usces_filter_custom_field_input_label', NULL, $key, $entry).'</th>';
2156 $html .= apply_filters( 'usces_filter_custom_field_input_td', '<td colspan="2">', $key, $entry);
2157 switch($means) {
2158 case 0://シングルセレクト
2159 case 1://マルチセレクト
2160 $selects = explode("\n", $value);
2161 $multiple = ($means == 0) ? '' : ' multiple';
2162 $multiple_array = ($means == 0) ? '' : '[]';
2163 $html .= '<select name="'.$label.'['.esc_attr($key).']'.$multiple_array.'" class="iopt_select"'.$multiple.'>';
2164 if($essential == 1)
2165 $html .= '
2166 <option value="#NONE#">'.__('Choose','usces').'</option>';
2167 foreach($selects as $v) {
2168 $selected = (isset($data[$label][$key]) && $data[$label][$key] == $v) ? ' selected' : '';
2169 $html .= '
2170 <option value="'.esc_attr($v).'"'.$selected.'>'.esc_html($v).'</option>';
2171 }
2172 $html .= '
2173 </select>';
2174 break;
2175 case 2://テキスト
2176 $text = isset($data[$label][$key]) ? $data[$label][$key] : '';
2177 $html .= '<input type="text" name="'.$label.'['.esc_attr($key).']" value="'.esc_attr($text).'" />';
2178 break;
2179 case 3://ラジオボタン
2180 $selects = explode("\n", $value);
2181 foreach($selects as $v) {
2182 $checked = ( isset($data[$label][$key]) && $data[$label][$key] == $v) ? ' checked' : '';
2183 $html .= '
2184 <label for="'.$label.'['.esc_attr($key).']['.esc_attr($v).']" class="iopt_label"><input type="radio" name="'.$label.'['.esc_attr($key).']" id="'.$label.'['.esc_attr($key).']['.esc_attr($v).']" value="'.esc_attr($v).'"'.$checked.'>'.esc_html($v).'</label>';
2185 }
2186 break;
2187 case 4://チェックボックス
2188 $selects = explode("\n", $value);
2189 foreach($selects as $v) {
2190 if( isset($data[$label][$key]) && is_array($data[$label][$key]) ) {
2191 $checked = (isset($data[$label][$key]) && array_key_exists($v, $data[$label][$key])) ? ' checked' : '';
2192 } else {
2193 $checked = (isset($data[$label][$key]) && $data[$label][$key] == $v) ? ' checked' : '';
2194 }
2195 $html .= '
2196 <label for="'.$label.'['.esc_attr($key).']['.esc_attr($v).']" class="iopt_label"><input type="checkbox" name="'.$label.'['.esc_attr($key).']['.esc_attr($v).']" id="'.$label.'['.esc_attr($key).']['.esc_attr($v).']" value="'.esc_attr($v).'"'.$checked.'>'.esc_html($v).'</label>';
2197 }
2198 break;
2199 }
2200 $html .= apply_filters('usces_filter_custom_field_input_value', NULL, $key, $entry).'</td>';
2201 $html .= '
2202 </tr>';
2203 }
2204 }
2205 }
2206
2207 $html = apply_filters('usces_filter_custom_field_input', $html, $data, $custom_field, $position);
2208
2209 if($out == 'return') {
2210 return stripslashes($html);
2211 } else {
2212 echo stripslashes($html);
2213 }
2214 }
2215
2216 function usces_custom_field_info( $data, $custom_field, $position, $out = '' ) {
2217
2218 $html = '';
2219 switch($custom_field) {
2220 case 'order':
2221 $label = 'custom_order';
2222 $field = 'usces_custom_order_field';
2223 break;
2224 case 'customer':
2225 $label = 'custom_customer';
2226 $field = 'usces_custom_customer_field';
2227 break;
2228 case 'delivery':
2229 $label = 'custom_delivery';
2230 $field = 'usces_custom_delivery_field';
2231 break;
2232 case 'member':
2233 $label = 'custom_member';
2234 $field = 'usces_custom_member_field';
2235 break;
2236 default:
2237 return;
2238 }
2239
2240 $meta = usces_has_custom_field_meta($custom_field);
2241
2242 if(!empty($meta) and is_array($meta)) {
2243 foreach($meta as $key => $entry) {
2244 if($custom_field == 'order' or $entry['position'] == $position) {
2245 $name = $entry['name'];
2246 $means = $entry['means'];
2247
2248 $html .= '<tr>
2249 <th>'.esc_html($name).'</th>
2250 <td>';
2251 if(!empty($data[$label][$key])) {
2252 switch($means) {
2253 case 0://シングルセレクト
2254 case 2://テキスト
2255 case 3://ラジオボタン
2256 $html .= esc_html($data[$label][$key]);
2257 break;
2258 case 1://マルチセレクト
2259 case 4://チェックボックス
2260 if(is_array($data[$label][$key])) {
2261 $c = '';
2262 foreach($data[$label][$key] as $v) {
2263 $html .= $c.esc_html($v);
2264 $c = ', ';
2265 }
2266 } else {
2267 if(!empty($data[$label][$key])) $html .= esc_html($data[$label][$key]);
2268 }
2269 break;
2270 }
2271 }
2272 $html .= '
2273 </td>
2274 </tr>';
2275 }
2276 }
2277 }
2278
2279 $html = apply_filters('usces_filter_custom_field_info', $html, $data, $custom_field, $position);
2280
2281 if($out == 'return') {
2282 return stripslashes($html);
2283 } else {
2284 echo stripslashes($html);
2285 }
2286 }
2287
2288 function usces_admin_custom_field_input( $meta, $custom_field, $position, $out = '' ) {
2289
2290 $html = '';
2291 switch($custom_field) {
2292 case 'order':
2293 $label = 'custom_order';
2294 $class = '';
2295 break;
2296 case 'customer':
2297 $label = 'custom_customer';
2298 $class = ' class="col2"';
2299 break;
2300 case 'delivery':
2301 $label = 'custom_delivery';
2302 $class = ' class="col3"';
2303 break;
2304 case 'member':
2305 $label = 'custom_member';
2306 $class = '';
2307 break;
2308 default:
2309 return;
2310 }
2311
2312
2313 if(!empty($meta) and is_array($meta)) {
2314 foreach($meta as $key => $entry) {
2315 if($custom_field == 'order' or $entry['position'] == $position) {
2316 $name = $entry['name'];
2317 $means = $entry['means'];
2318 $essential = $entry['essential'];
2319 $value = '';
2320 if(is_array($entry['value'])) {
2321 foreach($entry['value'] as $k => $v) {
2322 $value .= $v."\n";
2323 }
2324 }
2325 $value = trim($value);
2326 $data = $entry['data'];
2327
2328 $html .= '
2329 <tr>
2330 <td class="label">'.esc_html($name).'</td>';
2331 switch($means) {
2332 case 0://シングルセレクト
2333 case 1://マルチセレクト
2334 $selects = explode("\n", $value);
2335 $multiple = ($means == 0) ? '' : ' multiple';
2336 $multiple_array = ($means == 0) ? '' : '[]';
2337 $html .= '
2338 <td'.$class.'>
2339 <select name="'.$label.'['.esc_attr($key).']'.$multiple_array.'" id="'.$label.'['.esc_attr($key).']" class="iopt_select"'.$multiple.'>';
2340 if($essential == 1)
2341 $html .= '
2342 <option value="#NONE#">'.__('Choose','usces').'</option>';
2343 foreach($selects as $v) {
2344 $selected = ($data == $v) ? ' selected' : '';
2345 $html .= '
2346 <option value="'.esc_attr($v).'"'.$selected.'>'.esc_html($v).'</option>';
2347 }
2348 $html .= '
2349 </select></td>';
2350 break;
2351 case 2://テキスト
2352 $html .= '
2353 <td'.$class.'><input type="text" name="'.$label.'['.esc_attr($key).']" id="'.$label.'['.esc_attr($key).']" size="30" value="'.esc_attr($data).'" /></td>';
2354 break;
2355 case 3://ラジオボタン
2356 $selects = explode("\n", $value);
2357 $html .= '
2358 <td'.$class.'>';
2359 foreach($selects as $v) {
2360 $checked = ($data == $v) ? ' checked' : '';
2361 $html .= '
2362 <input type="radio" name="'.$label.'['.esc_attr($key).']" value="'.esc_attr($v).'"'.$checked.'><label for="'.$label.'['.esc_attr($key).']['.esc_attr($v).']" class="iopt_label">'.esc_html($v).'</label>';
2363 }
2364 $html .= '
2365 </td>';
2366 break;
2367 case 4://チェックボックス
2368 $selects = explode("\n", $value);
2369 $html .= '
2370 <td'.$class.'>';
2371 foreach($selects as $v) {
2372 if(is_array($data)) {
2373 $checked = (array_key_exists($v, $data)) ? ' checked' : '';
2374 } else {
2375 $checked = ($data == $v) ? ' checked' : '';
2376 }
2377 $html .= '
2378 <input type="checkbox" name="'.$label.'['.esc_attr($key).']['.esc_attr($v).']" value="'.esc_attr($v).'"'.$checked.'><label for="'.$label.'['.esc_attr($key).']['.esc_attr($v).']" class="iopt_label">'.esc_html($v).'</label>';
2379 }
2380 $html .= '
2381 </td>';
2382 break;
2383 }
2384 $html .= '
2385 </tr>';
2386 }
2387
2388 }
2389 }
2390 $html = apply_filters( 'usces_filter_admin_custom_field_input', $html, $meta, $custom_field, $position, $out );
2391
2392 if($out == 'return') {
2393 return stripslashes($html);
2394 } else {
2395 echo stripslashes($html);
2396 }
2397 }
2398
2399 function has_custom_customer_field_essential() {
2400
2401 $mes = '';
2402 $essential = array();
2403
2404 $csmb_meta = usces_has_custom_field_meta('member');
2405 if(!empty($csmb_meta) and is_array($csmb_meta)) {
2406 foreach($csmb_meta as $key => $entry) {
2407 if($entry['essential'] == 1) {
2408 $essential[$key] = $key;
2409 }
2410 }
2411 }
2412 if(!empty($essential)) {
2413 $cscs_meta = usces_has_custom_field_meta('customer');
2414 if(!empty($cscs_meta) and is_array($cscs_meta)) {
2415 foreach($cscs_meta as $key => $entry) {
2416 if($entry['essential'] == 1) {
2417 if(!array_key_exists($key, $essential)) {
2418 if($entry['means'] == 2) {//Text
2419 $mes .= sprintf(__("Input the %s", 'usces'), esc_html($entry['name']))."<br />";
2420 } else {
2421 $mes .= sprintf(__("Chose the %s", 'usces'), esc_html($entry['name']))."<br />";
2422 }
2423 }
2424 }
2425 }
2426 }
2427 }
2428 return $mes;
2429 }
2430 //20100818ysk end
2431
2432 function usces_order_discount( $out = '' ){
2433 global $usces;
2434 $res = abs($usces->get_order_discount());
2435
2436 if($out == 'return') {
2437 return $res;
2438 } else {
2439 echo number_format($res);
2440 }
2441 }
2442
2443 function usces_item_discount( $out = '', $post_id = '', $sku = '' ){
2444 global $usces, $post;
2445
2446 if( '' == $post_id )
2447 $post_id = $post->ID;
2448 if( '' == $sku )
2449 $sku = $usces->itemsku['code'];
2450
2451 $res = $usces->getItemDiscount($post_id, $sku);
2452
2453 if($out == 'return') {
2454 return $res;
2455 } else {
2456 echo number_format($res);
2457 }
2458 }
2459
2460 function usces_singleitem_error_message($post_id, $skukey, $out = ''){
2461 if( !isset($_SESSION['usces_singleitem']['error_message'][$post_id][$skukey]) )
2462 $ret = '';
2463 else
2464 $ret = $_SESSION['usces_singleitem']['error_message'][$post_id][$skukey];
2465
2466 if($out == 'return') {
2467 return $ret;
2468 } else {
2469 echo $ret;
2470 }
2471 }
2472
2473 function usces_crform( $float, $symbol_pre = true, $symbol_post = true, $out = '', $seperator_flag = true ) {
2474 global $usces;
2475 $price = esc_html($usces->get_currency($float, $symbol_pre, $symbol_post, $seperator_flag ));
2476 $res = apply_filters('usces_filter_crform', $price, $float);
2477
2478 if($out == 'return'){
2479 return $res;
2480 }else{
2481 echo $res;
2482 }
2483 }
2484
2485 function usces_memberinfo( $key, $out = '' ){
2486 global $usces, $wpdb;
2487 $info = $usces->get_member();
2488
2489 if( empty($key) ) return $info;
2490
2491 switch ($key){
2492 case 'registered':
2493 $res = mysql2date(__('Mj, Y', 'usces'), $info['registered']);
2494 break;
2495 //20120919ysk start 0000573
2496 case 'point':
2497 $member_table = $wpdb->prefix."usces_member";
2498 $query = $wpdb->prepare("SELECT mem_point FROM $member_table WHERE ID = %d", $info['ID']);
2499 $res = $wpdb->get_var( $query );
2500 break;
2501 //20120919ysk end
2502 default:
2503 $res = isset($info[$key]) ? $info[$key] : '';
2504 }
2505
2506 if($out == 'return'){
2507 return $res;
2508 }else{
2509 echo esc_html($res);
2510 }
2511 }
2512
2513 function usces_localized_name( $Familly_name, $Given_name, $out = '' ){
2514 global $usces_settings, $usces;
2515
2516 $options = get_option('usces');
2517 $form = $options['system']['addressform'];
2518 if( $usces_settings['nameform'][$form] ){
2519 $res = $Given_name . ' ' . $Familly_name;
2520 }else{
2521 $res = $Familly_name . ' ' . $Given_name;
2522 }
2523
2524 if($out == 'return'){
2525 return $res;
2526 }else{
2527 echo esc_html($res);
2528 }
2529 }
2530
2531 function usces_member_history( $out = '' ){
2532 global $usces;
2533
2534 $usces_members = $usces->get_member();
2535 $usces_member_history = $usces->get_member_history($usces_members['ID']);
2536 $colspan = usces_is_membersystem_point() ? 9 : 7;
2537
2538 $html = '<div class="history-area">
2539 <table>';
2540 if ( !count($usces_member_history) ) {
2541 $html .= '<tr>
2542 <td>' . __('There is no purchase history for this moment.', 'usces') . '</td>
2543 </tr>';
2544 }
2545 foreach ( $usces_member_history as $umhs ) {
2546 $cart = $umhs['cart'];
2547 $history_member_head = '<tr>
2548 <th class="historyrow">' . __('Order number', 'usces') . '</th>
2549 <th class="historyrow">' . __('Purchase date', 'usces') . '</th>
2550 <th class="historyrow">' . __('Purchase price', 'usces') . '</th>';
2551 if( usces_is_membersystem_point() ){
2552 $history_member_head .= '<th class="historyrow">' . __('Used points', 'usces') . '</th>';
2553 }
2554 $history_member_head .= '<th class="historyrow">' . apply_filters( 'usces_member_discount_label', __('Special Price', 'usces'), $umhs['ID'] ) . '</th>
2555 <th class="historyrow">' . __('Shipping', 'usces') . '</th>
2556 <th class="historyrow">' . __('C.O.D', 'usces') . '</th>
2557 <th class="historyrow">' . __('consumption tax', 'usces') . '</th>';
2558 if( usces_is_membersystem_point() ){
2559 $history_member_head .= '<th class="historyrow">' . __('Acquired points', 'usces') . '</th>';
2560 }
2561 $history_member_head .= '</tr>
2562 <tr>
2563 <td class="rightnum">' . usces_get_deco_order_id($umhs['ID']) . '</td>
2564 <td class="date">' . $umhs['date'] . '</td>
2565 <td class="rightnum">' . usces_crform(($usces->get_total_price($cart)-$umhs['usedpoint']+$umhs['discount']+$umhs['shipping_charge']+$umhs['cod_fee']+$umhs['tax']), true, false, 'return') . '</td>';
2566 if( usces_is_membersystem_point() ){
2567 $history_member_head .= '<td class="rightnum">' . number_format($umhs['usedpoint']) . '</td>';
2568 }
2569 $history_member_head .= '<td class="rightnum">' . usces_crform($umhs['discount'], true, false, 'return') . '</td>
2570 <td class="rightnum">' . usces_crform($umhs['shipping_charge'], true, false, 'return') . '</td>
2571 <td class="rightnum">' . usces_crform($umhs['cod_fee'], true, false, 'return') . '</td>
2572 <td class="rightnum">' . usces_crform($umhs['tax'], true, false, 'return') . '</td>';
2573 if( usces_is_membersystem_point() ){
2574 $history_member_head .= '<td class="rightnum">' . number_format($umhs['getpoint']) . '</td>';
2575 }
2576 $history_member_head .= '</tr>';
2577 $html .= apply_filters( 'usces_filter_history_member_head', $history_member_head, $umhs );
2578 $html .= apply_filters('usces_filter_member_history_header', NULL, $umhs);
2579 $html .= '<tr>
2580 <td class="retail" colspan="' . $colspan . '">
2581 <table id="retail_table_' . $umhs['ID'] . '" class="retail">';
2582 $history_cart_head = '<tr>
2583 <th scope="row" class="num">No.</th>
2584 <th class="thumbnail">&nbsp;</th>
2585 <th>' . __('Items', 'usces') . '</th>
2586 <th class="price ">' . __('Unit price', 'usces') . '</th>
2587 <th class="quantity">' . __('Quantity', 'usces') . '</th>
2588 <th class="subtotal">' . __('Amount', 'usces') . '</th>
2589 </tr>';
2590 $html .= apply_filters('usces_filter_history_cart_head', $history_cart_head, $umhs);
2591
2592 for($i=0; $i<count($cart); $i++) {
2593 $cart_row = $cart[$i];
2594 $ordercart_id = $cart_row['cart_id'];
2595 $post_id = $cart_row['post_id'];
2596 $sku = urldecode($cart_row['sku']);
2597 $quantity = $cart_row['quantity'];
2598 $options = $cart_row['options'];
2599 //$options = usces_get_ordercart_meta_value( 'option', $ordercart_id );
2600 //$options = usces_get_ordercart_meta( 'option', $ordercart_id );
2601 $itemCode = $usces->getItemCode($post_id);
2602 $itemName = $usces->getItemName($post_id);
2603 $cartItemName = $usces->getCartItemName($post_id, $sku);
2604 //$skuPrice = $usces->getItemPrice($post_id, $sku);
2605 $skuPrice = $cart_row['price'];
2606 $pictid = (int)$usces->get_mainpictid($itemCode);
2607 $optstr = '';
2608 if( is_array($options) && count($options) > 0 ){
2609 $optstr = '';
2610 foreach($options as $key => $value){
2611 if( !empty($key) ) {
2612 $key = urldecode($key);
2613 $value = maybe_unserialize($value);
2614 if(is_array($value)) {
2615 $c = '';
2616 $optstr .= esc_html($key) . ' : ';
2617 foreach($value as $v) {
2618 $optstr .= $c.nl2br(esc_html(urldecode($v)));
2619 $c = ', ';
2620 }
2621 $optstr .= "<br />\n";
2622 } else {
2623 $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
2624 }
2625 }
2626 }
2627 $optstr = apply_filters( 'usces_filter_option_history', $optstr, $options);
2628 }
2629 $optstr = apply_filters( 'usces_filter_option_info_history', $optstr, $umhs, $cart_row, $i );
2630
2631 $history_cart_row = '<tr>
2632 <td>' . ($i + 1) . '</td>
2633 <td>';
2634 $cart_thumbnail = '<a href="' . get_permalink($post_id) . '">' . wp_get_attachment_image( $pictid, array(60, 60), true ) . '</a>';
2635 $history_cart_row .= apply_filters('usces_filter_cart_thumbnail', $cart_thumbnail, $post_id, $pictid, $i, $cart_row);
2636 $history_cart_row .= '</td>
2637 <td class="aleft"><a href="' . get_permalink($post_id) . '">' . esc_html($cartItemName) . '<br />' . $optstr . '</a>' . apply_filters('usces_filter_history_item_name', NULL, $umhs, $cart_row, $i) . '</td>
2638 <td class="rightnum">' . usces_crform($skuPrice, true, false, 'return') . '</td>
2639 <td class="rightnum">' . number_format($cart_row['quantity']) . '</td>
2640 <td class="rightnum">' . usces_crform($skuPrice * $cart_row['quantity'], true, false, 'return') . '</td>
2641 </tr>';
2642 $materials = compact( 'cart_thumbnail', 'post_id', 'pictid', 'cartItemName', 'optstr' );
2643 $html .= apply_filters( 'usces_filter_history_cart_row', $history_cart_row, $umhs, $cart_row, $i, $materials );
2644 }
2645 $html .= '</table>
2646 </td>
2647 </tr>';
2648 }
2649
2650 $html .= '</table>
2651 </div>';
2652
2653 if($out == 'return'){
2654 return $html;
2655 }else{
2656 echo $html;
2657 }
2658 }
2659
2660 function usces_newmember_button($member_regmode){
2661 $html = '<input name="member_regmode" type="hidden" value="' . $member_regmode . '" />';
2662 $newmemberbutton = '<input name="regmember" type="submit" value="' . __('transmit a message', 'usces') . '" />';
2663 $html .= apply_filters('usces_filter_newmember_button', $newmemberbutton);
2664 echo $html;
2665 }
2666
2667 function usces_login_button(){
2668 $loginbutton = '<input type="submit" name="member_login" id="member_login" class="member_login_button" value="' . __('Log-in', 'usces') . '" />';
2669 $html = apply_filters('usces_filter_login_button', $loginbutton);
2670 echo $html;
2671 }
2672
2673 function usces_assistance_item($post_id, $title ){
2674 if (usces_get_assistance_id_list($post_id)) :
2675 global $post;
2676 $r = new WP_Query( array('post__in'=>usces_get_assistance_ids($post_id), 'ignore_sticky_posts'=>1) );
2677 if($r->have_posts()) :
2678 add_filter( 'excerpt_length', 'welcart_assistance_excerpt_length' );
2679 add_filter( 'excerpt_mblength', 'welcart_assistance_excerpt_mblength' );
2680 $width = apply_filters( 'usces_filter_assistance_item_width', 100 );
2681 $height = apply_filters( 'usces_filter_assistance_item_height', 100 );
2682 ?>
2683 <div class="assistance_item">
2684 <h3><?php echo $title; ?></h3>
2685 <ul class="clearfix">
2686 <?php
2687 while ($r->have_posts()) :
2688 $r->the_post();
2689 usces_remove_filter();
2690 usces_the_item();
2691 ob_start();
2692 ?>
2693 <li>
2694 <div class="listbox clearfix">
2695 <div class="slit">
2696 <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php echo wp_filter_nohtml_kses(get_the_title()); ?>"><?php usces_the_itemImage(0, $width, $height, $post); ?></a>
2697 </div>
2698 <div class="detail">
2699 <div class="assist_excerpt">
2700 <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php echo wp_filter_nohtml_kses(get_the_title()); ?>"><h4><?php usces_the_itemName(); ?></h4></a>
2701 <?php the_excerpt(); ?>
2702 </div>
2703 <div class="assist_price">
2704 <?php if (usces_is_skus()) : ?>
2705 <?php usces_crform( usces_the_firstPrice('return'), true, false ); ?>
2706 <?php endif; ?>
2707 </div>
2708 </div>
2709 </div>
2710 </li>
2711 <?php
2712 $list = ob_get_contents();
2713 ob_end_clean();
2714 echo apply_filters('usces_filter_assistance_item_list', $list, $post);
2715 endwhile; ?>
2716
2717 </ul>
2718 </div><!-- end of assistance_item -->
2719 <?php
2720 wp_reset_postdata();
2721 usces_reset_filter();
2722 remove_filter( 'excerpt_length', 'welcart_assistance_excerpt_length' );
2723 remove_filter( 'excerpt_mblength', 'welcart_assistance_excerpt_mblength' );
2724 endif;
2725 endif;
2726 }
2727
2728 function usces_get_cart_rows( $out = '' ) {
2729 global $usces, $usces_gp;
2730 $cart = $usces->cart->get_cart();
2731 $usces_gp = 0;
2732 $res = '';
2733
2734 for($i=0; $i<count($cart); $i++) {
2735 $cart_row = $cart[$i];
2736 $post_id = $cart_row['post_id'];
2737 $sku = $cart_row['sku'];
2738 $sku_code = esc_attr(urldecode($cart_row['sku']));
2739 $quantity = $cart_row['quantity'];
2740 $options = $cart_row['options'];
2741 $advance = $usces->cart->wc_serialize($cart_row['advance']);
2742 $itemCode = $usces->getItemCode($post_id);
2743 $itemName = $usces->getItemName($post_id);
2744 $cartItemName = $usces->getCartItemName($post_id, $sku_code);
2745 $itemRestriction = $usces->getItemRestriction($post_id);
2746 $skuPrice = $cart_row['price'];
2747 $skuZaikonum = $usces->getItemZaikonum($post_id, $sku_code);
2748 $stockid = $usces->getItemZaikoStatusId($post_id, $sku_code);
2749 $stock = $usces->getItemZaiko($post_id, $sku_code);
2750 $red = (in_array($stock, array(__('sellout','usces'), __('Out Of Stock','usces'), __('Out of print','usces')))) ? 'class="signal_red"' : '';
2751 $pictid = (int)$usces->get_mainpictid($itemCode);
2752 $args = compact('cart', 'i', 'cart_row', 'post_id', 'sku' );
2753 $row = '';
2754 if ( empty($options) ) {
2755 $optstr = '';
2756 $options = array();
2757 }
2758 $row .= '<tr>
2759 <td>' . ($i + 1) . '</td>
2760 <td>';
2761 $cart_thumbnail = '<a href="' . get_permalink($post_id) . '">' . wp_get_attachment_image( $pictid, array(60, 60), true ) . '</a>';
2762 $row .= apply_filters('usces_filter_cart_thumbnail', $cart_thumbnail, $post_id, $pictid, $i,$cart_row);
2763 $row .= '</td><td class="aleft">' . esc_html($cartItemName) . '<br />';
2764 if( is_array($options) && count($options) > 0 ){
2765 $optstr = '';
2766 foreach($options as $key => $value){
2767 //20110629ysk start 0000190
2768 //if( !empty($key) )
2769 // $row .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
2770 if( !empty($key) ) {
2771 $key = urldecode($key);
2772 if(is_array($value)) {
2773 $c = '';
2774 $optstr .= esc_html($key) . ' : ';
2775 foreach($value as $v) {
2776 $optstr .= $c.nl2br(esc_html(urldecode($v)));
2777 $c = ', ';
2778 }
2779 $optstr .= "<br />\n";
2780 } else {
2781 $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
2782 }
2783 }
2784 //20110629ysk end
2785 }
2786 $row .= apply_filters( 'usces_filter_option_cart', $optstr, $options);
2787 }
2788 $row .= apply_filters( 'usces_filter_option_info_cart', '', $cart_row, $args );
2789 $row .= '</td>
2790 <td class="aright">';
2791 if( usces_is_gptekiyo($post_id, $sku_code, $quantity) ) {
2792 $usces_gp = 1;
2793 $Business_pack_mark = '<img src="' . get_template_directory_uri() . '/images/gp.gif" alt="' . __('Business package discount','usces') . '" /><br />';
2794 $row .= apply_filters('usces_filter_itemGpExp_cart_mark', $Business_pack_mark);
2795 }
2796 $row .= usces_crform($skuPrice, true, false, 'return') . '
2797 </td>
2798 <td>';
2799 $row_quant = '<input name="quant[' . $i . '][' . $post_id . '][' . $sku . ']" class="quantity" type="text" value="' . esc_attr($cart_row['quantity']) . '" />';
2800 $row .= apply_filters( 'usces_filter_cart_rows_quant', $row_quant, $args );
2801 $row .= '</td>
2802 <td class="aright">' . usces_crform(($skuPrice * $cart_row['quantity']), true, false, 'return') . '</td>
2803 <td ' . $red . '>' . $stock . '</td>
2804 <td>';
2805 foreach($options as $key => $value){
2806 //20110629ysk start 0000190
2807 //$row .= '<input name="itemOption[' . $i . '][' . $post_id . '][' . $sku . '][' . $key . ']" type="hidden" value="' . $value . '" />';
2808 if(is_array($value)) {
2809 foreach($value as $v) {
2810 $row .= '<input name="itemOption[' . $i . '][' . $post_id . '][' . $sku . '][' . $key . '][' . $v . ']" type="hidden" value="' . $v . '" />'."\n";
2811 }
2812 } else {
2813 $row .= '<input name="itemOption[' . $i . '][' . $post_id . '][' . $sku . '][' . $key . ']" type="hidden" value="' . $value . '" />'."\n";
2814 }
2815 //20110629ysk end
2816 }
2817 $row .= '<input name="itemRestriction[' . $i . ']" type="hidden" value="' . $itemRestriction . '" />
2818 <input name="stockid[' . $i . ']" type="hidden" value="' . $stockid . '" />
2819 <input name="itempostid[' . $i . ']" type="hidden" value="' . $post_id . '" />
2820 <input name="itemsku[' . $i . ']" type="hidden" value="' . $sku . '" />
2821 <input name="zaikonum[' . $i . '][' . $post_id . '][' . $sku . ']" type="hidden" value="' . esc_attr($skuZaikonum) . '" />
2822 <input name="skuPrice[' . $i . '][' . $post_id . '][' . $sku . ']" type="hidden" value="' . esc_attr($skuPrice) . '" />
2823 <input name="advance[' . $i . '][' . $post_id . '][' . $sku . ']" type="hidden" value="' . esc_attr($advance) . '" />
2824 <input name="delButton[' . $i . '][' . $post_id . '][' . $sku . ']" class="delButton" type="submit" value="' . __('Delete','usces') . '" />
2825 </td>
2826 </tr>';
2827 $materials = compact('i', 'cart_row', 'post_id', 'sku', 'sku_code', 'quantity', 'options', 'advance',
2828 'itemCode', 'itemName', 'cartItemName', 'itemRestriction', 'skuPrice', 'skuZaikonum',
2829 'stockid', 'stock', 'red', 'pictid');
2830 $res .= apply_filters( 'usces_filter_cart_row', $row, $cart, $materials);
2831 }
2832
2833 $res = apply_filters( 'usces_filter_cart_rows', $res, $cart);
2834
2835 if($out == 'return'){
2836 return $res;
2837 }else{
2838 echo $res;
2839 }
2840 }
2841 function usces_get_confirm_rows( $out = '' ) {
2842 global $usces, $usces_members, $usces_entries;
2843 // $usces_members = $usces->get_member();
2844 $memid = ( empty($usces_members['ID']) ) ? 999999999 : $usces_members['ID'];
2845 // $usces_entries = $usces->cart->get_entry();
2846 $usces->set_cart_fees( $usces_members, $usces_entries );
2847 $usces_entries = $usces->cart->get_entry();
2848
2849 $cart = $usces->cart->get_cart();
2850 $res = '';
2851 for($i=0; $i<count($cart); $i++) {
2852 $cart_row = $cart[$i];
2853 $post_id = $cart_row['post_id'];
2854 $sku = esc_attr($cart_row['sku']);
2855 $sku_code = esc_attr(urldecode($cart_row['sku']));
2856 $quantity = $cart_row['quantity'];
2857 $options = $cart_row['options'];
2858 $advance = $usces->cart->wc_serialize($cart_row['advance']);
2859 $itemCode = $usces->getItemCode($post_id);
2860 $itemName = $usces->getItemName($post_id);
2861 $cartItemName = $usces->getCartItemName($post_id, $sku_code);
2862 $skuPrice = $cart_row['price'];
2863 $pictid = $usces->get_mainpictid($itemCode);
2864 $args = compact('cart', 'i', 'cart_row', 'post_id', 'sku' );
2865 $row = '';
2866 if (empty($options)) {
2867 $optstr = '';
2868 $options = array();
2869 }
2870
2871 $row .= '<tr>
2872 <td>' . ($i + 1) . '</td>
2873 <td>';
2874 $cart_thumbnail = wp_get_attachment_image( $pictid, array(60, 60), true );
2875 $row .= apply_filters('usces_filter_cart_thumbnail', $cart_thumbnail, $post_id, $pictid, $i, $cart_row);
2876 $row .= '</td><td class="aleft">' . $cartItemName . '<br />';
2877 if( is_array($options) && count($options) > 0 ){
2878 $optstr = '';
2879 foreach($options as $key => $value){
2880 //20110629ysk start 0000190
2881 //if( !empty($key) )
2882 // $row .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
2883 if( !empty($key) ) {
2884 $key = urldecode($key);
2885 if(is_array($value)) {
2886 $c = '';
2887 $optstr .= esc_html($key) . ' : ';
2888 foreach($value as $v) {
2889 $optstr .= $c.nl2br(esc_html(urldecode($v)));
2890 $c = ', ';
2891 }
2892 $optstr .= "<br />\n";
2893 } else {
2894 $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
2895 }
2896 }
2897 //20110629ysk end
2898 }
2899 $row .= apply_filters( 'usces_filter_option_confirm', $optstr, $options);
2900 }
2901 $row .= apply_filters( 'usces_filter_option_info_confirm', '', $cart_row, $args );
2902 $row .= '</td>
2903 <td class="aright">' . usces_crform($skuPrice, true, false, 'return') . '</td>
2904 <td>' . $cart_row['quantity'] . '</td>
2905 <td class="aright">' . usces_crform(($skuPrice * $cart_row['quantity']), true, false, 'return') . '</td>
2906 <td>';
2907 $res = apply_filters('usces_additional_confirm', $res, array($i, $post_id, $sku_code));
2908 $row .= '</td>
2909 </tr>';
2910
2911 $materials = compact('i', 'cart_row', 'post_id', 'sku', 'sku_code', 'quantity', 'options', 'advance',
2912 'itemCode', 'itemName', 'cartItemName', 'skuPrice', 'pictid');
2913 $res .= apply_filters( 'usces_filter_confirm_row', $row, $cart, $materials);
2914 }
2915
2916 $res = apply_filters( 'usces_filter_confirm_rows', $res, $cart);
2917
2918 if($out == 'return'){
2919 return $res;
2920 }else{
2921 echo $res;
2922 }
2923 }
2924
2925 function uesces_addressform( $type, $data, $out = 'return' ){
2926 global $usces, $usces_settings;
2927 $options = get_option('usces');
2928 $form = $options['system']['addressform'];
2929 $nameform = $usces_settings['nameform'][$form];
2930 $applyform = usces_get_apply_addressform($form);
2931 $formtag = '';
2932 switch( $type ){
2933 case 'confirm':
2934 case 'member':
2935 $values = $data;
2936 break;
2937 case 'customer':
2938 case 'delivery':
2939 $values = $data[$type];
2940 break;
2941 }
2942 $data['type'] = $type;
2943 $values['country'] = !empty($values['country']) ? $values['country'] : usces_get_local_addressform();
2944 $values = $usces->stripslashes_deep_post($values);
2945 if( 'confirm' == $type ){
2946
2947 switch ($applyform){
2948
2949 case 'JP':
2950 $formtag .= usces_custom_field_info($data, 'customer', 'name_pre', 'return');
2951 $formtag .= '<tr><th>'.__('Full name', 'usces').'</th><td>' . esc_html($values['customer']['name1']) . ' ' . esc_html($values['customer']['name2']) . '</td></tr>';
2952 $furigana_customer = '<tr><th>'.__('furigana', 'usces').'</th><td>' . esc_html($values['customer']['name3']) . ' ' . esc_html($values['customer']['name4']) . '</td></tr>';
2953 $formtag .= apply_filters( 'usces_filter_furigana_confirm_customer', $furigana_customer, $type, $values );
2954 $formtag .= usces_custom_field_info($data, 'customer', 'name_after', 'return');
2955 $customer_country = (!empty($usces_settings['country'][$values['customer']['country']])) ? $usces_settings['country'][$values['customer']['country']] : '';
2956 $formtag .= '<tr><th>'.__('Zip/Postal Code', 'usces').'</th><td>' . esc_html($values['customer']['zipcode']) . '</td></tr>';
2957 //20131213_kitamura_start
2958 if( count( $options['system']['target_market'] ) != 1 ){
2959 $formtag .= '<tr><th>'.__('Country', 'usces').'</th><td>' . esc_html($customer_country) . '</td></tr>';
2960 }
2961 //20131213_kitamura_end
2962 $formtag .= '
2963 <tr><th>'.__('Province', 'usces').'</th><td>' . esc_html($values['customer']['pref']) . '</td></tr>
2964 <tr><th>'.__('city', 'usces').'</th><td>' . esc_html($values['customer']['address1']) . '</td></tr>
2965 <tr><th>'.__('numbers', 'usces').'</th><td>' . esc_html($values['customer']['address2']) . '</td></tr>
2966 <tr><th>'.__('building name', 'usces').'</th><td>' . esc_html($values['customer']['address3']) . '</td></tr>
2967 <tr><th>'.__('Phone number', 'usces').'</th><td>' . esc_html($values['customer']['tel']) . '</td></tr>
2968 <tr><th>'.__('FAX number', 'usces').'</th><td>' . esc_html($values['customer']['fax']) . '</td></tr>';
2969 $formtag .= usces_custom_field_info($data, 'customer', 'fax_after', 'return');
2970
2971 $shipping_address_info = '<tr class="ttl"><td colspan="2"><h3>'.__('Shipping address information', 'usces').'</h3></td></tr>';
2972 $shipping_address_info .= usces_custom_field_info($data, 'delivery', 'name_pre', 'return');
2973 $shipping_address_info .= '<tr><th>'.__('Full name', 'usces').'</th><td>' . esc_html($values['delivery']['name1']) . ' ' . esc_html($values['delivery']['name2']) . '</td></tr>';
2974 $furigana_delivery = '<tr><th>'.__('furigana', 'usces').'</th><td>' . esc_html($values['delivery']['name3']) . ' ' . esc_html($values['delivery']['name4']) . '</td></tr>';
2975 $shipping_address_info .= apply_filters( 'usces_filter_furigana_confirm_delivery', $furigana_delivery, $type, $values );
2976 $shipping_address_info .= usces_custom_field_info($values, 'delivery', 'name_after', 'return');
2977 $shipping_country = (!empty($usces_settings['country'][$values['delivery']['country']])) ? $usces_settings['country'][$values['delivery']['country']] : '';
2978 $shipping_address_info .= '<tr><th>'.__('Zip/Postal Code', 'usces').'</th><td>' . esc_html($values['delivery']['zipcode']) . '</td></tr>';
2979 //20131213_kitamura_start
2980 if( count( $options['system']['target_market'] ) != 1 ){
2981 $shipping_address_info .= '<tr><th>'.__('Country', 'usces').'</th><td>' . esc_html($shipping_country) . '</td></tr>';
2982 }
2983 //20131213_kitamura_end
2984 $shipping_address_info .= '
2985 <tr><th>'.__('Province', 'usces').'</th><td>' . esc_html($values['delivery']['pref']) . '</td></tr>
2986 <tr><th>'.__('city', 'usces').'</th><td>' . esc_html($values['delivery']['address1']) . '</td></tr>
2987 <tr><th>'.__('numbers', 'usces').'</th><td>' . esc_html($values['delivery']['address2']) . '</td></tr>
2988 <tr><th>'.__('building name', 'usces').'</th><td>' . esc_html($values['delivery']['address3']) . '</td></tr>
2989 <tr><th>'.__('Phone number', 'usces').'</th><td>' . esc_html($values['delivery']['tel']) . '</td></tr>
2990 <tr><th>'.__('FAX number', 'usces').'</th><td>' . esc_html($values['delivery']['fax']) . '</td></tr>';
2991 $shipping_address_info .= usces_custom_field_info($data, 'delivery', 'fax_after', 'return');
2992 $formtag .= apply_filters('usces_filter_shipping_address_info', $shipping_address_info);
2993 break;
2994
2995 case 'CN':
2996 $formtag .= usces_custom_field_info($data, 'customer', 'name_pre', 'return');
2997 $formtag .= '<tr><th>'.__('Full name', 'usces').'</th><td>' . esc_html(usces_localized_name( $values['customer']['name1'], $values['customer']['name2'], 'return' )) . '</td></tr>';
2998 $formtag .= usces_custom_field_info($data, 'customer', 'name_after', 'return');
2999 //20131213_kitamura_start
3000 if( count( $options['system']['target_market'] ) != 1 ){
3001 $formtag .= '<tr><th>'.__('Country', 'usces').'</th><td>' . esc_html($usces_settings['country'][$values['customer']['country']]) . '</td></tr>';
3002 }
3003 //20131213_kitamura_end
3004 $formtag .= '
3005 <tr><th>'.__('State', 'usces').'</th><td>' . esc_html($values['customer']['pref']) . '</td></tr>
3006 <tr><th>'.__('city', 'usces').'</th><td>' . esc_html($values['customer']['address1']) . '</td></tr>
3007 <tr><th>'.__('Address Line1', 'usces').'</th><td>' . esc_html($values['customer']['address2']) . '</td></tr>
3008 <tr><th>'.__('Address Line2', 'usces').'</th><td>' . esc_html($values['customer']['address3']) . '</td></tr>
3009 <tr><th>'.__('Zip', 'usces').'</th><td>' . esc_html($values['customer']['zipcode']) . '</td></tr>
3010 <tr><th>'.__('Phone number', 'usces').'</th><td>' . esc_html($values['customer']['tel']) . '</td></tr>
3011 <tr><th>'.__('FAX number', 'usces').'</th><td>' . esc_html($values['customer']['fax']) . '</td></tr>';
3012 $formtag .= usces_custom_field_info($data, 'customer', 'fax_after', 'return');
3013
3014 $shipping_address_info = '<tr class="ttl"><td colspan="2"><h3>'.__('Shipping address information', 'usces').'</h3></td></tr>';
3015 $shipping_address_info .= usces_custom_field_info($data, 'delivery', 'name_pre', 'return');
3016 $shipping_address_info .= '<tr><th>'.__('Full name', 'usces').'</th><td>' . esc_html(usces_localized_name( $values['delivery']['name1'], $values['delivery']['name2'], 'return' )) . '</td></tr>';
3017 $shipping_address_info .= usces_custom_field_info($data, 'delivery', 'name_after', 'return');
3018 //20131213_kitamura_start
3019 if( count( $options['system']['target_market'] ) != 1 ){
3020 $shipping_address_info .= '<tr><th>'.__('Country', 'usces').'</th><td>' . esc_html($usces_settings['country'][$values['delivery']['country']]) . '</td></tr>';
3021 }
3022 //20131213_kitamura_end
3023 $shipping_address_info .= '
3024 <tr><th>'.__('State', 'usces').'</th><td>' . esc_html($values['delivery']['pref']) . '</td></tr>
3025 <tr><th>'.__('city', 'usces').'</th><td>' . esc_html($values['delivery']['address1']) . '</td></tr>
3026 <tr><th>'.__('Address Line1', 'usces').'</th><td>' . esc_html($values['delivery']['address2']) . '</td></tr>
3027 <tr><th>'.__('Address Line2', 'usces').'</th><td>' . esc_html($values['delivery']['address3']) . '</td></tr>
3028 <tr><th>'.__('Zip', 'usces').'</th><td>' . esc_html($values['delivery']['zipcode']) . '</td></tr>
3029 <tr><th>'.__('Phone number', 'usces').'</th><td>' . esc_html($values['delivery']['tel']) . '</td></tr>
3030 <tr><th>'.__('FAX number', 'usces').'</th><td>' . esc_html($values['delivery']['fax']) . '</td></tr>';
3031 $shipping_address_info .= usces_custom_field_info($data, 'delivery', 'fax_after', 'return');
3032 $formtag .= apply_filters('usces_filter_shipping_address_info', $shipping_address_info);
3033 break;
3034
3035 case 'US':
3036 default :
3037 $formtag .= usces_custom_field_info($data, 'customer', 'name_pre', 'return');
3038 $formtag .= '<tr><th>'.__('Full name', 'usces').'</th><td>' . esc_html($values['customer']['name2']) . ' ' . esc_html($values['customer']['name1']) . '</td></tr>';
3039 $formtag .= usces_custom_field_info($data, 'customer', 'name_after', 'return');
3040 $customer_country = (!empty($usces_settings['country'][$values['customer']['country']])) ? $usces_settings['country'][$values['customer']['country']] : '';
3041 $formtag .= '
3042 <tr><th>'.__('Address Line1', 'usces').'</th><td>' . esc_html($values['customer']['address2']) . '</td></tr>
3043 <tr><th>'.__('Address Line2', 'usces').'</th><td>' . esc_html($values['customer']['address3']) . '</td></tr>
3044 <tr><th>'.__('city', 'usces').'</th><td>' . esc_html($values['customer']['address1']) . '</td></tr>
3045 <tr><th>'.__('State', 'usces').'</th><td>' . esc_html($values['customer']['pref']) . '</td></tr>';
3046
3047 //20131213_kitamura_start
3048 if( count( $options['system']['target_market'] ) != 1 ){
3049 $formtag .= '<tr><th>'.__('Country', 'usces').'</th><td>' . esc_html($customer_country) . '</td></tr>';
3050 }
3051 //20131213_kitamura_end
3052 $formtag .= '
3053 <tr><th>'.__('Zip', 'usces').'</th><td>' . esc_html($values['customer']['zipcode']) . '</td></tr>
3054 <tr><th>'.__('Phone number', 'usces').'</th><td>' . esc_html($values['customer']['tel']) . '</td></tr>
3055 <tr><th>'.__('FAX number', 'usces').'</th><td>' . esc_html($values['customer']['fax']) . '</td></tr>';
3056 $formtag .= usces_custom_field_info($data, 'customer', 'fax_after', 'return');
3057
3058 $shipping_address_info = '<tr class="ttl"><td colspan="2"><h3>'.__('Shipping address information', 'usces').'</h3></td></tr>';
3059 $shipping_address_info .= usces_custom_field_info($data, 'delivery', 'name_pre', 'return');
3060 $shipping_address_info .= '<tr><th>'.__('Full name', 'usces').'</th><td>' . esc_html($values['delivery']['name2']) . ' ' . esc_html($values['delivery']['name1']) . '</td></tr>';
3061 $shipping_address_info .= usces_custom_field_info($data, 'delivery', 'name_after', 'return');
3062 $shipping_country = (!empty($usces_settings['country'][$values['delivery']['country']])) ? $usces_settings['country'][$values['delivery']['country']] : '';
3063 $shipping_address_info .= '
3064 <tr><th>'.__('Address Line1', 'usces').'</th><td>' . esc_html($values['delivery']['address2']) . '</td></tr>
3065 <tr><th>'.__('Address Line2', 'usces').'</th><td>' . esc_html($values['delivery']['address3']) . '</td></tr>
3066 <tr><th>'.__('city', 'usces').'</th><td>' . esc_html($values['delivery']['address1']) . '</td></tr>
3067 <tr><th>'.__('State', 'usces').'</th><td>' . esc_html($values['delivery']['pref']) . '</td></tr>';
3068 //20131213_kitamura_start
3069 if( count( $options['system']['target_market'] ) != 1 ){
3070 $shipping_address_info .= '<tr><th>'.__('Country', 'usces').'</th><td>' . esc_html($shipping_country) . '</td></tr>';
3071 }
3072 //20131213_kitamura_end
3073 $shipping_address_info .= '
3074 <tr><th>'.__('Zip', 'usces').'</th><td>' . esc_html($values['delivery']['zipcode']) . '</td></tr>
3075 <tr><th>'.__('Phone number', 'usces').'</th><td>' . esc_html($values['delivery']['tel']) . '</td></tr>
3076 <tr><th>'.__('FAX number', 'usces').'</th><td>' . esc_html($values['delivery']['fax']) . '</td></tr>';
3077 $shipping_address_info .= usces_custom_field_info($data, 'delivery', 'fax_after', 'return');
3078 $formtag .= apply_filters('usces_filter_shipping_address_info', $shipping_address_info);
3079 break;
3080
3081 }
3082 $res = apply_filters('usces_filter_apply_addressform_confirm', $formtag, $type, $data);
3083
3084 }else{
3085
3086 switch ($applyform){
3087
3088 case 'JP':
3089 $formtag .= usces_custom_field_input($data, $type, 'name_pre', 'return');
3090 $formtag .= '<tr class="inp1">
3091 <th width="127" scope="row">' . usces_get_essential_mark('name1', $data) . __('Full name', 'usces').'</th>';
3092 if( $nameform ){
3093 $formtag .= '<td class="name_td">'.__('Given name', 'usces').'<input name="' . $type . '[name2]" id="name2" type="text" value="' . esc_attr($values['name2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" /></td>';
3094 $formtag .= '<td class="name_td">'.__('Familly name', 'usces').'<input name="' . $type . '[name1]" id="name1" type="text" value="' . esc_attr($values['name1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" /></td>';
3095 }else{
3096 $formtag .= '<td class="name_td">'.__('Familly name', 'usces').'<input name="' . $type . '[name1]" id="name1" type="text" value="' . esc_attr($values['name1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" /></td>';
3097 $formtag .= '<td class="name_td">'.__('Given name', 'usces').'<input name="' . $type . '[name2]" id="name2" type="text" value="' . esc_attr($values['name2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" /></td>';
3098 }
3099 $formtag .= '</tr>';
3100 $furigana = '<tr class="inp1">
3101 <th scope="row">' . usces_get_essential_mark('name3', $data).__('furigana', 'usces').'</th>';
3102 if( $nameform ){
3103 $furigana .= '<td>'.__('Given name', 'usces').'<input name="' . $type . '[name4]" id="name4" type="text" value="' . esc_attr($values['name4']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" /></td>';
3104 $furigana .= '<td>'.__('Familly name', 'usces').'<input name="' . $type . '[name3]" id="name3" type="text" value="' . esc_attr($values['name3']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" /></td>';
3105 }else{
3106 $furigana .= '<td>'.__('Familly name', 'usces').'<input name="' . $type . '[name3]" id="name3" type="text" value="' . esc_attr($values['name3']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" /></td>';
3107 $furigana .= '<td>'.__('Given name', 'usces').'<input name="' . $type . '[name4]" id="name4" type="text" value="' . esc_attr($values['name4']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" /></td>';
3108 }
3109 $furigana .= '</tr>';
3110 $formtag .= apply_filters( 'usces_filter_furigana_form', $furigana, $type, $values );
3111 $formtag .= usces_custom_field_input($data, $type, 'name_after', 'return');
3112 $formtag .= '<tr>
3113 <th scope="row">' . usces_get_essential_mark('zipcode', $data).__('Zip/Postal Code', 'usces').'</th>
3114 <td colspan="2"><input name="' . $type . '[zipcode]" id="zipcode" type="text" value="' . esc_attr($values['zipcode']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: inactive" />'.apply_filters('usces_filter_addressform_zipcode', NULL, $type) . apply_filters( 'usces_filter_after_zipcode', '100-1000', $applyform ) . '</td>
3115 </tr>';
3116 //20131213_kitamura_start
3117 if( count( $options['system']['target_market'] ) == 1 ){
3118 $formtag .= '<input type="hidden" name="' .$type. '[country]" id="' .$type. '_country" value="' .$options['system']['target_market'][0]. '">';
3119 }else{
3120 $formtag .= '<tr>
3121 <th scope="row">' . usces_get_essential_mark('country', $data) . __('Country', 'usces') . '</th>
3122 <td colspan="2">' . uesces_get_target_market_form( $type, $values['country'] ) . apply_filters( 'usces_filter_after_country', NULL, $applyform ) . '</td>
3123 </tr>';
3124 }
3125 //20131213_kitamura_end
3126 $formtag .= '<tr>
3127 <th scope="row">' . usces_get_essential_mark('states', $data).__('Province', 'usces').'</th>
3128 <td colspan="2">' . usces_pref_select( $type, $values ) . apply_filters( 'usces_filter_after_states', NULL, $applyform ) . '</td>
3129 </tr>
3130 <tr class="inp2">
3131 <th scope="row">' . usces_get_essential_mark('address1', $data).__('city', 'usces').'</th>
3132 <td colspan="2"><input name="' . $type . '[address1]" id="address1" type="text" value="' . esc_attr($values['address1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" />' . apply_filters( 'usces_filter_after_address1', __('Kitakami Yokohama', 'usces'), $applyform ) . '</td>
3133 </tr>
3134 <tr>
3135 <th scope="row">' . usces_get_essential_mark('address2', $data).__('numbers', 'usces').'</th>
3136 <td colspan="2"><input name="' . $type . '[address2]" id="address2" type="text" value="' . esc_attr($values['address2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" />' . apply_filters( 'usces_filter_after_address2', '3-24-555', $applyform ) . '</td>
3137 </tr>
3138 <tr>
3139 <th scope="row">' . usces_get_essential_mark('address3', $data).__('building name', 'usces').'</th>
3140 <td colspan="2"><input name="' . $type . '[address3]" id="address3" type="text" value="' . esc_attr($values['address3']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" />' . apply_filters( 'usces_filter_after_address3', __('tuhanbuild 4F', 'usces'), $applyform ) . '</td>
3141 </tr>
3142 <tr>
3143 <th scope="row">' . usces_get_essential_mark('tel', $data).__('Phone number', 'usces').'</th>
3144 <td colspan="2"><input name="' . $type . '[tel]" id="tel" type="text" value="' . esc_attr($values['tel']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: inactive" />' . apply_filters( 'usces_filter_after_tel', '1000-10-1000', $applyform ) . '</td>
3145 </tr>
3146 <tr>
3147 <th scope="row">' . usces_get_essential_mark('fax', $data).__('FAX number', 'usces').'</th>
3148 <td colspan="2"><input name="' . $type . '[fax]" id="fax" type="text" value="' . esc_attr($values['fax']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: inactive" />' . apply_filters( 'usces_filter_after_fax', '1000-10-1000', $applyform ) . '</td>
3149 </tr>';
3150 $formtag .= usces_custom_field_input($data, $type, 'fax_after', 'return');
3151 break;
3152
3153 case 'CN':
3154 $formtag .= usces_custom_field_input($data, $type, 'name_pre', 'return');
3155 $formtag .= '<tr class="inp1">
3156 <th scope="row">' . usces_get_essential_mark('name1', $data) . __('Full name', 'usces') . '</th>';
3157 if( $nameform ){
3158 $formtag .= '<td>' . __('Given name', 'usces') . '<input name="' . $type . '[name2]" id="name2" type="text" value="' . esc_attr($values['name2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" /></td>';
3159 $formtag .= '<td>' . __('Familly name', 'usces') . '<input name="' . $type . '[name1]" id="name1" type="text" value="' . esc_attr($values['name1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" /></td>';
3160 }else{
3161 $formtag .= '<td>' . __('Familly name', 'usces') . '<input name="' . $type . '[name1]" id="name1" type="text" value="' . esc_attr($values['name1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" /></td>';
3162 $formtag .= '<td>' . __('Given name', 'usces') . '<input name="' . $type . '[name2]" id="name2" type="text" value="' . esc_attr($values['name2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" /></td>';
3163 }
3164 $formtag .= '</tr>';
3165 $formtag .= usces_custom_field_input($data, $type, 'name_after', 'return');
3166 //20131213_kitamura_start
3167 if( count( $options['system']['target_market'] ) == 1 ){
3168 $formtag .= '<input type="hidden" name="' .$type. '[country]" id="' .$type. '_country" value="' .$options['system']['target_market'][0]. '">';
3169 }else{
3170 $formtag .= '<tr>
3171 <th scope="row">' . usces_get_essential_mark('country', $data) . __('Country', 'usces') . '</th>
3172 <td colspan="2">' . uesces_get_target_market_form( $type, $values['country'] ) . apply_filters( 'usces_filter_after_country', NULL, $applyform ) . '</td>
3173 </tr>';
3174 }
3175 //20131213_kitamura_end
3176 $formtag .= '<tr>
3177 <th scope="row">' . usces_get_essential_mark('states', $data) . __('State', 'usces') . '</th>
3178 <td colspan="2">' . usces_pref_select( $type, $values ) . apply_filters( 'usces_filter_after_states', NULL, $applyform ) . '</td>
3179 </tr>
3180 <tr class="inp2">
3181 <th scope="row">' . usces_get_essential_mark('address1', $data) . __('city', 'usces') . '</th>
3182 <td colspan="2"><input name="' . $type . '[address1]" id="address1" type="text" value="' . esc_attr($values['address1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . apply_filters( 'usces_filter_after_address1', NULL, $applyform ) . '</td>
3183 </tr>
3184 <tr>
3185 <th scope="row">' . usces_get_essential_mark('address2', $data) . __('Address Line1', 'usces') . '</th>
3186 <td colspan="2">' . __('Street address', 'usces') . '<br /><input name="' . $type . '[address2]" id="address2" type="text" value="' . esc_attr($values['address2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . apply_filters( 'usces_filter_after_address2', NULL, $applyform ) . '</td>
3187 </tr>
3188 <tr>
3189 <th scope="row">' . usces_get_essential_mark('address3', $data) . __('Address Line2', 'usces') . '</th>
3190 <td colspan="2">' . __('Apartment, building, etc.', 'usces') . '<br /><input name="' . $type . '[address3]" id="address3" type="text" value="' . esc_attr($values['address3']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . apply_filters( 'usces_filter_after_address3', NULL, $applyform ) . '</td>
3191 </tr>
3192 <tr>
3193 <th scope="row">' . usces_get_essential_mark('zipcode', $data) . __('Zip', 'usces') . '</th>
3194 <td colspan="2"><input name="' . $type . '[zipcode]" id="zipcode" type="text" value="' . esc_attr($values['zipcode']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . apply_filters( 'usces_filter_after_zipcode', NULL, $applyform ) . '</td>
3195 </tr>
3196 <tr>
3197 <th scope="row">' . usces_get_essential_mark('tel', $data) . __('Phone number', 'usces') . '</th>
3198 <td colspan="2"><input name="' . $type . '[tel]" id="tel" type="text" value="' . esc_attr($values['tel']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . apply_filters( 'usces_filter_after_tel', NULL, $applyform ) . '</td>
3199 </tr>
3200 <tr>
3201 <th scope="row">' . usces_get_essential_mark('fax', $data) . __('FAX number', 'usces') . '</th>
3202 <td colspan="2"><input name="' . $type . '[fax]" id="fax" type="text" value="' . esc_attr($values['fax']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . apply_filters( 'usces_filter_after_fax', NULL, $applyform ) . '</td>
3203 </tr>';
3204 $formtag .= usces_custom_field_input($data, $type, 'fax_after', 'return');
3205 break;
3206
3207 case 'US':
3208 default :
3209 $formtag .= usces_custom_field_input($data, $type, 'name_pre', 'return');
3210 $formtag .= '<tr class="inp1">
3211 <th scope="row">' . usces_get_essential_mark('name1', $data) . __('Full name', 'usces') . '</th>';
3212 if( $nameform ){
3213 $formtag .= '<td>' . __('Given name', 'usces') . '<input name="' . $type . '[name2]" id="name2" type="text" value="' . esc_attr($values['name2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" /></td>';
3214 $formtag .= '<td>' . __('Familly name', 'usces') . '<input name="' . $type . '[name1]" id="name1" type="text" value="' . esc_attr($values['name1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" /></td>';
3215 }else{
3216 $formtag .= '<td>' . __('Familly name', 'usces') . '<input name="' . $type . '[name1]" id="name1" type="text" value="' . esc_attr($values['name1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" /></td>';
3217 $formtag .= '<td>' . __('Given name', 'usces') . '<input name="' . $type . '[name2]" id="name2" type="text" value="' . esc_attr($values['name2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" /></td>';
3218 }
3219 $formtag .= '</tr>';
3220 $formtag .= usces_custom_field_input($data, $type, 'name_after', 'return');
3221 $formtag .= '
3222 <tr>
3223 <th scope="row">' . usces_get_essential_mark('address2', $data) . __('Address Line1', 'usces') . '</th>
3224 <td colspan="2">' . __('Street address', 'usces') . '<br /><input name="' . $type . '[address2]" id="address2" type="text" value="' . esc_attr($values['address2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . apply_filters( 'usces_filter_after_address2', NULL, $applyform ) . '</td>
3225 </tr>
3226 <tr>
3227 <th scope="row">' . usces_get_essential_mark('address3', $data) . __('Address Line2', 'usces') . '</th>
3228 <td colspan="2">' . __('Apartment, building, etc.', 'usces') . '<br /><input name="' . $type . '[address3]" id="address3" type="text" value="' . esc_attr($values['address3']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . apply_filters( 'usces_filter_after_address3', NULL, $applyform ) . '</td>
3229 </tr>
3230 <tr class="inp2">
3231 <th scope="row">' . usces_get_essential_mark('address1', $data) . __('city', 'usces') . '</th>
3232 <td colspan="2"><input name="' . $type . '[address1]" id="address1" type="text" value="' . esc_attr($values['address1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . apply_filters( 'usces_filter_after_address1', NULL, $applyform ) . '</td>
3233 </tr>
3234 <tr>
3235 <th scope="row">' . usces_get_essential_mark('states', $data) . __('State', 'usces') . '</th>
3236 <td colspan="2">' . usces_pref_select( $type, $values ) . apply_filters( 'usces_filter_after_states', NULL, $applyform ) . '</td>
3237 </tr>';
3238 //20131213_kitamura_start
3239 if( count( $options['system']['target_market'] ) == 1 ){
3240 $formtag .= '<input type="hidden" name="' .$type. '[country]" id="' .$type. '_country" value="' .$options['system']['target_market'][0]. '">';
3241 }else{
3242 $formtag .= '<tr>
3243 <th scope="row">' . usces_get_essential_mark('country', $data) . __('Country', 'usces') . '</th>
3244 <td colspan="2">' . uesces_get_target_market_form( $type, $values['country'] ) . apply_filters( 'usces_filter_after_country', NULL, $applyform ) . '</td>
3245 </tr>';
3246 }
3247 //20131213_kitamura_end
3248 $formtag .= '<tr>
3249 <th scope="row">' . usces_get_essential_mark('zipcode', $data) . __('Zip', 'usces') . '</th>
3250 <td colspan="2"><input name="' . $type . '[zipcode]" id="zipcode" type="text" value="' . esc_attr($values['zipcode']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . apply_filters( 'usces_filter_after_zipcode', NULL, $applyform ) . '</td>
3251 </tr>
3252 <tr>
3253 <th scope="row">' . usces_get_essential_mark('tel', $data) . __('Phone number', 'usces') . '</th>
3254 <td colspan="2"><input name="' . $type . '[tel]" id="tel" type="text" value="' . esc_attr($values['tel']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . apply_filters( 'usces_filter_after_tel', NULL, $applyform ) . '</td>
3255 </tr>
3256 <tr>
3257 <th scope="row">' . usces_get_essential_mark('fax', $data) . __('FAX number', 'usces') . '</th>
3258 <td colspan="2"><input name="' . $type . '[fax]" id="fax" type="text" value="' . esc_attr($values['fax']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . apply_filters( 'usces_filter_after_fax', NULL, $applyform ) . '</td>
3259 </tr>';
3260 $formtag .= usces_custom_field_input($data, $type, 'fax_after', 'return');
3261 break;
3262 }
3263 $res = apply_filters('usces_filter_apply_addressform', $formtag, $type, $data);
3264
3265 }
3266
3267 if($out == 'return') {
3268 return $res;
3269 } else {
3270 echo $res;
3271 }
3272 }
3273
3274 function usces_item_option_fileds( $post_id, $sku, $label=1, $out='echo' ){
3275 $options = usces_get_opts($post_id, 'sort');
3276 if( 0 == count($options) )
3277 return false;
3278
3279 $sku_enc = urlencode($sku);
3280 $html ='';
3281 foreach( $options as $opt ){
3282 $name = $opt['name'];
3283 $opt_code = urlencode($name);
3284 $html .= "\n" . '<div class="opt_field" id="opt_' . $post_id . '_' . $sku_enc . '_' . $opt_code . '">';
3285 if( $label ){
3286 $html .= '<label for="itemOption[' . $post_id . '][' . $sku_enc . '][' . $opt_code . ']">' . esc_html($name) . '</label>';
3287 }
3288 $html .= usces_get_itemopt_filed($post_id, $sku, $opt);
3289 $html .= '</div>';
3290 }
3291 if( $out == 'return' ){
3292 return $html;
3293 }else{
3294 echo $html;
3295 }
3296 }
3297
3298 function usces_facebook_like(){
3299 global $post, $usces;
3300 $like = array(
3301 'url' => urlencode(get_permalink($post->ID)),
3302 'send' => 'false',
3303 'layout' => 'button_count', //standard, button_count, box_count
3304 'width' => '450',
3305 'height' => '35',
3306 'show_faces' => 'false',
3307 'action' => 'like', //like, recommend
3308 );
3309 $like = apply_filters( 'usces_filter_facebook_like', $like, $post->ID );
3310 ?>
3311 <iframe src="//www.facebook.com/plugins/like.php?href=<?php echo $like['url']; ?>&amp;send=<?php echo $like['send']; ?>&amp;layout=<?php echo $like['layout']; ?>&amp;width=<?php echo $like['width']; ?>&amp;show_faces=<?php echo $like['show_faces']; ?>&amp;action=<?php echo $like['action']; ?>&amp;colorscheme=light&amp;font=arial&amp;height=<?php echo $like['height']; ?>" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:<?php echo $like['width']; ?>px; height:<?php echo $like['height']; ?>px;" allowTransparency="true"></iframe>
3312 <?php
3313 }
3314
3315 function usces_action_confirm_page_point_inform_zeus() {
3316 $html = usces_point_inform_zeus();
3317 echo $html;
3318 }
3319
3320 function usces_filter_confirm_point_inform_zeus( $html ) {
3321 $html .= usces_point_inform_zeus();
3322 return $html;
3323 }
3324
3325 function usces_point_inform_zeus() {
3326 global $usces, $usces_entries;
3327 $html = '';
3328
3329 $payments = usces_get_payments_by_name( $usces_entries['order']['payment_name'] );
3330 $acting_flag = ( 'acting' == $payments['settlement'] ) ? $payments['module'] : $payments['settlement'];
3331
3332 switch( $acting_flag ) {
3333 case 'acting_zeus_card':
3334 $html .= '<input type="hidden" name="cnum1" value="'.esc_attr($_POST['cnum1']).'">';
3335 if( isset($_POST['securecode']) ) {
3336 $html .= '<input type="hidden" name="securecode" value="'.esc_attr($_POST['securecode']).'">';
3337 }
3338 $html .= '<input type="hidden" name="expyy" value="'.esc_attr($_POST['expyy']).'">';
3339 $html .= '<input type="hidden" name="expmm" value="'.esc_attr($_POST['expmm']).'">';
3340 $html .= '<input type="hidden" name="username_card" value="'.esc_attr($_POST['username_card']).'">';
3341 if( isset($usces_entries['order']['howpay']) ) {
3342 $html .= '<input type="hidden" name="offer[howpay]" value="'.esc_attr($usces_entries['order']['howpay']).'">';
3343 }
3344 if( isset($usces_entries['order']['cbrand']) ) {
3345 $html .= '<input type="hidden" name="offer[cbrand]" value="'.esc_attr($usces_entries['order']['cbrand']).'">';
3346 $html .= '<input type="hidden" name="offer[div_1]" value="'.esc_attr($usces_entries['order']['div_1']).'">';
3347 $html .= '<input type="hidden" name="offer[div_2]" value="'.esc_attr($usces_entries['order']['div_2']).'">';
3348 $html .= '<input type="hidden" name="offer[div_3]" value="'.esc_attr($usces_entries['order']['div_3']).'">';
3349 }
3350 break;
3351
3352 case 'acting_zeus_conv':
3353 if( isset($_POST['pay_cvs']) ) {
3354 $html .= '<input type="hidden" name="offer[pay_cvs]" value="'.esc_attr($usces_entries['order']['pay_cvs']).'">';
3355 $html .= '<input type="hidden" name="username_conv" value="'.esc_attr($_POST['username_conv']).'">';
3356 }
3357 break;
3358 }
3359 return $html;
3360 }
3361
3362 function usces_checked( $chk, $key, $out = '' ) {
3363 $checked = ( isset($chk[$key]) and $chk[$key] == 1 ) ? ' checked' : '';
3364 if( $out == 'return' ) {
3365 return $checked;
3366 } else {
3367 echo $checked;
3368 }
3369 }
3370
3371 function usces_get_custom_field_value( $field, $key, $id, $out = '' ) {
3372 global $usces;
3373
3374 $value = '';
3375 switch( $field ) {
3376 case 'order':
3377 $value = $usces->get_order_meta_value( 'csod_'.$key, $id );
3378 break;
3379 case 'customer':
3380 $value = $usces->get_order_meta_value( 'cscs_'.$key, $id );
3381 break;
3382 case 'delivery':
3383 $value = $usces->get_order_meta_value( 'csde_'.$key, $id );
3384 break;
3385 case 'member':
3386 $value = $usces->get_member_meta_value( 'csmb_'.$key, $id );
3387 break;
3388 }
3389
3390 if( $out == 'return' ) {
3391 return $value;
3392 } else {
3393 echo $value;
3394 }
3395 }
3396
3397
3398 ?>