PluginProbe
Welcart e-Commerce / 1.4.11
Welcart e-Commerce v1.4.11
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.11, at functions/template_func.php

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