PluginProbe
Welcart e-Commerce / 1.3.9
Welcart e-Commerce v1.3.9
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.3.9, at includes/member_edit_form.php

304 lines 10.8 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
10 $oa = 'editpost';
11
12 $ID = $_REQUEST['member_id'];
13 $member_metas = $this->get_member_meta($ID);
14 ksort($member_metas);
15 global $wpdb;
16
17 $tableName = $wpdb->prefix . "usces_member";
18 $query = $wpdb->prepare("SELECT * FROM $tableName WHERE ID = %d", $ID);
19 $data = $wpdb->get_row( $query, ARRAY_A );
20
21 $usces_member_history = $this->get_member_history($ID);
22
23 //20100818ysk start
24 $csmb_meta = usces_has_custom_field_meta('member');
25 if(is_array($csmb_meta)) {
26 $keys = array_keys($csmb_meta);
27 foreach($keys as $key) {
28 $csmb_key = 'csmb_'.$key;
29 $csmb_meta[$key]['data'] = maybe_unserialize($this->get_member_meta_value($csmb_key, $ID));
30 }
31 }
32 //20100818ysk end
33
34 if( usces_is_member_system() ){
35 $colspan = 8;
36 }else{
37 $colspan = 6;
38 }
39
40 //$deli = unserialize($data['order_delivery']);
41 //$cart = unserialize($data['order_cart']);
42 //$condition = unserialize($data['order_condition']);
43 //$ordercheck = unserialize($data['order_check']);
44 //if( !is_array($ordercheck) ) $ordercheck = array();
45 //
46 //if($this->is_status('duringorder', $data['order_status']))
47 // $taio = 'duringorder';
48 //else if($this->is_status('cancel', $data['order_status']))
49 // $taio = 'cancel';
50 //else if($this->is_status('completion', $data['order_status']))
51 // $taio = 'completion';
52 //else
53 // $taio = 'new';
54 //
55 //if($this->is_status('estimate', $data['order_status']))
56 // $admin = 'estimate';
57 //else if($this->is_status('adminorder', $data['order_status']))
58 // $admin = 'adminorder';
59 //else
60 // $admin = '';
61 //
62 //if($this->is_status('noreceipt', $data['order_status']))
63 // $receipt = 'noreceipt';
64 //else if($this->is_status('receipted', $data['order_status']))
65 // $receipt = 'receipted';
66 //else
67 // $receipt = '';
68 $curent_url = urlencode( USCES_ADMIN_URL.'?'.$_SERVER['QUERY_STRING'] );
69 ?>
70 <script type="text/javascript">
71 jQuery(function($){
72 <?php if($status == 'success'){ ?>
73 $("#anibox").animate({ backgroundColor: "#ECFFFF" }, 2000);
74 <?php }else if($status == 'caution'){ ?>
75 $("#anibox").animate({ backgroundColor: "#FFF5CE" }, 2000);
76 <?php }else if($status == 'error'){ ?>
77 $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
78 <?php } ?>
79
80 $(".num").bind("change", function(){ usces_check_num($(this)); });
81
82 $('form').submit(function() {
83 var error = 0;
84
85 if( "" == $("input[name='member\[email\]']").val() ) {
86 error++;
87 $("input[name='member\[email\]']").css({'background-color': '#FFA'}).click(function() {
88 $(this).css({'background-color': '#FFF'});
89 });
90 }
91 if( !checkNum( $("input[name='member\[point\]']").val() ) ) {
92 error++;
93 $("input[name='member\[point\]']").css({'background-color': '#FFA'}).click(function() {
94 $(this).css({'background-color': '#FFF'});
95 });
96 }
97
98 if( 0 < error ) {
99 $("#aniboxStatus").removeClass("none");
100 $("#aniboxStatus").addClass("error");
101 $("#info_image").attr("src", "<?php echo USCES_PLUGIN_URL; ?>/images/list_message_error.gif");
102 $("#info_massage").html("データに不備があります");
103 $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
104 return false;
105 } else {
106 return true;
107 }
108 });
109 });
110
111 function addComma(str)
112 {
113 cnt = 0;
114 n = "";
115 for (i=str.length-1; i>=0; i--)
116 {
117 n = str.charAt(i) + n;
118 cnt++;
119 if (((cnt % 3) == 0) && (i != 0)) n = ","+n;
120 }
121 return n;
122 };
123 </script>
124 <div class="wrap">
125 <div class="usces_admin">
126 <form action="<?php echo USCES_ADMIN_URL.'?page=usces_memberlist&member_action='.$oa; ?>" method="post" name="editpost">
127
128 <h2>Welcart Management <?php _e('Edit membership data','usces'); ?></h2>
129 <p class="version_info">Version <?php echo USCES_VERSION; ?></p>
130 <div id="aniboxStatus" class="<?php echo $status; ?>">
131 <div id="anibox" class="clearfix">
132 <img id="info_image" src="<?php echo USCES_PLUGIN_URL; ?>/images/list_message_<?php echo $status; ?>.gif" />
133 <div class="mes" id="info_massage"><?php echo $message; ?></div>
134 </div>
135 </div>
136 <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>
137 <div class="info_head">
138 <div class="error_message"><?php echo $this->error_message; ?></div>
139 <table class="mem_wrap">
140 <tr>
141 <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>
142 <td colspan="2" rowspan="5" class="mem_col2">
143 <table class="mem_info">
144 <tr>
145 <td class="label">e-mail</td>
146 <td><input name="member[email]" type="text" class="text long" value="<?php echo esc_attr($data['mem_email']); ?>" /></td>
147 </tr>
148
149 <?php echo uesces_get_admin_addressform( 'member', $data, $csmb_meta ); ?>
150
151 </table>
152 </td>
153 <td colspan="2" rowspan="5" class="mem_col3">
154 <table class="mem_info">
155 <?php
156 foreach($member_metas as $value){
157 if( in_array($value['meta_key'], array('partofcard','limitofcard','remise_memid',)) ){
158 ?>
159 <tr>
160 <td class="label"><?php echo esc_html($value['meta_key']); ?></td>
161 <td><div class="rod_left"><?php echo esc_html($value['meta_value']); ?></div></td>
162 </tr>
163 <?php }} ?>
164 </table>
165
166
167 </td>
168 </tr>
169 <tr>
170 <td class="label"><?php _e('Rank', 'usces'); ?></td><td class="col1"><select name="member[status]">
171 <?php
172 foreach ((array)$this->member_status as $rk => $rv) {
173 $selected = ($rk == $data['mem_status']) ? ' selected="selected"' : '';
174 ?>
175 <option value="<?php echo esc_attr($rk); ?>"<?php echo $selected; ?>><?php echo esc_html($rv); ?></option>
176 <?php } ?>
177 </select></td>
178 </tr>
179 <tr>
180 <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>
181 <?php if( USCES_JP ): ?>
182 <?php endif; ?>
183 </tr>
184 <tr>
185 <td class="label"><?php _e('Strated date', 'usces'); ?></td><td class="col1"><div class="rod shortm"><?php echo esc_html(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))); ?></div></td>
186 </tr>
187 <tr>
188 <td colspan="2"><?php do_action( 'usces_action_member_edit_form_left_blank', $ID ); ?></td>
189 </tr>
190 </table>
191 </div>
192 <div id="member_history">
193 <table>
194 <?php if ( !count($usces_member_history) ) : ?>
195 <tr>
196 <td><?php _e('There is no purchase history for this moment.', 'usces'); ?></td>
197 </tr>
198 <?php endif; ?>
199 <?php foreach ( (array)$usces_member_history as $umhs ) : $cart = $umhs['cart']; ?>
200 <?php $order_id = $umhs['ID']; ?>
201 <tr>
202 <th class="historyrow"><?php _e('Purchase date', 'usces'); ?></th>
203 <th class="historyrow"><?php _e('Order number', 'usces'); ?></th>
204 <th class="historyrow"><?php _e('Purchase price', 'usces'); ?></th>
205 <th class="historyrow"><?php _e('Used points','usces'); ?></th>
206 <th class="historyrow"><?php echo apply_filters( 'usces_member_discount_label', __('Special Price', 'usces'), $umhs['ID'] ); ?></th>
207 <th class="historyrow"><?php _e('Shipping', 'usces'); ?></th>
208 <th class="historyrow"><?php _e('C.O.D', 'usces'); ?></th>
209 <th class="historyrow"><?php _e('consumption tax', 'usces'); ?></th>
210 <th class="historyrow"><?php _e('Acquired points', 'usces'); ?></th>
211 </tr>
212 <tr>
213 <td><?php echo $umhs['date']; ?></td>
214 <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>
215 <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>
216 <td class="rightnum"><?php echo number_format($umhs['usedpoint']); ?></td>
217 <td class="rightnum"><?php usces_crform( $umhs['discount'], true, false ); ?></td>
218 <td class="rightnum"><?php usces_crform( $umhs['shipping_charge'], true, false ); ?></td>
219 <td class="rightnum"><?php usces_crform( $umhs['cod_fee'], true, false ); ?></td>
220 <td class="rightnum"><?php usces_crform( $umhs['tax'], true, false ); ?></td>
221 <td class="rightnum"><?php echo number_format($umhs['getpoint']); ?></td>
222 </tr>
223 <tr>
224 <td class="retail" colspan="9">
225 <table id="retail_table">
226 <tr>
227 <th scope="row" class="num"><?php echo __('No.','usces'); ?></th>
228 <th class="thumbnail">&nbsp;</th>
229 <th><?php _e('Items','usces'); ?></th>
230 <th class="price "><?php _e('Unit price','usces'); ?>(<?php usces_crcode(); ?>)</th>
231 <th class="quantity"><?php _e('Quantity','usces'); ?></th>
232 <th class="subtotal"><?php _e('Amount','usces'); ?>(<?php usces_crcode(); ?>)</th>
233 </tr>
234 <?php
235 for($i=0; $i<count($cart); $i++) {
236 $cart_row = $cart[$i];
237 $post_id = $cart_row['post_id'];
238 $sku = urldecode($cart_row['sku']);
239 $quantity = $cart_row['quantity'];
240 $options = $cart_row['options'];
241 $advance = $this->cart->wc_serialize($cart_row['advance']);
242 $itemCode = $this->getItemCode($post_id);
243 $itemName = $this->getItemName($post_id);
244 $cartItemName = $this->getCartItemName($post_id, $sku);
245 //$skuPrice = $this->getItemPrice($post_id, $sku);
246 $skuPrice = $cart_row['price'];
247 $pictid = (int)$this->get_mainpictid($itemCode);
248 $optstr = '';
249 foreach((array)$options as $key => $value){
250 //20110629ysk start 0000190
251 //if( !empty($key) )
252 // $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
253 if( !empty($key) ) {
254 $key = urldecode($key);
255 if(is_array($value)) {
256 $c = '';
257 $optstr .= esc_html($key) . ' : ';
258 foreach($value as $v) {
259 $optstr .= $c.nl2br(esc_html(urldecode($v)));
260 $c = ', ';
261 }
262 $optstr .= "<br />\n";
263 } else {
264 $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
265 }
266 }
267 //20110629ysk end
268 }
269 $materials = compact( 'i', 'cart_row', 'post_id', 'sku', 'quantity', 'options', 'advance',
270 'itemCode', 'itemName', 'cartItemName', 'skuPrice', 'pictid', 'order_id' );
271 $optstr = apply_filters( 'usces_filter_member_edit_form_row', $optstr, $cart, $materials );
272 ?>
273 <tr>
274 <td><?php echo $i + 1; ?></td>
275 <td><?php echo wp_get_attachment_image( $pictid, array(60, 60), true ); ?></td>
276 <td class="aleft"><?php echo esc_html($cartItemName); ?><br /><?php echo $optstr; ?></td>
277 <td class="rightnum"><?php usces_crform( $skuPrice, true, false ); ?></td>
278 <td class="rightnum"><?php echo number_format($cart_row['quantity']); ?></td>
279 <td class="rightnum"><?php usces_crform( $skuPrice * $cart_row['quantity'], true, false ); ?></td>
280 </tr>
281 <?php
282 }
283 ?>
284 </table>
285 </td>
286 </tr>
287 <?php endforeach; ?>
288 </table>
289 </div>
290 <input name="member_action" type="hidden" value="<?php echo $oa; ?>" />
291 <input name="member_id" id="member_id" type="hidden" value="<?php echo $data['ID']; ?>" />
292
293
294 <div id="mailSendAlert" title="">
295 <div id="order-response"></div>
296 <fieldset>
297 </fieldset>
298 </div>
299
300 </form>
301
302 </div><!--usces_admin-->
303 </div><!--wrap-->
304