WPPizza – A Restaurant Plugin for WordPress › Support › General Support › Customer details
- AuthorPosts
- 12 December, 2017 at 11:35 am #33582
Dear Olly
I send order details to an application by usingadd_action( 'wppizza_on_order_execute', 'my_order_app', 10, 3);
and every thing works fine but when customer make a payment via epay I got customer details as NA
I get customer details as below:$post_data['cust_name'] = $order_details['customer']['cname']['value']; if (trim($post_data['cust_name']) == '') { $post_data['cust_name'] = 'NA'; } $post_data['cust_address'] = $order_details['customer']['caddress']['value']; if (trim($post_data['cust_address']) == '') { $post_data['cust_address'] = 'NA'; } $post_data['cust_address'] = trim($post_data['cust_address']); $post_data['cust_address'] = preg_replace("/\r|\n/", "@@", $post_data['cust_address']); $post_data['cust_address'] = str_replace("@@@@", "@@", $post_data['cust_address']); $post_data['cust_address'] = html_entity_decode($post_data['cust_address'], ENT_QUOTES); $post_data['cust_phone'] = $order_details['customer']['ctel']['value']; if (trim($post_data['cust_phone']) == '') { $post_data['cust_phone'] = 'NA'; } $post_data['cust_email'] = $order_details['customer']['cemail']['value']; if (trim($post_data['cust_email'])==''){ $post_data['cust_email'] = 'NA'; } $post_data['cust_instruction'] = $order_details['customer']['ccomments']['value']; $post_data['cust_instruction'] = preg_replace("/\r|\n/", "@@", $post_data['cust_instruction']); $post_data['cust_instruction'] = str_replace("@@@@", "@@", $post_data['cust_instruction']); $post_data['cust_instruction'] = html_entity_decode($post_data['cust_instruction'], ENT_QUOTES); $user_id = $order_details['ordervars']['wp_user_id']['value']; $number_of_previous_order = 0; if ($user_id) { $ocount = $wpdb->get_results("SELECT count(*) as rcnt FROM " . $wpdb->prefix . $order_table_name . "", ARRAY_A); $number_of_previous_order = $ocount[0]['rcnt']; } if ($user_id && $number_of_previous_order > 1) { $post_data['isVarified'] = 4; } else { $post_data['isVarified'] = 5; }
Is there any thing need to be changed?
13 December, 2017 at 3:07 am #33599only thing i can see here is that there is no var called
$order_table_name
there is however a constant one can use insteadWPPIZZA_TABLE_ORDERS
other than that – as this’ not the full code/function/hook i cannot comment too much other than – under normal circumstances – the
$order_details['customer']
array makes no distinction between cod or prepay(i.e cc) orders in that action hook (it only exists once regardless of what payment type was used)
unless something was done via some filter before of course (in which case your thank you page etc would also be missing a bunch of details though) - AuthorPosts
- The topic ‘Customer details’ is closed to new replies.