Customer details

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #33582
    faezehzar
    Participant

      Dear Olly
      I send order details to an application by using add_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?

      #33599
      Olly
      Admin & Mod

        only thing i can see here is that there is no var called $order_table_name
        there is however a constant one can use instead WPPIZZA_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)

      Viewing 2 posts - 1 through 2 (of 2 total)
      • The topic ‘Customer details’ is closed to new replies.