本文整理汇总了PHP中WC_Order::get_view_order_url方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Order::get_view_order_url方法的具体用法?PHP WC_Order::get_view_order_url怎么用?PHP WC_Order::get_view_order_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WC_Order
的用法示例。
在下文中一共展示了WC_Order::get_view_order_url方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
</span></th>
<th class="order-actions"> </th>
</tr>
</thead>
<tbody><?php
foreach ($customer_orders as $customer_order) {
$order = new WC_Order();
$order->populate($customer_order);
$status = get_term_by('slug', $order->status, 'shop_order_status');
$item_count = $order->get_item_count();
?>
<tr class="order">
<td class="order-number">
<a href="<?php
echo $order->get_view_order_url();
?>
">
<?php
echo $order->get_order_number();
?>
</a>
</td>
<td class="order-date">
<time datetime="<?php
echo date('Y-m-d', strtotime($order->order_date));
?>
" title="<?php
echo esc_attr(strtotime($order->order_date));
?>
"><?php
示例2: orders_actions
/**
* Added support button in order actions.
*
* @since 1.0.0
*
* @param array $actions Order actions.
* @param WC_Order $order Order data.
*
* @return array
*/
public function orders_actions($actions, $order)
{
global $woocommerce;
// Backwards compatibility for WooCommerce 2.0.x.
if (version_compare($woocommerce->version, '2.1', '>=')) {
$order_url = $order->get_view_order_url();
} else {
$order_url = add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('view_order')));
}
$actions[$this->id] = array('url' => $order_url . '#open-ticket', 'name' => __('Get Help', 'woocommerce-freshdesk'));
return $actions;
}
示例3: get_order_data
/**
* Get the order data for the given ID.
*
* @since 2.5.0
* @param WC_Order $order The order instance
* @return array
*/
protected function get_order_data($order)
{
$order_post = get_post($order->id);
$dp = wc_get_price_decimals();
$order_data = array('id' => $order->id, 'order_number' => $order->get_order_number(), 'created_at' => $this->format_datetime($order_post->post_date_gmt), 'updated_at' => $this->format_datetime($order_post->post_modified_gmt), 'completed_at' => $this->format_datetime($order->completed_date, true), 'status' => $order->get_status(), 'currency' => $order->get_order_currency(), 'total' => wc_format_decimal($order->get_total(), $dp), 'subtotal' => wc_format_decimal($order->get_subtotal(), $dp), 'total_line_items_quantity' => $order->get_item_count(), 'total_tax' => wc_format_decimal($order->get_total_tax(), $dp), 'total_shipping' => wc_format_decimal($order->get_total_shipping(), $dp), 'cart_tax' => wc_format_decimal($order->get_cart_tax(), $dp), 'shipping_tax' => wc_format_decimal($order->get_shipping_tax(), $dp), 'total_discount' => wc_format_decimal($order->get_total_discount(), $dp), 'shipping_methods' => $order->get_shipping_method(), 'payment_details' => array('method_id' => $order->payment_method, 'method_title' => $order->payment_method_title, 'paid' => isset($order->paid_date)), 'billing_address' => array('first_name' => $order->billing_first_name, 'last_name' => $order->billing_last_name, 'company' => $order->billing_company, 'address_1' => $order->billing_address_1, 'address_2' => $order->billing_address_2, 'city' => $order->billing_city, 'state' => $order->billing_state, 'postcode' => $order->billing_postcode, 'country' => $order->billing_country, 'email' => $order->billing_email, 'phone' => $order->billing_phone), 'shipping_address' => array('first_name' => $order->shipping_first_name, 'last_name' => $order->shipping_last_name, 'company' => $order->shipping_company, 'address_1' => $order->shipping_address_1, 'address_2' => $order->shipping_address_2, 'city' => $order->shipping_city, 'state' => $order->shipping_state, 'postcode' => $order->shipping_postcode, 'country' => $order->shipping_country), 'note' => $order->customer_note, 'customer_ip' => $order->customer_ip_address, 'customer_user_agent' => $order->customer_user_agent, 'customer_id' => $order->get_user_id(), 'view_order_url' => $order->get_view_order_url(), 'line_items' => array(), 'shipping_lines' => array(), 'tax_lines' => array(), 'fee_lines' => array(), 'coupon_lines' => array());
// add line items
foreach ($order->get_items() as $item_id => $item) {
$product = $order->get_product_from_item($item);
$product_id = null;
$product_sku = null;
// Check if the product exists.
if (is_object($product)) {
$product_id = isset($product->variation_id) ? $product->variation_id : $product->id;
$product_sku = $product->get_sku();
}
$meta = new WC_Order_Item_Meta($item, $product);
$item_meta = array();
foreach ($meta->get_formatted(null) as $meta_key => $formatted_meta) {
$item_meta[] = array('key' => $meta_key, 'label' => $formatted_meta['label'], 'value' => $formatted_meta['value']);
}
$order_data['line_items'][] = array('id' => $item_id, 'subtotal' => wc_format_decimal($order->get_line_subtotal($item, false, false), $dp), 'subtotal_tax' => wc_format_decimal($item['line_subtotal_tax'], $dp), 'total' => wc_format_decimal($order->get_line_total($item, false, false), $dp), 'total_tax' => wc_format_decimal($item['line_tax'], $dp), 'price' => wc_format_decimal($order->get_item_total($item, false, false), $dp), 'quantity' => wc_stock_amount($item['qty']), 'tax_class' => !empty($item['tax_class']) ? $item['tax_class'] : null, 'name' => $item['name'], 'product_id' => $product_id, 'sku' => $product_sku, 'meta' => $item_meta);
}
// Add shipping.
foreach ($order->get_shipping_methods() as $shipping_item_id => $shipping_item) {
$order_data['shipping_lines'][] = array('id' => $shipping_item_id, 'method_id' => $shipping_item['method_id'], 'method_title' => $shipping_item['name'], 'total' => wc_format_decimal($shipping_item['cost'], $dp));
}
// Add taxes.
foreach ($order->get_tax_totals() as $tax_code => $tax) {
$order_data['tax_lines'][] = array('id' => $tax->id, 'rate_id' => $tax->rate_id, 'code' => $tax_code, 'title' => $tax->label, 'total' => wc_format_decimal($tax->amount, $dp), 'compound' => (bool) $tax->is_compound);
}
// Add fees.
foreach ($order->get_fees() as $fee_item_id => $fee_item) {
$order_data['fee_lines'][] = array('id' => $fee_item_id, 'title' => $fee_item['name'], 'tax_class' => !empty($fee_item['tax_class']) ? $fee_item['tax_class'] : null, 'total' => wc_format_decimal($order->get_line_total($fee_item), $dp), 'total_tax' => wc_format_decimal($order->get_line_tax($fee_item), $dp));
}
// Add coupons.
foreach ($order->get_items('coupon') as $coupon_item_id => $coupon_item) {
$order_data['coupon_lines'][] = array('id' => $coupon_item_id, 'code' => $coupon_item['name'], 'amount' => wc_format_decimal($coupon_item['discount_amount'], $dp));
}
$order_data = apply_filters('woocommerce_cli_order_data', $order_data);
return $this->flatten_array($order_data);
}
示例4: array
//.........这里部分代码省略.........
_e('Totale', 'woocommerce');
?>
</span></th>
<th class="order-actions"><span class="nobr"><?php
_e('Prodotti / Attributi / Totale', 'woocommerce');
?>
</span></th>
<th class="order-actions"><span class="nobr"><?php
_e('Dettagli', 'woocommerce');
?>
</span></th>
<th class="order-actions"><span class="nobr"><?php
_e('Annullare', 'woocommerce');
?>
</span></th>
</tr>
</thead>
<style>
.hentry img { height: auto; max-width: 35%;}
.woocommerce-message { display:none;}
</style>
<tbody><?php
foreach ($customer_orders as $customer_order) {
$order = new WC_Order();
$order->populate($customer_order);
$status = get_term_by('slug', $order->status, 'shop_order_status');
$item_count = $order->get_item_count();
?>
<tr class="order">
<td class="order-number">
<a href="<?php
echo $order->get_view_order_url();
?>
">
<?php
echo $order->get_order_number();
?>
</a>
</td>
<td class="order-date">
<time datetime="<?php
echo date('Y-m-d', strtotime($order->order_date));
?>
" title="<?php
echo esc_attr(strtotime($order->order_date));
?>
"><?php
echo date_i18n(get_option('date_format'), strtotime($order->order_date));
?>
</time>
</td>
<td class="order-status" style="text-align:left; text-transform:uppercase; white-space:nowrap; color:#0C0" >
<?php
echo ucfirst(__($status->name, 'woocommerce'));
?>
</td>
<td class="order-total">
<?php
echo sprintf(_n('<strong>%s</strong> x <strong>%s Prodotto</strong>', '%s for %s items', $item_count, 'woocommerce'), $order->get_formatted_order_total(), $item_count);
?>
</td>
<td class="order-actions">
示例5:
/**
* Test: get_view_order_url
*/
function test_get_view_order_url()
{
$object = new WC_Order();
$id = $object->save();
$this->assertEquals('http://example.org?view-order=' . $id, $object->get_view_order_url());
}
示例6: printf
function thankyou_page()
{
global $woocommerce;
if (version_compare(WOOCOMMERCE_VERSION, '2.0.20', '>')) {
/* WC 2.1 */
global $wp;
$order_id = (int) $wp->query_vars['order-received'];
} else {
$order_id = (int) $_GET['order'];
}
$order = new WC_Order($order_id);
if ($order->status == 'processing' || $order->status == 'completed') {
if (version_compare(WOOCOMMERCE_VERSION, '2.0.20', '>')) {
/* WC 2.1 */
$url_commande = $order->get_view_order_url();
$montant_commande = wc_price($order->order_total);
} else {
$url_commande = add_query_arg('order', $order->id, get_permalink(get_option('woocommerce_view_order_page_id')));
$montant_commande = woocommerce_price($order->order_total);
}
$compte_client = get_post_meta($order->id, '_customer_user', true);
printf("<p>" . __("Votre règlement par carte bancaire de %s a bien été finalisé auprès de notre banque"), $montant_commande);
if ($compte_client > 0) {
printf(__(", <a href=\"%s\">cliquez ici</a> pour consulter votre commande.", "atos") . "</p>", $url_commande);
} else {
echo ".</p>";
}
} elseif ($order->status != 'failed') {
if (version_compare(WOOCOMMERCE_VERSION, '2.0.14', '>=')) {
/* WC 2.1 */
$payer_url = $order->get_checkout_payment_url();
} else {
$payer_url = add_query_arg('order_id', $order->id, add_query_arg('order', $order->order_key, add_query_arg('pay_for_order', 'true', get_permalink(get_option('woocommerce_pay_page_id')))));
}
printf("<p>" . __("Échec du règlement par carte bancaire de votre commande, <a href=\"%s\">cliquez ici</a> pour effectuer une nouvelle tentative de paiement.", "atos") . "</p>", $payer_url);
/* WC 2.1 */
}
}
示例7: dokan_order_show_suborders
/**
* Show sub-orders on a parent order if available
*
* @param WC_Order $parent_order
* @return void
*/
function dokan_order_show_suborders($parent_order)
{
$sub_orders = get_children(array('post_parent' => $parent_order->id, 'post_type' => 'shop_order', 'post_status' => array('wc-pending', 'wc-completed', 'wc-processing', 'wc-on-hold')));
if (!$sub_orders) {
return;
}
?>
<header>
<h2><?php
_e('Sub Orders', 'dokan');
?>
</h2>
</header>
<div class="dokan-info">
<strong><?php
_e('Note:', 'dokan');
?>
</strong>
<?php
_e('This order has products from multiple vendors/sellers. So we divided this order into multiple seller orders.
Each order will be handled by their respective seller independently.', 'dokan');
?>
</div>
<table class="shop_table my_account_orders table table-striped">
<thead>
<tr>
<th class="order-number"><span class="nobr"><?php
_e('Order', 'dokan');
?>
</span></th>
<th class="order-date"><span class="nobr"><?php
_e('Date', 'dokan');
?>
</span></th>
<th class="order-status"><span class="nobr"><?php
_e('Status', 'dokan');
?>
</span></th>
<th class="order-total"><span class="nobr"><?php
_e('Total', 'dokan');
?>
</span></th>
<th class="order-actions"> </th>
</tr>
</thead>
<tbody>
<?php
$statuses = wc_get_order_statuses();
foreach ($sub_orders as $order_post) {
$order = new WC_Order($order_post->ID);
$item_count = $order->get_item_count();
?>
<tr class="order">
<td class="order-number">
<a href="<?php
echo $order->get_view_order_url();
?>
">
<?php
echo $order->get_order_number();
?>
</a>
</td>
<td class="order-date">
<time datetime="<?php
echo date('Y-m-d', strtotime($order->order_date));
?>
" title="<?php
echo esc_attr(strtotime($order->order_date));
?>
"><?php
echo date_i18n(get_option('date_format'), strtotime($order->order_date));
?>
</time>
</td>
<td class="order-status" style="text-align:left; white-space:nowrap;">
<?php
echo isset($statuses[$order->post_status]) ? $statuses[$order->post_status] : $order->post_status;
?>
</td>
<td class="order-total">
<?php
echo sprintf(_n('%s for %s item', '%s for %s items', $item_count, 'woocommerce'), $order->get_formatted_order_total(), $item_count);
?>
</td>
<td class="order-actions">
<?php
$actions = array();
$actions['view'] = array('url' => $order->get_view_order_url(), 'name' => __('View', 'dokan'));
$actions = apply_filters('dokan_my_account_my_sub_orders_actions', $actions, $order);
foreach ($actions as $key => $action) {
//.........这里部分代码省略.........
示例8: my_method
function my_method($order_id)
{
$order = new WC_Order($order_id);
error_log($order->get_view_order_url());
}
示例9: sprintf
/**
* This part is returnurl function for the payment gateway
*
* @global mixed $woocommerce
*/
function check_dragonpay_response_returnurl()
{
global $woocommerce;
$amount = $_POST['amount'];
$orderid = $_POST['orderid'];
$appcode = $_POST['appcode'];
$tranID = $_POST['tranID'];
$domain = $_POST['domain'];
$status = $_POST['status'];
$currency = $_POST['currency'];
$paydate = $_POST['paydate'];
$channel = $_POST['channel'];
$skey = $_POST['skey'];
$vkey = $this->password;
$order = new WC_Order($orderid);
$key0 = md5($tranID . $orderid . $status . $domain . $amount . $currency);
$key1 = md5($paydate . $domain . $key0 . $appcode . $vkey);
$referer = "<br>Referer: ReturnURL";
if ($status == "00") {
// Invalid transaction
if ($skey != $key1) {
$order->add_order_note('Dragonpay Payment Status: FAILED' . '<br>Transaction ID: ' . $tranID . $referer);
$order->update_status('failed', sprintf(__('Payment %s via Dragonpay.', 'woocommerce'), $tranID));
$woocommerce->cart->empty_cart();
wp_redirect($order->get_view_order_url());
//wp_redirect($order->get_cancel_order_url());
} else {
$order->add_order_note('Dragonpay Payment Status: SUCCESSFUL' . '<br>Transaction ID: ' . $tranID . $referer);
$order->payment_complete();
wp_redirect($order->get_checkout_order_received_url());
}
exit;
} else {
if ($status == "22") {
$order->add_order_note('Dragonpay Payment Status: Invalid Transaction' . '<br>Transaction ID: ' . $tranID . $referer);
$order->update_status('pending', sprintf(__('Payment %s via Dragonpay.', 'woocommerce'), $tranID));
$order->payment_complete($tranID);
wp_redirect($order->get_view_order_url());
exit;
} else {
if ($status == "11") {
//status 11 which is failed
$order->add_order_note('Dragonpay Payment Status: FAILED' . '<br>Transaction ID: ' . $tranID . $referer);
$order->update_status('failed', sprintf(__('Payment %s via Dragonpay.', 'woocommerce'), $tranID));
//$order->payment_complete();
$woocommerce->cart->empty_cart();
wp_redirect($order->get_view_order_url());
//wp_redirect($order->get_cancel_order_url());
exit;
} else {
//invalid transaction
$order->add_order_note('Dragonpay Payment Status: FAILED' . '<br>Transaction ID: ' . $tranID . $referer);
$order->update_status('failed', sprintf(__('Payment %s via Dragonpay.', 'woocommerce'), $tranID));
$woocommerce->cart->empty_cart();
wp_redirect($order->get_view_order_url());
//wp_redirect($order->get_cancel_order_url());
exit;
}
}
}
}
示例10: foreach
foreach ($customer_orders as $customer_order) {
if (version_compare($woocommerce->version, '2.2.0') >= 0) {
$order = new WC_Order($customer_order);
$status = $order->get_status();
$status_name = wc_get_order_status_name($status);
} else {
$order = new WC_Order();
$order->populate($customer_order);
$status = get_term_by('slug', $order->status, 'shop_order_status');
$status_name = $status->name;
}
?>
<tr class="order">
<td class="order-number" width="1%">
<a href="<?php
echo $order->get_view_order_url();
?>
">
<?php
echo $order->get_order_number();
?>
</a>
</td>
<td class="order-date">
<time datetime="<?php
echo date('Y-m-d', strtotime($order->order_date));
?>
" title="<?php
echo esc_attr(strtotime($order->order_date));
?>
"><?php
示例11: get_order_info
public function get_order_info()
{
global $dvin_qlist_products;
//for admin message, replace the order info with right info otherwise space
$order_info = apply_filters('dvin_wcql_order_info_str', __('Order Links(%s):<a href="%s">View</a> | <a href="%s">Edit</a> | <a href="%s">CheckOut</a>', 'dvinwcql'));
$order_obj = new WC_Order($this->order_id);
$order_edit_url = admin_url('post.php?post=' . absint($this->order_id) . '&action=edit');
//$order_obj->get_view_order_url();
return sprintf($order_info, $this->order_id, $order_obj->get_view_order_url(), $order_edit_url, $order_obj->get_checkout_payment_url());
}
示例12: thankyou_page
/**
* Thank you page message.
*
* @return string
*/
public function thankyou_page($order_id)
{
global $woocommerce;
$order = new WC_Order($order_id);
if (defined('WC_VERSION') && version_compare(WC_VERSION, '2.1', '>=')) {
$order_url = $order->get_view_order_url();
} else {
$order_url = add_query_arg('order', $order_id, get_permalink(woocommerce_get_page_id('view_order')));
}
if ($order->status == 'processing' || $order->status == 'completed') {
echo '<div class="woocommerce-message"><a href="' . esc_url($order_url) . '" class="button" style="display: block !important; visibility: visible !important;">' . __('View order details', 'cielo-woocommerce') . '</a>' . sprintf(__('Your payment has been received successfully.', 'cielo-woocommerce'), woocommerce_price($order->order_total)) . '<br />' . __('The authorization code was generated.', 'cielo-woocommerce') . '</div>';
} else {
echo '<div class="woocommerce-info">' . sprintf(__('For more information or questions regarding your order, go to the %s.', 'cielo-woocommerce'), '<a href="' . esc_url($order_url) . '">' . __('order details page', 'cielo-woocommerce') . '</a>') . '</div>';
}
}
示例13: date
_e('Total', 'dokan');
?>
</span></th>
<th class="order-actions"> </th>
</tr>
</thead>
<tbody>
<?php
foreach ($sub_orders as $order_post) {
$order = new WC_Order($order_post->ID);
$item_count = $order->get_item_count();
?>
<tr class="order">
<td class="order-number">
<a href="<?php
echo $order->get_view_order_url();
?>
">
<?php
echo $order->get_order_number();
?>
</a>
</td>
<td class="order-date">
<time datetime="<?php
echo date('Y-m-d', strtotime($order->order_date));
?>
" title="<?php
echo esc_attr(strtotime($order->order_date));
?>
"><?php
示例14: wccs_file_uploader_front_end
//.........这里部分代码省略.........
</tr>
';
}
?>
</tbody>
<input type="hidden" class="wccm_add_to_list" id="product_image_gallery" name="product_image_gallery" value="<?php
echo esc_attr($product_image_gallery);
?>
" />
<input type="hidden" id="wccm_default_keys_load" name="wccm_default_keys_load" value="<?php
echo esc_attr($default_wccm_values);
?>
" />
</table>
<!-- .woocommerce_order_items -->
</div>
<!-- .woocommerce_order_items_wrapper -->
<button type="button" id="wccm_save_order_submit" class="file_upload_delete wooccm-btn wooccm-btn-danger delete">Confirm Delete</button>
<span id="wccm_uploader_select">
<input type="file" style="display:none;" name="files_wccm" id="files_wccm" multiple />
<button type="button" class="file_upload_account wooccm-btn wooccm-btn-primary start" id="files_button_wccm">Upload Files</button>
</span>
<!-- #wccm_uploader_select -->
<div class="wccm_results front_end"></div>
<div class="clear"></div>
<?php
// script for uploading the files
echo '
<script type="text/javascript">
jQuery(document).ready(function($){
(function post_image_content() {
var input = document.getElementById("files_wccm"), formdata = false;
$("#files_button_wccm").click( function(){
$("#wccm_uploader_select input[type=file]").click();
return false;
});
if (window.FormData) {
formdata = new FormData();
}
input.addEventListener("change", function (evt) {
$("#wccm_uploader_select").block({message: null, overlayCSS: {background: "#fff url(" + woocommerce_params.plugin_url + "/assets/images/ajax-loader.gif) no-repeat center", opacity: 0.6}});
$("#wccm_uploader_select").block({message: null, overlayCSS: {background: "#fff url(" + woocommerce_params.ajax_loader_url + ") no-repeat center", opacity: 0.6}});
var length = ' . $length . ';
var file_array = ' . wooccm_js_array($file_types) . ';
var wooempt = ' . $file_types . ';
for ( i = 0; i < length; i++ ) {
file = this.files[i];
for(x=0; x < ' . $number_of_types . '; x++){
if( !wooempt || file.type.match(file_array[x]) ) {
if (formdata) {
formdata.append("files_wccm[]",file);
}
}
}
}
if (formdata) {
$.ajax({
url: "' . admin_url('/admin-ajax.php?action=wccs_upload_file_func&order_id=' . $order_id . '&name=files_wccm') . '",
type: "POST",
data: formdata,
processData: false,
contentType: false,
success: function (res) {
$("#files_wccm").show();
$.ajax({
url: "' . $order->get_view_order_url() . '",
data: {},
success: function (data) {
$("div.woocommerce_order_items_wrapper.front_end").html($(data).find("div.woocommerce_order_items_wrapper.front_end"));
jQuery("#wccm_uploader_select").unblock();
},
dataType: "html"
});
}
});
}
}, false);
}
());
});
</script>';
// end script
// ------------
}
}