本文整理汇总了PHP中wc_get_order_status_name函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_get_order_status_name函数的具体用法?PHP wc_get_order_status_name怎么用?PHP wc_get_order_status_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wc_get_order_status_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: order_data
public static function order_data($atts)
{
extract(shortcode_atts(array('meta' => ''), $atts));
if (!($order = self::get_order())) {
return;
}
$return = '';
if ($meta == 'status') {
$return = wc_get_order_status_name($order->get_status());
} else {
if ($meta == 'payment_status') {
$return = $order->paid_date ? __('paid', 'invoices', 'woocommerce-germanized-pro') : __('pending payment', 'invoices', 'woocommerce-germanized-pro');
} else {
if ($meta == 'payment_info') {
ob_start();
do_action('woocommerce_thankyou_' . $order->payment_method, $order->id);
$return = ob_get_clean();
} else {
if ($meta == "id") {
$return = $order->id;
} else {
$data = $order->{$meta};
if (!$data) {
$return = false;
} elseif (is_array($data)) {
$return = implode(', ', $data);
} else {
$return = $data;
}
}
}
}
}
return apply_filters('woocommerce_gzdp_shortcode_order_data', $return, $atts);
}
示例2: init_form_fields
/**
* Initialise Gateway Settings Form Fields
*/
public function init_form_fields()
{
$this->form_fields = array('enabled' => array('title' => __('Enable/Disable', 'mollie-payments-for-woocommerce'), 'type' => 'checkbox', 'label' => sprintf(__('Enable %s', 'mollie-payments-for-woocommerce'), $this->getDefaultTitle()), 'default' => 'yes'), 'title' => array('title' => __('Title', 'mollie-payments-for-woocommerce'), 'type' => 'text', 'description' => sprintf(__('This controls the title which the user sees during checkout. Default <code>%s</code>', 'mollie-payments-for-woocommerce'), $this->getDefaultTitle()), 'default' => $this->getDefaultTitle(), 'desc_tip' => true), 'display_logo' => array('title' => __('Display logo', 'mollie-payments-for-woocommerce'), 'type' => 'checkbox', 'label' => __('Display logo on checkout page. Default <code>enabled</code>', 'mollie-payments-for-woocommerce'), 'default' => 'yes'), 'description' => array('title' => __('Description', 'mollie-payments-for-woocommerce'), 'type' => 'textarea', 'description' => sprintf(__('Payment method description that the customer will see on your checkout. Default <code>%s</code>', 'mollie-payments-for-woocommerce'), $this->getDefaultDescription()), 'default' => $this->getDefaultDescription(), 'desc_tip' => true));
if ($this->paymentConfirmationAfterCoupleOfDays()) {
$this->form_fields['initial_order_status'] = array('title' => __('Initial order status', 'mollie-payments-for-woocommerce'), 'type' => 'select', 'options' => array(self::STATUS_ON_HOLD => wc_get_order_status_name(self::STATUS_ON_HOLD) . ' (' . __('default', 'mollie-payments-for-woocommerce') . ')', self::STATUS_PENDING => wc_get_order_status_name(self::STATUS_PENDING)), 'default' => self::STATUS_ON_HOLD, 'description' => sprintf(__('Some payment methods take longer than a few hours to complete. The initial order state is then set to \'%s\'. This ensures the order is not cancelled when the setting %s is used.', 'mollie-payments-for-woocommerce'), wc_get_order_status_name(self::STATUS_ON_HOLD), '<a href="' . admin_url('admin.php?page=wc-settings&tab=products§ion=inventory') . '" target="_blank">' . __('Hold Stock (minutes)', 'woocommerce') . '</a>'));
}
}
示例3: view_order
/**
* View order page
*
* @param int $order_id
*/
private static function view_order($order_id)
{
$user_id = get_current_user_id();
$order = wc_get_order($order_id);
if (!current_user_can('view_order', $order_id)) {
echo '<div class="woocommerce-error">' . __('Invalid order.', 'woocommerce') . ' <a href="' . wc_get_page_permalink('myaccount') . '" class="wc-forward">' . __('My Account', 'woocommerce') . '</a>' . '</div>';
return;
}
// Backwards compatibility
$status = new stdClass();
$status->name = wc_get_order_status_name($order->get_status());
wc_get_template('myaccount/view-order.php', array('status' => $status, 'order' => wc_get_order($order_id), 'order_id' => $order_id));
}
示例4: et_render_transaction_report
/**
*
*/
function et_render_transaction_report()
{
global $user_ID;
$start_date = $end_date = null;
if (isset($_POST['start_date'])) {
$start_date = $_POST['start_date'];
}
if (isset($_POST['end_date'])) {
$end_date = $_POST['end_date'];
}
$selled_orders = et_get_order_product_by_seller($user_ID, $start_date, $end_date);
$report = array();
foreach ($selled_orders as $order_id => $order) {
$date = get_the_date("Y-m-d", $order_id);
if (isset($report[$date]["salecount"])) {
$report[$date]["salecount"] += count($order);
} else {
$report[$date]["salecount"] = count($order);
}
$report[$date]["subtotal"] = array();
foreach ($order as $product_id => $product) {
if (isset($report[$date]["subtotal"][$product->status])) {
$report[$date]["subtotal"][$product->status] += $product->subtotal;
} else {
$report[$date]["subtotal"][$product->status] = $product->subtotal;
}
}
}
ob_start();
foreach ($report as $date => $data) {
echo "<tr>";
echo "<td>{$date}</td>";
echo "<td>{$data['salecount']}</td>";
echo "<td>";
foreach ($data['subtotal'] as $status => $total) {
$subtotal = wc_price($total);
$status = wc_get_order_status_name($status);
echo "{$status} : {$subtotal}<br>";
}
echo "</td>";
echo "</tr>";
}
ob_end_flush();
}
示例5: wc_print_notices
wc_print_notices();
?>
<div class="order__intro">
<section id="order__intro__section">
<!-- Home header title -->
<h1 class="page__title"><?php
printf(__('Order #<mark class="order-number">%s</mark>', 'woocommerce'), $order->get_order_number());
?>
</h1>
<div class="steps__frame">
<p><?php
printf(__('Was placed on <mark class="order-date">%s</mark> and is currently <mark class="order-status">%s</mark>.', 'woocommerce'), date_i18n(get_option('date_format'), strtotime($order->order_date)), wc_get_order_status_name($order->get_status()));
?>
</p>
</div>
<div class="home__intro__section__mascotte">
</div>
</section>
</div>
<div class="order-step">
<section class="order-step__section">
示例6: wc_print_notices
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.2.0
*/
if (!defined('ABSPATH')) {
exit;
// Exit if accessed directly
}
?>
<?php
wc_print_notices();
?>
<p class="order-info"><?php
printf(__('Order #<mark class="order-number">%s</mark> was placed on <mark class="order-date">%s</mark>.', 'woocommerce'), $order->get_order_number(), date_i18n(get_option('date_format'), strtotime($order->order_date)), wc_get_order_status_name($order->get_status()));
?>
</p>
<?php
if ($notes = $order->get_customer_order_notes()) {
?>
<h2><?php
_e('Order Updates', 'woocommerce');
?>
</h2>
<ol class="commentlist notes">
<?php
foreach ($notes as $note) {
?>
<li class="comment note">
示例7: esc_attr
</td>
<td class="order-date">
<time datetime="<?php
echo esc_attr(date('Y-m-d', strtotime($order->order_date)));
?>
" title="<?php
echo esc_attr(strtotime($order->order_date));
?>
"><?php
echo apply_filters('esc_html', 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 apply_filters('esc_html', wc_get_order_status_name($order->get_status()));
?>
</td>
<td class="order-total">
<?php
echo apply_filters('esc_html', sprintf(_n('%s for %s item', '%s for %s items', $item_count, 'jv_allinone'), $order->get_formatted_order_total(), $item_count));
?>
</td>
<td class="order-actions">
<?php
$actions = array();
if ($order->needs_payment()) {
$actions['pay'] = array('url' => $order->get_checkout_payment_url(), 'name' => __('Pay', 'jv_allinone'));
}
示例8: sprintf
<?php
/**
* Order tracking
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.2.0
*/
if (!defined('ABSPATH')) {
exit;
// Exit if accessed directly
}
$order_status_text = sprintf(__('Order #%s which was made %s has the status “%s”', 'woocommerce'), $order->get_order_number(), human_time_diff(strtotime($order->order_date), current_time('timestamp')) . ' ' . __('ago', 'woocommerce'), wc_get_order_status_name($order->get_status()));
if ($order->has_status('completed')) {
$order_status_text .= ' ' . __('and was completed', 'woocommerce') . ' ' . human_time_diff(strtotime($order->completed_date), current_time('timestamp')) . __(' ago', 'woocommerce');
}
$order_status_text .= '.';
echo "<p class='first-color'>";
echo esc_attr(apply_filters('woocommerce_order_tracking_status', $order_status_text, $order));
echo "</p>";
$notes = $order->get_customer_order_notes();
if ($notes) {
?>
<h2><?php
_e('Order Updates', 'woocommerce');
?>
</h2>
<?php
foreach ($notes as $note) {
?>
示例9: update_status
/**
* Updates status of order
*
* @param string $new_status Status to change the order to. No internal wc- prefix is required.
* @param string $note (default: '') Optional note to add
* @param bool $manual is this a manual order status change?
*/
public function update_status($new_status, $note = '', $manual = false)
{
if (!$this->id) {
return;
}
// Standardise status names.
$new_status = 'wc-' === substr($new_status, 0, 3) ? substr($new_status, 3) : $new_status;
$old_status = $this->get_status();
// Only update if they differ - and ensure post_status is a 'wc' status.
if ($new_status !== $old_status || !in_array($this->post_status, array_keys(wc_get_order_statuses()))) {
// Update the order
wp_update_post(array('ID' => $this->id, 'post_status' => 'wc-' . $new_status));
$this->post_status = 'wc-' . $new_status;
$this->add_order_note(trim($note . ' ' . sprintf(__('Order status changed from %s to %s.', 'woocommerce'), wc_get_order_status_name($old_status), wc_get_order_status_name($new_status))), 0, $manual);
// Status was changed
do_action('woocommerce_order_status_' . $new_status, $this->id);
do_action('woocommerce_order_status_' . $old_status . '_to_' . $new_status, $this->id);
do_action('woocommerce_order_status_changed', $this->id, $old_status, $new_status);
switch ($new_status) {
case 'completed':
// Record the sales
$this->record_product_sales();
// Increase coupon usage counts
$this->increase_coupon_usage_counts();
// Record the completed date of the order
update_post_meta($this->id, '_completed_date', current_time('mysql'));
// Update reports
wc_delete_shop_order_transients($this->id);
break;
case 'processing':
case 'on-hold':
// Record the sales
$this->record_product_sales();
// Increase coupon usage counts
$this->increase_coupon_usage_counts();
// Update reports
wc_delete_shop_order_transients($this->id);
break;
case 'cancelled':
// If the order is cancelled, restore used coupons
$this->decrease_coupon_usage_counts();
// Update reports
wc_delete_shop_order_transients($this->id);
break;
}
}
}
示例10: order_status
/**
* Returns the order status.
*
* @todo remove safety check against existence of wc_get_order_status_name() in future release
* (exists for backward compatibility with versions of WC below 2.2)
*
* @param $order_id
* @return string
*/
protected function order_status($order_id)
{
if (!function_exists('wc_get_order_status_name')) {
return __('Unknown', 'event-tickets-plus');
}
return wc_get_order_status_name(get_post_status($order_id));
}
示例11: esc_attr_e
<td class="order-status" data-title="<?php
esc_attr_e('Status', 'woocommerce-subscriptions');
?>
" style="text-align:left; white-space:nowrap;">
<?php
if ($order->get_status() == 'completed') {
?>
<span class="label label-success"><?php
echo esc_html(wc_get_order_status_name($order->get_status()));
?>
</span>
<?php
} else {
?>
<span class="label label-danger"><?php
echo esc_html(wc_get_order_status_name($order->get_status()));
?>
</span>
<?php
}
?>
</td>
<td class="order-total" data-title="<?php
esc_attr_e('Total', 'woocommerce-subscriptions');
?>
">
<?php
// translators: price for number of items
echo wp_kses_post(sprintf(_n('%s for %s item', '%s for %s items', $item_count, 'woocommerce-subscriptions'), $order->get_formatted_order_total(), $item_count));
?>
</td>
示例12: wc_print_notices
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.2.0
*/
if (!defined('ABSPATH')) {
exit;
// Exit if accessed directly
}
?>
<?php
wc_print_notices();
?>
<p class="order-info"><?php
printf(esc_html__('Order #<mark class="order-number">%s</mark> was placed on <mark class="order-date">%s</mark> and is currently <mark class="order-status">%s</mark>.', 'kute-boutique'), $order->get_order_number(), date_i18n(get_option('date_format'), strtotime($order->order_date)), wc_get_order_status_name($order->get_status()));
?>
</p>
<?php
if ($notes = $order->get_customer_order_notes()) {
?>
<h2><?php
esc_html_e('Order Updates', 'kute-boutique');
?>
</h2>
<ol class="commentlist notes">
<?php
foreach ($notes as $note) {
?>
<li class="comment note">
示例13: printf
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @see https://docs.woothemes.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.6.0
*/
if (!defined('ABSPATH')) {
exit;
}
?>
<p><?php
printf(__('Order #%1$s was placed on %2$s and is currently %3$s.', 'woocommerce'), '<mark class="order-number">' . $order->get_order_number() . '</mark>', '<mark class="order-date">' . date_i18n(get_option('date_format'), strtotime($order->order_date)) . '</mark>', '<mark class="order-status">' . wc_get_order_status_name($order->get_status()) . '</mark>');
?>
</p>
<?php
if ($notes = $order->get_customer_order_notes()) {
?>
<h2><?php
_e('Order Updates', 'woocommerce');
?>
</h2>
<ol class="woocommerce-OrderUpdates commentlist notes">
<?php
foreach ($notes as $note) {
?>
<li class="woocommerce-OrderUpdate comment note">
示例14: test_wc_get_order_status_name
/**
* Test wc_get_order_status_name().
*
* @since 2.3.0
*/
public function test_wc_get_order_status_name()
{
$this->assertEquals(_x('Pending payment', 'Order status', 'woocommerce'), wc_get_order_status_name('wc-pending'));
$this->assertEquals(_x('Pending payment', 'Order status', 'woocommerce'), wc_get_order_status_name('pending'));
}
示例15: array
}
$products = array();
foreach ($order_line_items as $order_line_item) {
$products[] = array('guid' => $order_line_item['wc1c_guid'], 'name' => $order_line_item['name'], 'price_per_item' => $order_line_item['line_total'] / $order_line_item['qty'], 'quantity' => $order_line_item['qty'], 'total' => $order_line_item['line_total'], 'type' => "Товар");
}
foreach ($order_shipping_items as $order_shipping_item) {
if (!$order_shipping_item['cost']) {
continue;
}
$products[] = array('name' => $order_shipping_item['name'], 'price_per_item' => $order_shipping_item['cost'], 'quantity' => 1, 'total' => $order_shipping_item['cost'], 'type' => "Услуга");
}
$statuses = array('cancelled' => "Отменен", 'trash' => "Удален");
if (array_key_exists($order->status, $statuses)) {
$order_status_name = $statuses[$order->status];
} else {
$order_status_name = wc_get_order_status_name($order->status);
}
if (WC1C_CURRENCY) {
$document_currency = WC1C_CURRENCY;
} else {
$document_currency = get_option('wc1c_currency', @$order_meta['_order_currency']);
}
$document = array('order_id' => $order_post->ID, 'currency' => $document_currency, 'total' => @$order_meta['_order_total'], 'comment' => $order_post->post_excerpt, 'contragents' => $contragents, 'products' => $products, 'payment_method_title' => @$order_meta['_payment_method_title'], 'status' => $order->status, 'status_name' => $order_status_name, 'has_shipping' => count($order_shipping_items) > 0, 'modified_at' => $order_post->post_modified);
list($document['date'], $document['time']) = explode(' ', $order_post->post_date, 2);
$documents[] = $document;
}
$documents = apply_filters('wc1c_query_documents', $documents);
echo '<?xml version="1.0" encoding="' . WC1C_XML_CHARSET . '"?>';
?>
<КоммерческаяИнформация ВерсияСхемы="2.05" ДатаФормирования="<?php