Exemplo n.º 1
0
 /**
  * Display Order information
  * 
  * Handles to display buyers information
  * 
  * @package WooCommerce - PDF Vouchers
  * @since 2.3.6
  */
 public function woo_vou_display_order_info_html($order_id, $type = 'html')
 {
     $order_details_html = '';
     //get order
     $order = new Wc_Order($order_id);
     //get order date
     $order_date = $order->order_date;
     //get payment method
     $payment_method = $order->payment_method_title;
     //Order title
     $order_total = esc_html(strip_tags($order->get_formatted_order_total()));
     //Order discount
     $order_discount = wc_price($order->get_total_discount(), array('currency' => $order->get_order_currency()));
     if ($type == 'html') {
         $order_id = '<a href="' . esc_url(admin_url('post.php?post=' . absint($order_id) . '&action=edit')) . '">' . $order_id . '</a>';
     }
     if ($type == 'csv') {
         $order_details_html .= 'ID : ' . $order_id . "\n";
         $order_details_html .= 'Order Date : ' . $order_date . "\n";
         $order_details_html .= 'Payment Method : ' . $payment_method . "\n";
         $order_details_html .= 'Order Total : 	' . $order_total . "\n";
         $order_details_html .= 'Order Discount :' . strip_tags($order_discount);
     } else {
         $order_details_html .= '<table>';
         $order_details_html .= '<tr><td style="font-weight:bold;">' . __('ID:', 'woovoucher') . '</td><td>' . $order_id . '</td></tr>';
         $order_details_html .= '<tr><td style="font-weight:bold;">' . __('Order Date:', 'woovoucher') . '</td><td>' . $order_date . '</td></tr>';
         $order_details_html .= '<tr><td style="font-weight:bold;">' . __('Payment Method:', 'woovoucher') . '</td><td>' . $payment_method . '</td></tr>';
         $order_details_html .= '<tr><td style="font-weight:bold;">' . __('Order Total:', 'woovoucher') . '</td><td>' . $order_total . '</td></tr>';
         $order_details_html .= '<tr><td style="font-weight:bold;">' . __('Order Discount:', 'woovoucher') . '</td><td>' . $order_discount . '</td></tr>';
         $order_details_html .= '</table>';
     }
     return apply_filters('woo_vou_display_order_info_html', $order_details_html, $order_id, $type);
 }