Example #1
0
function get_order_detailinfo_tableformat($orderId, $isshow_paydetail = 0)
{
    global $Cart, $General, $wpdb, $transection_db_table_name;
    $ordersql = "select * from {$transection_db_table_name} where trans_id=\"{$orderId}\"";
    $orderinfo = $wpdb->get_results($ordersql);
    $orderinfo = $orderinfo[0];
    if ($isshow_paydetail) {
        //$message = '<link rel="stylesheet" type="text/css" href="'.get_stylesheet_directory_uri().'/style.css" media="screen" />';
        $message .= '<style>.address_info {width:400px;}</style>';
    }
    $billing_address = $orderinfo->billing_add;
    $billing_address = str_replace(',', ',<br />', $billing_address);
    $shipping_address = $orderinfo->shipping_add;
    $shipping_address = str_replace(',', ',<br />', $shipping_address);
    $message .= '
				<table width="100%" align="center" cellpadding="0" cellspacing="0" border="0" style="border:0px;">
					<tr>
						<td colspan="2" align="left">		
							<div class="order_info">
								<p> <span class="span"> ' . __('Order Number') . ' </span> : <strong>' . $orderinfo->trans_id . '  </strong>  <br />
									<span class="span"> ' . __('Order Date') . ' </span> : ' . date(get_option('date_format') . ' ' . get_option('time_format'), strtotime($orderinfo->ord_date)) . ' </p>
									<p><span class="span">' . __('Order Status') . '</span>  : <strong>' . fetch_order_status($orderinfo->trans_id) . '</strong> </p>
							</div> <!--order_info -->
						</td>
					</tr>
					<tr>
						<td align="left" valign="top" colspan="2">
							<div class="checkout_address" >
								<div class="address_info address_info2  fl">
									<h3>' . __('User Information') . '</h3>
									<div class="address_row"> <b>' . $orderinfo->billing_name . ' </b></div>
									<div class="address_row">' . $billing_address . ' </div>
								</div>
							</div>
						</td>
					</tr>
					<tr>
						<td align="left" valign="top" colspan="2">
							<div class="checkout_address" >
								<div class="address_info address_info2 fr">
									<h3> ' . __('Shipping Address') . '  </h3>
									<div class="address_row"> <b>' . $orderinfo->shipping_name . '</b></div>
									<div class="address_row">' . $shipping_address . '  </div>
								</div>
							</div><!-- checkout Address -->
						</td>
					</tr>			 
					<tr>
						<td align="left" valign="top" colspan="2">
							<div class="checkout_address" >
								<div class="address_info address_info2 fr">
									<h3> ' . __('Payment Information') . '  </h3>									
									<div class="address_row">' . get_payment_method($orderinfo->payment_method) . '  </div>
								</div>
							</div><!-- checkout Address -->
						 </td>
					</tr>
					<tr>
						 <td align="left" valign="top" colspan="2">
							<div class="address_info address_info2 fr">
								<h3> ' . __('Shipping Information') . '  </h3>									
								<div class="address_row">' . $orderinfo->shipping_method . '  </div>
							</div><!-- checkout Address -->
						 </td>	
					</tr>
				</table><br /><br />
			 
					 
					  
					  <h3>  ' . __('Products Information') . ' </h3>
					 
					  <table width="100%" class="table " >
 					  <tr>
					  <td width="5%" align="left" class="title" ><strong> ' . __('Image') . '</strong></td>
					  <td width="45%" align="left" class="title" ><strong> ' . __('Product Name') . '</strong></td>
					  <td width="23%" align="left" class="title" ><strong> ' . __('Qty') . '</strong></td>
					  <td width="23%" align="left" class="title" ><strong> ' . __('Prsdfice') . '</strong></td>
					  </tr>';
    $prdsql = "select * from {$wpdb->posts} where ID=\"{$orderinfo->post_id}\"";
    $prdsqlinfo = $wpdb->get_results($prdsql);
    if ($prdsqlinfo) {
        foreach ($prdsqlinfo as $prdinfoObj) {
            $data = get_post_meta($prdinfoObj->pid, 'key', true);
            $product_name = $wpdb->get_var("select post_title from {$wpdb->posts} where ID=\"" . $orderinfo->post_id . "\"");
            global $Product;
            $post->ID = $orderinfo->post_id;
            //$product_image_arr = $Product->get_product_image($post);
            //$product_image = $product_image_arr[0];
            get_post_meta($post->ID, 'file_name', true);
            $message .= '<tr>';
            if (get_post_meta($post->ID, 'file_name', true) != "") {
                $message .= '<td class="row1"><a href="' . get_permalink($orderinfo->post_id) . '"><img src="' . templ_thumbimage_filter(get_post_meta($post->ID, 'file_name', true), 75, 75) . '" width=60 height=60 /></a></td>';
            } else {
                $message .= '<td class="row1"><img src="' . get_template_directory_uri() . '/images/no-image.png" width=60 height=60 /></td>';
            }
            $message .= '  <td class="row1" ><strong><a href="' . get_permalink($orderinfo->post_id) . '">' . $product_name . '</a>';
            if ($prdinfoObj->pdesc) {
                $message .= '(' . $prdinfoObj->pdesc . ')';
            }
            if ($data['model']) {
                $message .= '<br>' . __('code : ') . $data['model'];
            }
            $totalprc = $orderinfo->payable_amt;
            $message .= '</strong></td>
									  <td class="row1 " align="left" >1</td>
									  <td class="row1 tprice"  align="left">' . $totalprc . '</td>
									  </tr>';
        }
    }
    if ($orderinfo->discount_amt > 0) {
        $message .= '<tr>
					  <td colspan="4" align="right" class="row1" ><strong> ' . __('Discount Amount') . ' :</strong> </td>
					  <td class="row1 tprice">- ' . $this->get_amount_format($orderinfo->discount_amt) . '</td>
					  </tr>';
    }
    if ($orderinfo->shipping_amt > 0) {
        $message .= '<tr>
					  <td colspan="4" align="right" class="row1" ><strong>' . $orderinfo->shipping_method . '  ' . __('Amount') . ' :</strong> </td>
					  <td class="row1 tprice">+ ' . $this->get_amount_format($orderinfo->shipping_amt) . '</td>
					  </tr>';
    }
    if ($orderinfo->tax_amount > 0) {
        $message .= '<tr>
					  <td colspan="4" align="right" class="row1" ><strong> ' . $orderinfo->tax_desc . ' : </strong></td>
					  <td class="row1 tprice">+ ' . $this->get_amount_format($orderinfo->tax_amount) . '</td>
					  </tr>';
    }
    $message .= '<tr>
					  <td colspan="3" align="right" class="row2" ><strong> ' . __('Total Payable Amount') . ' :</strong>  </td>
					  <td class="total_price" ><strong>' . $orderinfo->payable_amt . " " . get_option('currency_sym') . '</strong></td>
					  </tr>';
    if ($orderinfo->ord_desc_client) {
        $message .= '<tr><td colspan="4" height="10"  align="left" ></td></tr><tr>
					  <td colspan="1"  align="left" ><strong> ' . __('Order&nbsp;Comments') . '&nbsp;:</strong>  </td>
					  <td colspan="3" align="left" >' . nl2br(stripslashes($orderinfo->ord_desc_client)) . '</td>
					  </tr><tr><td colspan="4" height="10"  align="left" ></td></tr>';
    }
    if ($isshow_paydetail) {
        if ($payment_info['paydeltype'] == 'prebanktransfer') {
            $order_id = $order_info['order_id'];
            $order_amt = $order_info['payable_amt'];
            $paymentupdsql = "select option_value from {$wpdb->options} where option_name='payment_method_" . $payment_info['paydeltype'] . "'";
            $paymentupdinfo = $wpdb->get_results($paymentupdsql);
            $paymentInfo = unserialize($paymentupdinfo[0]->option_value);
            $payOpts = $paymentInfo['payOpts'];
            $bankInfo = $payOpts[0]['value'];
            $accountinfo = $payOpts[1]['value'];
            $message .= ' 
						   <p> ' . __('Please transfer amount of') . ' <u>' . $order_payable_amt . '</u>  ' . __('to out bank with following information') . ':</p>
						 <p>  ' . __('payment for Order Number') . ' : ' . $order_id . ' &nbsp;&nbsp;(' . date(get_option('date_format') . ' ' . get_option('time_format'), strtotime($order_info['order_date'])) . ')</p>
						 <p> ' . __('Bank Name') . ' : ' . $bankInfo . '</p>
						 <p> ' . __('Account Number') . ' : ' . $accountinfo . '</p>
						 
						   ';
        }
    }
    $message .= '</table>
					  ';
    return $message;
}
            ?>
</div></a></td>
          <td><?php 
            echo $orderinfoObj->payable_amt . " " . get_option('curremcy_sym');
            ?>
</td>
          <td><?php 
            echo $orderinfoObj->payment_method;
            ?>
</td>
          <td><?php 
            echo date('Y/m/d', strtotime($orderinfoObj->payment_date));
            ?>
</td>
          <td><?php 
            echo fetch_order_status($orderinfoObj->trans_id);
            ?>
</td>
          <td>&nbsp;</td>
        </tr>
    <?php 
        }
    }
    ?>
            <tr>
              <td colspan="8">&nbsp;</td>
            </tr>
            <tr>
              <td colspan="5"><?php 
    echo SET_STATUS_TO . " : ";
    ?>