Ejemplo n.º 1
0
 /**
  * META-BOX CONTENT - Display Customer's account informations in administration panel
  */
 function wps_customer_account_informations()
 {
     global $post;
     $wps_account = new wps_account_ctr();
     $output = $wps_account->display_account_informations($post->post_author);
     echo $output;
 }
 /**
  * AJAX - Refresh customer informations
  */
 function wps_order_refresh_customer_informations()
 {
     $status = false;
     $account = $addresses = '';
     $customer_id = !empty($_POST['customer_id']) ? intval($_POST['customer_id']) : null;
     $order_id = !empty($_POST['order_id']) ? intval($_POST['order_id']) : null;
     if (!empty($customer_id)) {
         $order_metadata = get_post_meta($order_id, '_order_postmeta', true);
         if (!empty($order_metadata)) {
             $order_metadata['customer_id'] = $customer_id;
             update_post_meta($order_id, '_order_postmeta', $order_metadata);
         }
         // Selected customer informations
         $wps_account = new wps_account_ctr();
         $account = $wps_account->display_account_informations($customer_id);
         $wps_address = new wps_address();
         $addresses = $wps_address->display_addresses_interface($customer_id, true, $order_id);
         $status = true;
     }
     echo json_encode(array('status' => $status, 'account' => $account, 'addresses' => $addresses));
     wp_die();
 }