本文整理汇总了PHP中WC_Order::get_formatted_billing_address方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Order::get_formatted_billing_address方法的具体用法?PHP WC_Order::get_formatted_billing_address怎么用?PHP WC_Order::get_formatted_billing_address使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WC_Order
的用法示例。
在下文中一共展示了WC_Order::get_formatted_billing_address方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
}
?>
</div>
</div>
</div>
<div class="dokan-left" style="width:49%; margin-right:2%">
<div class="dokan-panel dokan-panel-default">
<div class="dokan-panel-heading"><strong><?php
_e('Billing Address', 'dokan');
?>
</strong></div>
<div class="dokan-panel-body">
<?php
echo $order->get_formatted_billing_address();
?>
</div>
</div>
</div>
<div class="dokan-left" style="width:49%;">
<div class="dokan-panel dokan-panel-default">
<div class="dokan-panel-heading"><strong><?php
_e('Shipping Address', 'dokan');
?>
</strong></div>
<div class="dokan-panel-body">
<?php
echo $order->get_formatted_shipping_address();
?>
示例2: States
/**
* Test: get_formatted_billing_address
*/
function test_get_formatted_billing_address()
{
$object = new WC_Order();
$object->set_billing_first_name('Fred');
$object->set_billing_last_name('Flintstone');
$object->set_billing_company('Bedrock Ltd.');
$object->set_billing_address_1('34 Stonepants avenue');
$object->set_billing_address_2('Rockville');
$object->set_billing_city('Bedrock');
$object->set_billing_state('Boulder');
$object->set_billing_postcode('00001');
$object->set_billing_country('US');
$this->assertEquals('Fred Flintstone<br/>Bedrock Ltd.<br/>34 Stonepants avenue<br/>Rockville<br/>Bedrock, BOULDER 00001<br/>United States (US)', $object->get_formatted_billing_address());
}
示例3: woocommerce_custom_order_columns
/**
* Values for the custom columns on the orders page.
*
* @access public
* @param mixed $column
* @return void
*/
function woocommerce_custom_order_columns($column)
{
global $post, $woocommerce, $the_order;
if (empty($the_order) || $the_order->id != $post->ID) {
$the_order = new WC_Order($post->ID);
}
switch ($column) {
case "order_status":
printf('<mark class="%s tips" data-tip="%s">%s</mark>', sanitize_title($the_order->status), esc_html__($the_order->status, 'woocommerce'), esc_html__($the_order->status, 'woocommerce'));
break;
case "order_title":
if ($the_order->user_id) {
$user_info = get_userdata($the_order->user_id);
}
if (!empty($user_info)) {
$user = '<a href="user-edit.php?user_id=' . absint($user_info->ID) . '">';
if ($user_info->first_name || $user_info->last_name) {
$user .= esc_html($user_info->first_name . ' ' . $user_info->last_name);
} else {
$user .= esc_html($user_info->display_name);
}
$user .= '</a>';
} else {
$user = __('Guest', 'woocommerce');
}
echo '<a href="' . admin_url('post.php?post=' . absint($post->ID) . '&action=edit') . '"><strong>' . sprintf(__('Order %s', 'woocommerce'), esc_attr($the_order->get_order_number())) . '</strong></a> ' . __('made by', 'woocommerce') . ' ' . $user;
if ($the_order->billing_email) {
echo '<small class="meta">' . __('Email:', 'woocommerce') . ' ' . '<a href="' . esc_url('mailto:' . $the_order->billing_email) . '">' . esc_html($the_order->billing_email) . '</a></small>';
}
if ($the_order->billing_phone) {
echo '<small class="meta">' . __('Tel:', 'woocommerce') . ' ' . esc_html($the_order->billing_phone) . '</small>';
}
break;
case "billing_address":
if ($the_order->get_formatted_billing_address()) {
echo '<a target="_blank" href="' . esc_url('http://maps.google.com/maps?&q=' . urlencode($the_order->get_billing_address()) . '&z=16') . '">' . esc_html(preg_replace('#<br\\s*/?>#i', ', ', $the_order->get_formatted_billing_address())) . '</a>';
} else {
echo '–';
}
if ($the_order->payment_method_title) {
echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($the_order->payment_method_title) . '</small>';
}
break;
case "shipping_address":
if ($the_order->get_formatted_shipping_address()) {
echo '<a target="_blank" href="' . esc_url('http://maps.google.com/maps?&q=' . urlencode($the_order->get_shipping_address()) . '&z=16') . '">' . esc_html(preg_replace('#<br\\s*/?>#i', ', ', $the_order->get_formatted_shipping_address())) . '</a>';
} else {
echo '–';
}
if ($the_order->shipping_method_title) {
echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($the_order->shipping_method_title) . '</small>';
}
break;
case "total_cost":
echo esc_html(strip_tags($the_order->get_formatted_order_total()));
break;
case "order_date":
if ('0000-00-00 00:00:00' == $post->post_date) {
$t_time = $h_time = __('Unpublished', 'woocommerce');
} else {
$t_time = get_the_time(__('Y/m/d g:i:s A', 'woocommerce'), $post);
$gmt_time = strtotime($post->post_date_gmt . ' UTC');
$time_diff = current_time('timestamp', 1) - $gmt_time;
if ($time_diff > 0 && $time_diff < 24 * 60 * 60) {
$h_time = sprintf(__('%s ago', 'woocommerce'), human_time_diff($gmt_time, current_time('timestamp', 1)));
} else {
$h_time = get_the_time(__('Y/m/d', 'woocommerce'), $post);
}
}
echo '<abbr title="' . esc_attr($t_time) . '">' . esc_html(apply_filters('post_date_column_time', $h_time, $post)) . '</abbr>';
break;
case "order_actions":
?>
<p>
<?php
do_action('woocommerce_admin_order_actions_start', $the_order);
$actions = array();
if (in_array($the_order->status, array('pending', 'on-hold'))) {
$actions['processing'] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce-mark-order-processing&order_id=' . $post->ID), 'woocommerce-mark-order-processing'), 'name' => __('Processing', 'woocommerce'), 'action' => "processing");
}
if (in_array($the_order->status, array('pending', 'on-hold', 'processing'))) {
$actions['complete'] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce-mark-order-complete&order_id=' . $post->ID), 'woocommerce-mark-order-complete'), 'name' => __('Complete', 'woocommerce'), 'action' => "complete");
}
$actions['view'] = array('url' => admin_url('post.php?post=' . $post->ID . '&action=edit'), 'name' => __('View', 'woocommerce'), 'action' => "view");
$actions = apply_filters('woocommerce_admin_order_actions', $actions, $the_order);
foreach ($actions as $action) {
$image = isset($action['image_url']) ? $action['image_url'] : $woocommerce->plugin_url() . '/assets/images/icons/' . $action['action'] . '.png';
printf('<a class="button tips" href="%s" data-tip="%s"><img src="%s" alt="%s" width="14" /></a>', esc_url($action['url']), esc_attr($action['name']), esc_attr($image), esc_attr($action['name']));
}
do_action('woocommerce_admin_order_actions_end', $the_order);
?>
</p><?php
//.........这里部分代码省略.........
示例4: check_type_of_product
function check_type_of_product($order_id)
{
create_xero_invoice($order_id);
if (!is_Null) {
$order = NULL;
}
global $post;
$order = new WC_Order($order_id);
$items = $order->get_items();
$OrderItemIds = array_keys($items);
$numberOfItems = $order->get_item_count();
$counter = 0;
foreach ($items as $item) {
$orderItemId = $OrderItemIds[$counter];
$product = $order->get_product_from_item($item);
$productAttributes = $product->get_attributes();
if (!is_null($productAttributes['webinarid']['value'])) {
$webinarId = $productAttributes['webinarid']['value'];
} else {
$webinarId = NULL;
}
if (!is_null($webinarId)) {
$billingAddress = $order->get_formatted_billing_address();
$firstName = $item['item_meta']['firstName'][0];
$lastName = $item['item_meta']['lastName'][0];
$email = $item['item_meta']['email'][0];
$citrix = new CitrixAPI('5d8ab3cea37233d7d97dc1db5994fc9c', '8876575418305764356');
$registerAttendee = $citrix->createRegistrant($webinarId, $firstName, $lastName, $email);
} else {
$userID = $order->customer_user;
$adviserEmail = $order->billing_email;
$billingAddressFormatted = $order->get_formatted_billing_address();
$billingAddress = $order->get_billing_address();
$billingName = $order->billing_first_name . ' ' . $order->billing_last_name;
//$billingFormatted;//
$billingCompany = $order->billing_company;
$billing_phone = $order->billing_phone;
if (!is_null($order->billing_address_1)) {
$billingAddress1 = $order->billing_address_1;
} else {
$billingAddress1 = '';
}
if (!is_null($order->billing_address_2)) {
$billingAddress2 = $order->billing_address_2;
} else {
$billingAddress2 = '';
}
if (!is_null($order->billing_city)) {
$billingCity = $order->billing_city;
} else {
$billingCity = '';
}
if (!is_null($order->billing_state)) {
$billingState = $order->billing_state;
} else {
$billingState = '';
}
if (!is_null($order->billing_postcode)) {
$billingPostcode = $order->billing_postcode;
} else {
$billingPostcode = '';
}
//if virtual product, post data to server as well.
//$isVirtual = $product->is_virtual();
//if($isVirtual){
//$emailToAdmin = 0;
//post_item_data_to_server($order_id, $orderItemId, $adviserEmail, $userID, $item, $billingAddressFormatted, $billingAddress, $billingName, $billingCompany, $billing_phone, $billingAddress1, $billingAddress2, $billingCity, $billingState, $billingPostcode, $emailToAdmin);
//}
//24 April 2014 - Altered so that all orders post data when complete so that I can auto-complete all orders, not just electronic ones.
post_item_data_to_server($order_id, $orderItemId, $adviserEmail, $userID, $item, $billingAddressFormatted, $billingAddress, $billingName, $billingCompany, $billing_phone, $billingAddress1, $billingAddress2, $billingCity, $billingState, $billingPostcode, $emailToAdmin);
generate_docs_on_data_server($order_id, $orderItemId, $product, $adviserEmail, $userID, $item, $billingAddressFormatted, $billingAddress, $billingName, $billingCompany, $billing_phone, $billingAddress1, $billingAddress2, $billingCity, $billingState, $billingPostcode);
}
$counter = $counter + 1;
}
$order = NULL;
}
示例5: sm_woo_get_packing_slip
//.........这里部分代码省略.........
position: relative;
top:-30pt;
}
.producthead{
text-align: left;
}
.pricehead{
text-align: right;
}
.sm_address_div{
position: relative;
left:28pt;
}
.sm_email_span{
position: relative;
left:10pt;
}
</style>
<?php
$counter = 0;
foreach ($purchase_id_arr as $purchase_id_value) {
$order = new WC_Order($purchase_id_value);
$date_format = get_option('date_format');
if (is_plugin_active('woocommerce-sequential-order-numbers-pro/woocommerce-sequential-order-numbers.php')) {
$purchase_display_id = isset($order->order_custom_fields['_order_number_formatted'][0]) ? $order->order_custom_fields['_order_number_formatted'][0] : $purchase_id_value;
} else {
$purchase_display_id = $purchase_id_value;
}
$counter++;
if (count($purchase_id_arr) == $counter) {
echo '<div id="wrapper_last">';
} else {
echo '<div id="wrapper">';
}
echo smart_manager_print_logo();
echo '<div style="margin-top:-0.8em;">';
echo '<h4 style="font:bold 1.2em/2em "Century Gothic","Trebuchet MS",Arial,Helvetica,sans-serif;
position:relative; 12pt;"> ' . get_bloginfo('name') . '</h4>';
echo '<table class="address" style="position:relative; top:-22pt; left:-35pt;">';
echo '<tr><td class="address_border" colspan="2" valign="top" width="50%"><span style="position:relative; left:27pt; top:10pt;">
<b>Order # ' . $purchase_display_id . ' - ' . date($date_format, strtotime($order->order_date)) . '</b></span><br/></td></tr>';
echo '<tr><td class="address_border" width="35%" align="center"><br/><div class="sm_address_div">';
$formatted_billing_address = $order->get_formatted_billing_address();
if ($formatted_billing_address != '') {
echo '<b>' . __('Billing Address', 'smart-manager') . '</b><p>';
echo $formatted_billing_address;
echo '</p></td>';
}
$formatted_shipping_address = $order->get_formatted_shipping_address();
if ($formatted_shipping_address != '') {
echo '<td class="address_border" width="30%"><br/><div style="position:relative; top:3pt;"><b>' . __('Shipping Address', 'smart-manager') . '</b><p>';
echo $formatted_shipping_address;
echo '</p></div></td>';
}
echo '</tr>';
echo '<tr><td colspan="2" class="address_border"><span class="sm_email_span"><table class="address"><tr><td colspan="2" class="address_border" >
<b>' . __('Email id', 'smart-manager') . ':</b> ' . $order->billing_email . '</td></tr>
<tr><td class="address_border"><b>' . __('Tel', 'smart-manager') . ' :</b> ' . $order->billing_phone . '</td></tr></table> </span></td></tr>';
echo '</table>';
echo '<div class="datagrid"><table><tr class="column1">
<td class="producthead">' . __('Product', 'smart-manager') . '</td><td>' . __('SKU', 'smart-manager') . '</td>
<td>' . __('Quantity', 'smart-manager') . '</td><td class="pricehead">' . __('Price', 'smart-manager') . '</td></tr>';
foreach ($order->get_items() as $item) {
$_product = $order->get_product_from_item($item);
$sku = $variation = '';
$sku = $_product->get_sku();
$formatted_variation = woocommerce_get_formatted_variation($_product->variation_data, true);
$variation = !empty($formatted_variation) ? ' (' . $formatted_variation . ')' : '';
$item_total = $_product->get_price() * $item['item_meta']['_qty'][0];
$total_order += $item_total;
echo '<tr><td class="producthead">';
echo $item['name'] . $variation;
echo '</td><td>' . $sku . '</td><td>';
echo $item['item_meta']['_qty'][0];
echo '</td><td class="pricehead">';
echo woocommerce_price($item_total);
echo '</td></tr>';
}
echo '<tr><td colspan="2" rowspan="5" class="address_border" valign="top"><br/>
<i>' . ($order->customer_note != '' ? __('Order Notes', 'smart-manager') . ' : ' . $order->customer_note : '') . '</i></td><td style="text-align:right;" class="address_border" valign="top">
<b>Subtotal </b></td><td class="pricehead">' . $order->get_subtotal_to_display() . '</td></tr>';
echo '<tr><td style="text-align:right;" class="address_border"><b>' . __('Shipping', 'smart-manager') . ' </b></td><td class="pricehead">' . $order->get_shipping_to_display() . '</td></tr>';
if ($order->cart_discount > 0) {
echo '<tr><td style="text-align:right;" class="address_border">' . __('Cart Discount', 'smart-manager') . '</td><td style="text-align:right;">';
echo woocommerce_price($order->cart_discount);
echo '</td></tr>';
}
if ($order->order_discount > 0) {
echo '<tr><td style="text-align:right;" class="address_border"><b>' . __('Order Discount', 'smart-manager') . ' </b></td>';
echo '<td class="pricehead">' . woocommerce_price($order->order_discount) . '</td></tr>';
}
echo '<tr><td style="text-align:right;" class="address_border"><b>' . __('Tax', 'smart-manager') . ' </b></td><td class="pricehead">' . woocommerce_price($order->get_total_tax()) . '</td></tr>';
echo '<tr><td class="column1" style="text-align:right;"><b>' . __('Total', 'smart-manager') . ' </b></td><td class="column1" style="text-align:right;">' . woocommerce_price($order->order_total) . ' -via ' . $order->payment_method_title . '</td></tr>';
echo '</table></div></div></div>';
}
}
exit;
}
示例6: custom_columns
/**
* Define our custom columns shown in admin.
* @param string $column
*/
public function custom_columns($column)
{
global $post, $woocommerce, $the_order;
if (empty($the_order) || $the_order->id != $post->ID) {
$the_order = new WC_Order($post->ID);
}
switch ($column) {
case 'order_status':
printf('<mark class="%s tips" data-tip="%s">%s</mark>', sanitize_title($the_order->status), esc_html__($the_order->status, 'woocommerce'), esc_html__($the_order->status, 'woocommerce'));
break;
case 'order_date':
if ('0000-00-00 00:00:00' == $post->post_date) {
$t_time = $h_time = __('Unpublished', 'woocommerce');
} else {
$t_time = get_the_time(__('Y/m/d g:i:s A', 'woocommerce'), $post);
$gmt_time = strtotime($post->post_date_gmt . ' UTC');
$time_diff = current_time('timestamp', 1) - $gmt_time;
$h_time = get_the_time(__('Y/m/d', 'woocommerce'), $post);
}
echo '<abbr title="' . esc_attr($t_time) . '">' . esc_html(apply_filters('post_date_column_time', $h_time, $post)) . '</abbr>';
break;
case 'customer_message':
if ($the_order->customer_message) {
echo '<span class="note-on tips" data-tip="' . esc_attr($the_order->customer_message) . '">' . __('Yes', 'woocommerce') . '</span>';
} else {
echo '<span class="na">–</span>';
}
break;
case 'billing_address':
if ($the_order->get_formatted_billing_address()) {
echo '<a target="_blank" href="' . esc_url('http://maps.google.com/maps?&q=' . urlencode($the_order->get_billing_address()) . '&z=16') . '">' . esc_html(preg_replace('#<br\\s*/?>#i', ', ', $the_order->get_formatted_billing_address())) . '</a>';
} else {
echo '–';
}
if ($the_order->payment_method_title) {
echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($the_order->payment_method_title) . '</small>';
}
break;
case 'order_items':
echo '<a href="#" class="show_order_items">' . apply_filters('woocommerce_admin_order_item_count', sprintf(_n('%d item', '%d items', $the_order->get_item_count(), 'woocommerce'), $the_order->get_item_count()), $the_order) . '</a>';
if (sizeof($the_order->get_items()) > 0) {
echo '<table class="order_items" cellspacing="0">';
foreach ($the_order->get_items() as $item) {
$_product = apply_filters('woocommerce_order_item_product', $the_order->get_product_from_item($item), $item);
$item_meta = new WC_Order_Item_Meta($item['item_meta']);
$item_meta_html = $item_meta->display(true, true);
?>
<tr class="<?php
echo apply_filters('woocommerce_admin_order_item_class', '', $item);
?>
">
<td class="qty"><?php
echo absint($item['qty']);
?>
</td>
<td class="name">
<?php
if (wc_product_sku_enabled() && $_product && $_product->get_sku()) {
echo $_product->get_sku() . ' - ';
}
echo apply_filters('woocommerce_order_item_name', $item['name'], $item);
?>
<?php
if ($item_meta_html) {
?>
<a class="tips" href="#" data-tip="<?php
echo esc_attr($item_meta_html);
?>
">[?]</a>
<?php
}
?>
</td>
</tr>
<?php
}
echo '</table>';
} else {
echo '–';
}
break;
case 'shipping_address':
if ($the_order->get_formatted_shipping_address()) {
echo '<a target="_blank" href="' . esc_url('http://maps.google.com/maps?&q=' . urlencode($the_order->get_shipping_address()) . '&z=16') . '">' . esc_html(preg_replace('#<br\\s*/?>#i', ', ', $the_order->get_formatted_shipping_address())) . '</a>';
} else {
echo '–';
}
if ($the_order->get_shipping_method()) {
echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($the_order->get_shipping_method()) . '</small>';
}
break;
case 'order_notes':
if ($post->comment_count) {
// check the status of the post
$post->post_status !== 'trash' ? $status = '' : ($status = 'post-trashed');
$latest_notes = get_comments(array('post_id' => $post->ID, 'number' => 1, 'status' => $status));
//.........这里部分代码省略.........
示例7:
*/
//Add callback to Hyggligs system to validate Order
require '../../../../wp-load.php';
$store_Post = $_POST;
$order_id = $_POST['orderReference'];
$order = new WC_Order($order_id);
$options = get_option('woocommerce_hygglig_checkout_settings');
$log = new WC_Logger();
//Live or test
if ($options['testmode'] == 'yes') {
$url = "http://sandbox.hygglig.com/";
} else {
$url = "https://www.hygglig.com/";
}
// Billing
if (strlen($order->get_formatted_billing_address()) < 10) {
$order->set_address(array('first_name' => $_POST['firstName'], 'last_name' => $_POST['lastName'], 'address_1' => $_POST['address'], 'city' => $_POST['city'], 'postcode' => $_POST['postalCode'], 'email' => $_POST['email'], 'phone' => $_POST['phoneNumber']));
}
// Shipping
if (strlen($order->get_formatted_shipping_address()) < 10) {
$order->set_address(array('first_name' => $_POST['firstName'], 'last_name' => $_POST['lastName'], 'address_1' => $_POST['address'], 'city' => $_POST['city'], 'postcode' => $_POST['postalCode']), 'shipping');
}
$order->payment_complete($_POST['orderNumber']);
update_post_meta($order_id, '_payment_method', 'Hygglig');
update_post_meta($order_id, '_payment_method_title', 'Hygglig');
if ($options['debug'] == 'yes') {
$log->add('marginalen', "Payment for Order #" . $order_id . " completed. Stocks reduced.");
}
// Store user id in order so the user can keep track of track it in My account
if (email_exists($order->billing_email)) {
if ($options['debug'] == 'yes') {
示例8: woocommerce_custom_order_columns
function woocommerce_custom_order_columns($column)
{
global $post, $woocommerce;
$order = new WC_Order($post->ID);
switch ($column) {
case "order_status":
echo sprintf('<mark class="%s">%s</mark>', sanitize_title($order->status), __($order->status, 'woocommerce'));
break;
case "order_title":
if ($order->user_id) {
$user_info = get_userdata($order->user_id);
}
if (isset($user_info) && $user_info) {
$user = '<a href="user-edit.php?user_id=' . esc_attr($user_info->ID) . '">';
if ($user_info->first_name || $user_info->last_name) {
$user .= $user_info->first_name . ' ' . $user_info->last_name;
} else {
$user .= esc_html($user_info->display_name);
}
$user .= '</a>';
} else {
$user = __('Guest', 'woocommerce');
}
echo '<a href="' . admin_url('post.php?post=' . $post->ID . '&action=edit') . '"><strong>' . sprintf(__('Order #%s', 'woocommerce'), $post->ID) . '</strong></a> ' . __('made by', 'woocommerce') . ' ' . $user;
if ($order->billing_email) {
echo '<small class="meta">' . __('Email:', 'woocommerce') . ' ' . '<a href="' . esc_url('mailto:' . $order->billing_email) . '">' . esc_html($order->billing_email) . '</a></small>';
}
if ($order->billing_phone) {
echo '<small class="meta">' . __('Tel:', 'woocommerce') . ' ' . esc_html($order->billing_phone) . '</small>';
}
break;
case "billing_address":
if ($order->get_formatted_billing_address()) {
echo '<a target="_blank" href="' . esc_url('http://maps.google.com/maps?&q=' . urlencode($order->get_billing_address()) . '&z=16') . '">' . preg_replace('#<br\\s*/?>#i', ', ', $order->get_formatted_billing_address()) . '</a>';
} else {
echo '–';
}
if ($order->payment_method_title) {
echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($order->payment_method_title) . '</small>';
}
break;
case "shipping_address":
if ($order->get_formatted_shipping_address()) {
echo '<a target="_blank" href="' . esc_url('http://maps.google.com/maps?&q=' . urlencode($order->get_shipping_address()) . '&z=16') . '">' . preg_replace('#<br\\s*/?>#i', ', ', $order->get_formatted_shipping_address()) . '</a>';
} else {
echo '–';
}
if ($order->shipping_method_title) {
echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($order->shipping_method_title) . '</small>';
}
break;
case "total_cost":
echo woocommerce_price($order->order_total);
break;
case "order_date":
if ('0000-00-00 00:00:00' == $post->post_date) {
$t_time = $h_time = __('Unpublished', 'woocommerce');
} else {
$t_time = get_the_time(__('Y/m/d g:i:s A', 'woocommerce'), $post);
$gmt_time = strtotime($post->post_date_gmt);
$time_diff = current_time('timestamp', 1) - $gmt_time;
if ($time_diff > 0 && $time_diff < 24 * 60 * 60) {
$h_time = sprintf(__('%s ago', 'woocommerce'), human_time_diff($gmt_time, current_time('timestamp', 1)));
} else {
$h_time = get_the_time(__('Y/m/d', 'woocommerce'), $post);
}
}
echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post) . '</abbr>';
break;
case "order_actions":
?>
<p>
<?php
if (in_array($order->status, array('pending', 'on-hold'))) {
?>
<a class="button" href="<?php
echo wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce-mark-order-processing&order_id=' . $post->ID), 'woocommerce-mark-order-processing');
?>
"><?php
_e('Processing', 'woocommerce');
?>
</a><?php
}
?>
<?php
if (in_array($order->status, array('pending', 'on-hold', 'processing'))) {
?>
<a class="button" href="<?php
echo wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce-mark-order-complete&order_id=' . $post->ID), 'woocommerce-mark-order-complete');
?>
"><?php
_e('Complete', 'woocommerce');
?>
</a><?php
}
?>
<a class="button" href="<?php
echo admin_url('post.php?post=' . $post->ID . '&action=edit');
?>
"><?php
//.........这里部分代码省略.........
示例9: woocommerce_order_data_meta_box
//.........这里部分代码省略.........
$users = new WP_User_Query(array('orderby' => 'display_name'));
$users = $users->get_results();
if ($users) {
foreach ($users as $user) {
echo '<option value="' . $user->ID . '" ';
selected($customer_user, $user->ID);
echo '>' . $user->display_name . ' (' . $user->user_email . ')</option>';
}
}
?>
</select></p>
<p class="form-field form-field-wide"><label for="excerpt"><?php
_e('Customer Note:', 'woocommerce');
?>
</label>
<textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt" placeholder="<?php
_e('Customer\'s notes about the order', 'woocommerce');
?>
"><?php
echo $post->post_excerpt;
?>
</textarea></p>
</div>
<div class="order_data_right">
<div class="order_data">
<h2><?php
_e('Billing Details', 'woocommerce');
?>
<a class="edit_address" href="#">(<?php
_e('Edit', 'woocommerce');
?>
)</a></h2>
<?php
$billing_data = apply_filters('woocommerce_admin_billing_fields', array('first_name' => array('label' => __('First Name', 'woocommerce'), 'show' => false), 'last_name' => array('label' => __('Last Name', 'woocommerce'), 'show' => false), 'company' => array('label' => __('Company', 'woocommerce'), 'show' => false), 'address_1' => array('label' => __('Address 1', 'woocommerce'), 'show' => false), 'address_2' => array('label' => __('Address 2', 'woocommerce'), 'show' => false), 'city' => array('label' => __('City', 'woocommerce'), 'show' => false), 'postcode' => array('label' => __('Postcode', 'woocommerce'), 'show' => false), 'country' => array('label' => __('Country', 'woocommerce'), 'show' => false), 'state' => array('label' => __('State/County', 'woocommerce'), 'show' => false), 'email' => array('label' => __('Email', 'woocommerce')), 'phone' => array('label' => __('Phone', 'woocommerce'))));
// Display values
echo '<div class="address">';
if ($order->get_formatted_billing_address()) {
echo '<p><strong>' . __('Address', 'woocommerce') . ':</strong><br/> ' . $order->get_formatted_billing_address() . '</p>';
} else {
echo '<p class="none_set"><strong>' . __('Address', 'woocommerce') . ':</strong> ' . __('No billing address set.', 'woocommerce') . '</p>';
}
foreach ($billing_data as $key => $field) {
if (isset($field['show']) && !$field['show']) {
continue;
}
$field_name = 'billing_' . $key;
echo '<p><strong>' . $field['label'] . ':</strong> ' . $order->{$field_name} . '</p>';
}
echo '</div>';
// Display form
echo '<div class="edit_address"><p><button class="button load_customer_billing">' . __('Load customer billing address', 'woocommerce') . '</button></p>';
foreach ($billing_data as $key => $field) {
woocommerce_wp_text_input(array('id' => '_billing_' . $key, 'label' => $field['label']));
}
echo '</div>';
?>
</div>
<div class="order_data order_data_alt">
<h2><?php
_e('Shipping Details', 'woocommerce');
?>
<a class="edit_address" href="#">(<?php
_e('Edit', 'woocommerce');
?>
)</a></h2>
<?php
$shipping_data = apply_filters('woocommerce_admin_shipping_fields', array('first_name' => array('label' => __('First Name', 'woocommerce'), 'show' => false), 'last_name' => array('label' => __('Last Name', 'woocommerce'), 'show' => false), 'company' => array('label' => __('Company', 'woocommerce'), 'show' => false), 'address_1' => array('label' => __('Address 1', 'woocommerce'), 'show' => false), 'address_2' => array('label' => __('Address 2', 'woocommerce'), 'show' => false), 'city' => array('label' => __('City', 'woocommerce'), 'show' => false), 'postcode' => array('label' => __('Postcode', 'woocommerce'), 'show' => false), 'country' => array('label' => __('Country', 'woocommerce'), 'show' => false), 'state' => array('label' => __('State/County', 'woocommerce'), 'show' => false)));
// Display values
echo '<div class="address">';
if ($order->get_formatted_shipping_address()) {
echo '<p><strong>' . __('Address', 'woocommerce') . ':</strong><br/> ' . $order->get_formatted_shipping_address() . '</p>';
} else {
echo '<p class="none_set"><strong>' . __('Address', 'woocommerce') . ':</strong> ' . __('No shipping address set.', 'woocommerce') . '</p>';
}
foreach ($shipping_data as $key => $field) {
if (isset($field['show']) && !$field['show']) {
continue;
}
$field_name = 'shipping_' . $key;
echo '<p><strong>' . $field['label'] . ':</strong> ' . $order->{$field_name} . '</p>';
}
echo '</div>';
// Display form
echo '<div class="edit_address"><p><button class="button load_customer_shipping">' . __('Load customer shipping address', 'woocommerce') . '</button></p>';
foreach ($shipping_data as $key => $field) {
woocommerce_wp_text_input(array('id' => '_shipping_' . $key, 'label' => $field['label']));
}
echo '</div>';
?>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<?php
}
示例10: sendCustomerInvoice
//.........这里部分代码省略.........
<th scope="row" colspan="2">
<font align="left">Shipping:</font>
</th>
<td>
<font align="left">
<span class="amount">$' . $wooCommerceOrderObject->get_total_shipping() . '</span> <small>via ' . $wooCommerceOrderObject->get_shipping_method() . '</small>
</font>
</td>
</tr>
<tr>
<th scope="row" colspan="2">
<font align="left">Payment Method:</font>
</th>
<td>
<font align="left">' . $wooCommerceOrderObject->payment_method_title . '</font>
</td>
</tr>
<tr>
<th scope="row" colspan="2">
<font align="left">Order Total:</font>
</th>
<td>
<font align="left">
<span class="amount">$' . sprintf('%0.2f', $wooCommerceOrderObject->get_total()) . '</span>
</font>
</td>
</tr>
</tfoot>
</table>
<h2>
<font face="Arial" align="left" style="font-weight:bold;font-size:30px;color:#6d6d6d">Customer details</font>
</h2>
<p><strong>Email:</strong> ' . $customerMailId . '</p>
<p><strong>Tel:</strong> ' . $wooCommerceOrderObject->billing_phone . '</p>
<table cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td valign="top" width="50%">
<h3>
<font face="Arial" align="left" style="font-weight:bold;font-size:26px;color:#6d6d6d">Billing address</font>
</h3>
<p>' . $wooCommerceOrderObject->get_formatted_billing_address() . '</p>
</td>
<td valign="top" width="50%">
<h3>
<font face="Arial" align="left" style="font-weight:bold;font-size:26px;color:#6d6d6d">Shipping address</font>
</h3>
<p>' . $wooCommerceOrderObject->get_formatted_shipping_address() . '</p>
</td>
</tr>
</tbody>
</table>
</font>
</div>
</td>
</tr>
</tbody>
</table>
</font>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td align="center" valign="top">
<table border="0" cellpadding="10" cellspacing="0" width="600" id="template_footer">
<tbody>
<tr>
<td valign="top">
<table border="0" cellpadding="4" cellspacing="0" width="100%">
<tbody>
<tr>
<td colspan="2" valign="middle" id="credit" style="background-color: #777;">
<font face="Arial" align="center" style="font-size:12px;color:#bce3de">
<p>' . site_url() . '</p>
</font>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>';
$emailHeader = "Content-type: text/html";
// To send HTML mail, the Content-type header must be set
$emailHeader = 'MIME-Version: 1.0' . "\r\n";
$emailHeader .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional emailHeader
$emailHeader .= 'From: ' . get_bloginfo('name') . ' <hello@plexuser.com>' . "\r\n";
$emailSubject = "Your plexuser order receipt from " . date_i18n(wc_date_format(), strtotime($wooCommerceOrderObject->order_date));
wp_mail($customerMailId, $emailSubject, $invoice_mail_content, $emailHeader);
}