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

member_edit_form.php in Welcart e-Commerce 1.4.12, at includes/member_edit_form.php

372 lines 14.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 $status = $this->action_status;
3 $message = $this->action_message;
4 $this->action_status = 'none';
5 $this->action_message = '';
6
7 //$management_status = get_option('usces_management_status');
8
9 if($member_action == 'new'){
10 $page = 'usces_membernew';
11 $oa = 'newpost';
12 $ID = NULL;
13 $member_metas = array();
14 $data = array(
15 'ID' =>'',
16 'mem_email' => ( isset($_POST['member']['email']) ) ? $_POST['member']['email'] : '',
17 'mem_pass' => ( isset($_POST['member']['password']) ) ? $_POST['member']['password'] : '',
18 'mem_status' => ( isset($_POST['member']['status']) ) ? $_POST['member']['status'] : 0,
19 'mem_cookie' => '',
20 'mem_point' => ( isset($_POST['member']['point']) ) ? $_POST['member']['point'] : 0,
21 'mem_name1' => ( isset($_POST['member']['name1']) ) ? $_POST['member']['name1'] : '',
22 'mem_name2' => ( isset($_POST['member']['name2']) ) ? $_POST['member']['name2'] : '',
23 'mem_name3' => ( isset($_POST['member']['name3']) ) ? $_POST['member']['name3'] : '',
24 'mem_name4' => ( isset($_POST['member']['name4']) ) ? $_POST['member']['name4'] : '',
25 'mem_zip' => ( isset($_POST['member']['zipcode']) ) ? $_POST['member']['zipcode'] : '',
26 'mem_pref' => ( isset($_POST['member']['pref']) ) ? $_POST['member']['pref'] : '',
27 'mem_address1' => ( isset($_POST['member']['address1']) ) ? $_POST['member']['address1'] : '',
28 'mem_address2' => ( isset($_POST['member']['address2']) ) ? $_POST['member']['address2'] : '',
29 'mem_address3' => ( isset($_POST['member']['address3']) ) ? $_POST['member']['address3'] : '',
30 'mem_tel' => ( isset($_POST['member']['tel']) ) ? $_POST['member']['tel'] : '',
31 'mem_fax' => ( isset($_POST['member']['fax']) ) ? $_POST['member']['fax'] : '',
32 'mem_delivery_flag' => '',
33 'mem_delivery' => '',
34 'mem_registered' => '',
35 'mem_nicename' => ''
36 );
37
38 $usces_member_history = array();
39
40 $csmb_meta = usces_has_custom_field_meta('member');
41 if(is_array($csmb_meta)) {
42 $keys = array_keys($csmb_meta);
43 foreach($keys as $key) {
44 $csmb_key = 'csmb_'.$key;
45 $csmb_meta[$key]['data'] = $_POST['custom_member'][$key];
46 }
47 }
48 }else{
49 $page = 'usces_memberlist';
50 $oa = 'editpost';
51 $ID = $_REQUEST['member_id'];
52 $member_metas = $this->get_member_meta($ID);
53 ksort($member_metas);
54 global $wpdb;
55
56 $tableName = $wpdb->prefix . "usces_member";
57 $query = $wpdb->prepare("SELECT * FROM $tableName WHERE ID = %d", $ID);
58 $data = $wpdb->get_row( $query, ARRAY_A );
59
60 $usces_member_history = $this->get_member_history($ID);
61 //20100818ysk start
62 $csmb_meta = usces_has_custom_field_meta('member');
63 if(is_array($csmb_meta)) {
64 $keys = array_keys($csmb_meta);
65 foreach($keys as $key) {
66 $csmb_key = 'csmb_'.$key;
67 $csmb_meta[$key]['data'] = maybe_unserialize($this->get_member_meta_value($csmb_key, $ID));
68 }
69 }
70 //20100818ysk end
71 }
72
73 if( usces_is_member_system() ){
74 $colspan = 8;
75 }else{
76 $colspan = 6;
77 }
78
79 $mem_registered = ( !empty($data['mem_registered']) ) ? sprintf(__('%2$s %3$s, %1$s', 'usces'),substr($data['mem_registered'],0,4),substr($data['mem_registered'],5,2),substr($data['mem_registered'],8,2)) : '';
80
81 $curent_url = urlencode( USCES_ADMIN_URL.'?'.$_SERVER['QUERY_STRING'] );
82 ?>
83 <script type="text/javascript">
84 jQuery(function($){
85 <?php if($status == 'success'){ ?>
86 $("#anibox").animate({ backgroundColor: "#ECFFFF" }, 2000);
87 <?php }else if($status == 'caution'){ ?>
88 $("#anibox").animate({ backgroundColor: "#FFF5CE" }, 2000);
89 <?php }else if($status == 'error'){ ?>
90 $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
91 <?php } ?>
92 var default_pre = '<?php _e('-- Select --', 'usces'); ?>';
93 $(".num").bind("change", function(){ usces_check_num($(this)); });
94 });
95
96 function addComma(str)
97 {
98 cnt = 0;
99 n = "";
100 for (i=str.length-1; i>=0; i--)
101 {
102 n = str.charAt(i) + n;
103 cnt++;
104 if (((cnt % 3) == 0) && (i != 0)) n = ","+n;
105 }
106 return n;
107 };
108 </script>
109 <div class="wrap">
110 <div class="usces_admin">
111 <form action="<?php echo USCES_ADMIN_URL.'?page='.$page.'&member_action='.$oa; ?>" method="post" name="editpost">
112 <?php if( $member_action == 'new' ) : ?>
113 <h2>Welcart Management <?php _e('New Membership Registration','usces'); ?></h2>
114 <?php else : ?>
115 <h2>Welcart Management <?php _e('Edit membership data','usces'); ?></h2>
116 <?php endif;?>
117
118 <p class="version_info">Version <?php echo USCES_VERSION; ?></p>
119 <div id="aniboxStatus" class="<?php echo $status; ?>">
120 <div id="anibox" class="clearfix">
121 <img id="info_image" src="<?php echo USCES_PLUGIN_URL; ?>/images/list_message_<?php echo $status; ?>.gif" />
122 <div class="mes" id="info_massage"><?php echo $message; ?></div>
123 </div>
124 </div>
125 <div class="ordernavi"><input name="upButton" class="upButton" type="submit" value="<?php _e('change decision', 'usces'); ?>" /><?php _e("When you change amount, please click 'Edit' before you finish your process.", 'usces'); ?></div>
126 <div class="info_head">
127 <table class="mem_wrap">
128 <tr>
129 <td class="label"><?php _e('membership number', 'usces'); ?></td><td class="col1"><div class="rod large short"><?php echo esc_html($data['ID']); ?></div></td>
130 <td colspan="2" rowspan="5" class="mem_col2">
131 <table class="mem_info">
132 <tr>
133 <td class="label">e-mail</td>
134 <td><input name="member[email]" type="text" class="text long" value="<?php echo esc_attr($data['mem_email']); ?>" /></td>
135 </tr>
136 <?php if( $member_action == 'new' ) : ?>
137 <tr>
138 <td class="label"><?php _e('password', 'usces'); ?></td>
139 <td><input name="member[password]" type="text" class="text" value="<?php echo esc_attr($data['mem_pass']); ?>" autocomplete="off" /></td>
140 </tr>
141 <?php endif; ?>
142 <?php echo uesces_get_admin_addressform( 'member', $data, $csmb_meta ); ?>
143 </table>
144 </td>
145 <td colspan="2" rowspan="5" class="mem_col3">
146 <table class="mem_info">
147 <?php
148 if( 0 < count($member_metas) ) :
149 $cardinfo = array( 'zeus'=>array(), 'remise'=>array(), 'digitalcheck'=>array() );
150 foreach( $member_metas as $value ) {
151 if( in_array( $value['meta_key'], array( 'zeus_pcid', 'zeus_partofcard', 'zeus_limitofcard' ) ) ) {
152 $cardinfo['zeus'][$value['meta_key']] = $value['meta_value'];
153 } elseif( in_array( $value['meta_key'], array( 'remise_pcid', 'partofcard', 'limitofcard', 'remise_memid' ) ) ) {
154 $cardinfo['remise'][$value['meta_key']] = $value['meta_value'];
155 } elseif( in_array( $value['meta_key'], array( 'digitalcheck_ip_user_id' ) ) ) {
156 $cardinfo['digitalcheck'][$value['meta_key']] = $value['meta_value'];
157 }
158 }
159 if( 0 < count($cardinfo['zeus']) ) :
160 foreach( $cardinfo['zeus'] as $key => $value ) :
161 if( $key != 'zeus_pcid' ) :
162 if( $key == 'zeus_partofcard' ) $label = __('下4桁','usces');
163 elseif( $key == 'zeus_limitofcard' ) $label = __('有効期限','usces');
164 else $label = $key; ?>
165 <tr>
166 <td class="label"><?php echo esc_html($label); ?></td>
167 <td><div class="rod_left shortm"><?php echo esc_html($value); ?></div></td>
168 </tr>
169 <?php endif;
170 endforeach;
171 if( array_key_exists( 'zeus_pcid', $cardinfo['zeus'] ) ) : ?>
172 <tr>
173 <td class="label">クイックチャージ</td>
174 <td><div class="rod_left shortm"><?php _e('登録あり','usces'); ?></div></td>
175 </tr>
176 <?php if( defined('WCEX_AUTO_DELIVERY') and !wcad_have_member_regular_order( $ID ) ) : ?>
177 <tr>
178 <td class="label"><input type="checkbox" name="zeus_pcid" value="delete"></td>
179 <td>クイックチャージを解除する</td>
180 </tr>
181 <?php endif;
182 endif;
183 endif;
184 if( 0 < count($cardinfo['remise']) ) :
185 foreach( $cardinfo['remise'] as $key => $value ) :
186 if( $key != 'remise_pcid' ) :
187 if( $key == 'partofcard' ) $label = __('下4桁','usces');
188 elseif( $key == 'limitofcard' ) $label = __('有効期限','usces');
189 elseif( $key == 'remise_memid' ) $label = __('メンバーID','usces');
190 else $label = $key; ?>
191 <tr>
192 <td class="label"><?php echo esc_html($label); ?></td>
193 <td><div class="rod_left shortm"><?php echo esc_html($value); ?></div></td>
194 </tr>
195 <?php endif;
196 endforeach;
197 if( array_key_exists( 'remise_pcid', $cardinfo['remise'] ) ) : ?>
198 <tr>
199 <td class="label">ペイクイック</td>
200 <td><div class="rod_left shortm"><?php _e('登録あり','usces'); ?></div></td>
201 </tr>
202 <tr>
203 <td class="label"><input type="checkbox" name="remise_pcid" value="delete"></td>
204 <td>ペイクイックを解除する</td>
205 </tr>
206 <?php endif;
207 endif;
208 if( 0 < count($cardinfo['digitalcheck']) ) :
209 foreach( $cardinfo['digitalcheck'] as $key => $value ) :
210 if( $key != 'digitalcheck_ip_user_id' ) : ?>
211 <tr>
212 <td class="label"><?php echo esc_html($key); ?></td>
213 <td><div class="rod_left shortm"><?php echo esc_html($value); ?></div></td>
214 </tr>
215 <?php endif;
216 endforeach;
217 if( array_key_exists( 'digitalcheck_ip_user_id', $cardinfo['digitalcheck'] ) ) : ?>
218 <tr>
219 <td class="label">ユーザID決済</td>
220 <td><div class="rod_left shortm"><?php _e('登録あり','usces'); ?></div></td>
221 </tr>
222 <tr>
223 <td class="label"><input type="checkbox" name="digitalcheck_ip_user_id" value="delete"></td>
224 <td>ユーザID決済を解除する</td>
225 </tr>
226 <?php endif;
227 endif;
228 endif;
229 ?>
230 </table>
231
232
233 </td>
234 </tr>
235 <tr>
236 <td class="label"><?php _e('Rank', 'usces'); ?></td><td class="col1"><select name="member[status]">
237 <?php foreach ((array)$this->member_status as $rk => $rv) :
238 $selected = ($rk == $data['mem_status']) ? ' selected="selected"' : ''; ?>
239 <option value="<?php echo esc_attr($rk); ?>"<?php echo $selected; ?>><?php echo esc_html($rv); ?></option>
240 <?php endforeach; ?>
241 </select></td>
242 </tr>
243 <tr>
244 <td class="label"><?php _e('current point', 'usces'); ?></td><td class="col1"><input name="member[point]" type="text" class="text right short num" value="<?php echo esc_html($data['mem_point']); ?>" /></td>
245 </tr>
246 <tr>
247 <td class="label"><?php _e('Strated date', 'usces'); ?></td><td class="col1"><div class="rod shortm"><?php echo esc_html($mem_registered); ?></div></td>
248 </tr>
249 <tr>
250 <td colspan="2"><?php do_action( 'usces_action_member_edit_form_left_blank', $ID ); ?></td>
251 </tr>
252 </table>
253 </div>
254 <div id="member_history">
255 <table>
256 <?php if ( !count($usces_member_history) ) : ?>
257 <tr>
258 <td><?php _e('There is no purchase history for this moment.', 'usces'); ?></td>
259 </tr>
260 <?php endif; ?>
261 <?php foreach ( (array)$usces_member_history as $umhs ) : $cart = $umhs['cart']; ?>
262 <?php $order_id = $umhs['ID']; ?>
263 <tr>
264 <th class="historyrow"><?php _e('Purchase date', 'usces'); ?></th>
265 <th class="historyrow"><?php _e('Order number', 'usces'); ?></th>
266 <th class="historyrow"><?php _e('Purchase price', 'usces'); ?></th>
267 <th class="historyrow"><?php _e('Used points','usces'); ?></th>
268 <th class="historyrow"><?php echo apply_filters( 'usces_member_discount_label', __('Special Price', 'usces'), $umhs['ID'] ); ?></th>
269 <th class="historyrow"><?php _e('Shipping', 'usces'); ?></th>
270 <th class="historyrow"><?php _e('C.O.D', 'usces'); ?></th>
271 <th class="historyrow"><?php _e('consumption tax', 'usces'); ?></th>
272 <th class="historyrow"><?php _e('Acquired points', 'usces'); ?></th>
273 </tr>
274 <tr>
275 <td><?php echo $umhs['date']; ?></td>
276 <td><a href="<?php echo USCES_ADMIN_URL; ?>?page=usces_orderlist&order_action=edit&order_id=<?php echo $order_id; ?>&usces_referer=<?php echo $curent_url; ?>"><?php echo usces_get_deco_order_id( $order_id ); ?></a></td>
277 <td class="rightnum"><?php usces_crform( $this->get_total_price($cart)-$umhs['usedpoint']+$umhs['discount']+$umhs['shipping_charge']+$umhs['cod_fee']+$umhs['tax'], true, false ); ?></td>
278 <td class="rightnum"><?php echo number_format($umhs['usedpoint']); ?></td>
279 <td class="rightnum"><?php usces_crform( $umhs['discount'], true, false ); ?></td>
280 <td class="rightnum"><?php usces_crform( $umhs['shipping_charge'], true, false ); ?></td>
281 <td class="rightnum"><?php usces_crform( $umhs['cod_fee'], true, false ); ?></td>
282 <td class="rightnum"><?php usces_crform( $umhs['tax'], true, false ); ?></td>
283 <td class="rightnum"><?php echo number_format($umhs['getpoint']); ?></td>
284 </tr>
285 <tr>
286 <td class="retail" colspan="9">
287 <table id="retail_table">
288 <tr>
289 <th scope="row" class="num"><?php echo __('No.','usces'); ?></th>
290 <th class="thumbnail">&nbsp;</th>
291 <th><?php _e('Items','usces'); ?></th>
292 <th class="price "><?php _e('Unit price','usces'); ?>(<?php usces_crcode(); ?>)</th>
293 <th class="quantity"><?php _e('Quantity','usces'); ?></th>
294 <th class="subtotal"><?php _e('Amount','usces'); ?>(<?php usces_crcode(); ?>)</th>
295 </tr>
296 <?php
297 for($i=0; $i<count($cart); $i++) {
298 $cart_row = $cart[$i];
299 $ordercart_id = $cart_row['cart_id'];
300 $post_id = $cart_row['post_id'];
301 $sku = urldecode($cart_row['sku']);
302 $quantity = $cart_row['quantity'];
303 $options = $cart_row['options'];
304 //$advance = $this->cart->wc_serialize($cart_row['advance']);
305 $advance = usces_get_ordercart_meta( 'advance', $ordercart_id );
306 // $itemCode = $this->getItemCode($post_id);
307 // $itemName = $this->getItemName($post_id);
308 $itemCode = $cart_row['item_code'];
309 $itemName = $cart_row['item_name'];
310 // $cartItemName = $this->getCartItemName($post_id, $sku);
311 $cartItemName = $this->getCartItemName_byOrder($cart_row);
312 //$skuPrice = $this->getItemPrice($post_id, $sku);
313 $skuPrice = $cart_row['price'];
314 $pictid = (int)$this->get_mainpictid($itemCode);
315 $optstr = '';
316 foreach((array)$options as $key => $value){
317 //20110629ysk start 0000190
318 //if( !empty($key) )
319 // $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
320 if( !empty($key) ) {
321 $key = urldecode($key);
322 $value = maybe_unserialize($value);
323 if(is_array($value)) {
324 $c = '';
325 $optstr .= esc_html($key) . ' : ';
326 foreach($value as $v) {
327 $optstr .= $c.nl2br(esc_html(urldecode($v)));
328 $c = ', ';
329 }
330 $optstr .= "<br />\n";
331 } else {
332 $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
333 }
334 }
335 //20110629ysk end
336 }
337 $materials = compact( 'i', 'cart_row', 'post_id', 'sku', 'quantity', 'options', 'advance',
338 'itemCode', 'itemName', 'cartItemName', 'skuPrice', 'pictid', 'order_id' );
339 $optstr = apply_filters( 'usces_filter_member_edit_form_row', $optstr, $cart, $materials );
340 ?>
341 <tr>
342 <td><?php echo $i + 1; ?></td>
343 <td><?php echo wp_get_attachment_image( $pictid, array(60, 60), true ); ?></td>
344 <td class="aleft"><?php echo esc_html($cartItemName); ?><br /><?php echo $optstr; ?></td>
345 <td class="rightnum"><?php usces_crform( $skuPrice, true, false ); ?></td>
346 <td class="rightnum"><?php echo number_format($cart_row['quantity']); ?></td>
347 <td class="rightnum"><?php usces_crform( $skuPrice * $cart_row['quantity'], true, false ); ?></td>
348 </tr>
349 <?php
350 }
351 ?>
352 </table>
353 </td>
354 </tr>
355 <?php endforeach; ?>
356 </table>
357 </div>
358 <input name="member_action" type="hidden" value="<?php echo $oa; ?>" />
359 <input name="member_id" id="member_id" type="hidden" value="<?php echo $data['ID']; ?>" />
360
361
362 <div id="mailSendAlert" title="">
363 <div id="order-response"></div>
364 <fieldset>
365 </fieldset>
366 </div>
367 <?php wp_nonce_field( 'post_member', 'wc_nonce' ); ?>
368 </form>
369
370 </div><!--usces_admin-->
371 </div><!--wrap-->
372