teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

関数の追加

2016/11/16 09:17

投稿

margin
margin

スコア16

title CHANGED
File without changes
body CHANGED
@@ -39,4 +39,72 @@
39
39
 
40
40
  どこか別にカスタムオーダーフィールドの入力チェックが存在しているのか探しています。
41
41
 
42
- 何かご存知の方がいれば、ファイル名か関数名など教えて頂きたいと思います。ご教授お願いします。
42
+ 何かご存知の方がいれば、ファイル名か関数名など教えて頂きたいと思います。ご教授お願いします。
43
+
44
+ 追加 下記の関数が入力チェックをしている?
45
+ ```ここに言語を入力
46
+ function delivery_check() {
47
+ $mes = '';
48
+ if ( isset($_POST['delivery']['delivery_flag']) && $_POST['delivery']['delivery_flag'] == 1 ) {
49
+ if ( WCUtils::is_blank($_POST["delivery"]["name1"]) )
50
+ $mes .= __('Name is not correct', 'usces') . "<br />";
51
+ // if ( trim($_POST["delivery"]["name3"]) == "" && USCES_JP )
52
+ // $mes .= __('Invalid CANNAT pretend.', 'usces') . "<br />";
53
+ if ( WCUtils::is_blank($_POST["delivery"]["zipcode"]) )
54
+ $mes .= __('postal code is not correct', 'usces') . "<br />";
55
+ if ( $_POST["delivery"]["pref"] == __('-- Select --', 'usces') || $_POST["delivery"]["pref"] == '-- Select --' )
56
+ $mes .= __('enter the prefecture', 'usces') . "<br />";
57
+ if ( WCUtils::is_blank($_POST["delivery"]["address1"]) )
58
+ $mes .= __('enter the city name', 'usces') . "<br />";
59
+ if ( WCUtils::is_blank($_POST["delivery"]["address2"]) )
60
+ $mes .= __('enter house numbers', 'usces') . "<br />";
61
+ if ( WCUtils::is_blank($_POST["delivery"]["tel"]) )
62
+ $mes .= __('enter phone numbers', 'usces') . "<br />";
63
+ }
64
+ if ( !isset($_POST['offer']['delivery_method']) || (empty($_POST['offer']['delivery_method']) && !WCUtils::is_zero($_POST['offer']['delivery_method'])) ) {
65
+ $mes .= __('chose one from delivery method.', 'usces') . "<br />";
66
+ } else {
67
+ $d_method_index = $this->get_delivery_method_index((int)$_POST['offer']['delivery_method']);
68
+ $country = $_SESSION['usces_entry']["delivery"]["country"];
69
+ $local_country = usces_get_base_country();
70
+ if($country == $local_country) {
71
+ if($this->options['delivery_method'][$d_method_index]['intl'] == 1) {
72
+ $mes .= __('Delivery method is incorrect. Can not specify an international flight.', 'usces') . "<br />";
73
+ }
74
+ } else {
75
+ if( WCUtils::is_zero($this->options['delivery_method'][$d_method_index]['intl']) ) {
76
+ $mes .= __('Delivery method is incorrect. Specify the international flights.', 'usces') . "<br />";
77
+ }
78
+ }
79
+ }
80
+ if ( !isset($_POST['offer']['payment_name']) ){
81
+ $mes .= __('chose one from payment options.', 'usces') . "<br />";
82
+ }else{
83
+ $payments = $this->getPayments($_POST['offer']['payment_name']);
84
+ if('COD' == $payments['settlement']){
85
+ $total_items_price = $this->get_total_price();
86
+ $usces_entries = $this->cart->get_entry();
87
+ $materials = array(
88
+ 'total_items_price' => $usces_entries['order']['total_items_price'],
89
+ 'discount' => $usces_entries['order']['discount'],
90
+ 'shipping_charge' => $usces_entries['order']['shipping_charge'],
91
+ 'cod_fee' => $usces_entries['order']['cod_fee'],
92
+ 'use_point' => ( isset($usces_entries['order']['use_point']) ) ? $usces_entries['order']['use_point'] : 0,
93
+ );
94
+ $tax = $this->getTax( $total_items_price, $materials );
95
+ $total_items_price = $total_items_price + $tax;
96
+ $cod_limit_amount = ( isset($this->options['cod_limit_amount']) && 0 < (int)$this->options['cod_limit_amount'] ) ? $this->options['cod_limit_amount'] : 0;
97
+ if( 0 < $cod_limit_amount && $total_items_price > $cod_limit_amount )
98
+ $mes .= sprintf(__('A total products amount of money surpasses the upper limit(%s) that I can purchase in C.O.D.', 'usces'), usces_crform($this->options['cod_limit_amount'], true, false, 'return')) . "<br />";
99
+ }
100
+ }
101
+ if( isset($d_method_index) && isset($payments) ) {
102
+ if($this->options['delivery_method'][$d_method_index]['nocod'] == 1) {
103
+ if('COD' == $payments['settlement'])
104
+ $mes .= __('COD is not available.', 'usces') . "<br />";
105
+ }
106
+ }
107
+ $mes = apply_filters('usces_filter_delivery_check', $mes);
108
+ return $mes;
109
+ }
110
+ ```

1

開発フォーラムのリンクを挿入

2016/11/16 09:17

投稿

margin
margin

スコア16

title CHANGED
File without changes
body CHANGED
@@ -1,6 +1,7 @@
1
1
  現在ローカル環境でwordpressのプラグインのwelcartでECサイト構築を勉強しています。
2
2
 
3
- ここで聞くのは場違いかもしれませんが、知恵を貸してほしく思います。開発フォーラムには質問済みです。
3
+ ここで聞くのは場違いかもしれませんが、知恵を貸してほしく思います。開発フォーラムには質問済みです。下記が質問内容です。
4
+ [リンク内容](https://www.welcart.com/community/forums/topic/%E5%88%A5%E3%81%AE%E7%99%BA%E9%80%81%E5%85%88%E3%81%AE%E6%8C%87%E5%AE%9A%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6?loggedout=true)
4
5
 
5
6
  welcartのカートページの発送・支払方法のページをカスタマイズしています。解決したいことは、このページに出てくるカスタムオーダーフィールドで必須に設定したものが効かないことです。
6
7