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
0
 /**
  * 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&section=inventory') . '" target="_blank">' . __('Hold Stock (minutes)', 'woocommerce') . '</a>'));
     }
 }
 /**
  * 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
0
/**
 *
 */
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
0
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">
 * @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
0
파일: my-orders.php 프로젝트: taeche/SoDoEx
					</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
0
<?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 &ldquo;%s&rdquo;', '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) {
        ?>
 /**
  * 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
0
 /**
  * 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
0
				<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
0
 * @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
0
 * (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
0
 /**
  * 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
0
파일: query.php 프로젝트: anderpo/himik
    }
    $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 
/**
 * View Order
 *
 * Shows the details of a particular order on the account page
 *
 * @author    WooThemes
 * @package   WooCommerce/Templates
 * @version   2.2.0
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
wc_print_notices();
echo beans_open_markup('woo_view_order_notice', 'p', array('class' => 'order-info'));
printf(__('Order #' . beans_open_markup('woo_view_order_notice_order_number', 'mark', array('class' => 'order-number')) . '%s' . beans_close_markup('woo_view_order_notice_order_number', 'mark') . ' was placed on ' . beans_open_markup('woo_view_order_notice_order_date', 'mark', array('class' => 'order-date')) . '%s' . beans_close_markup('woo_view_order_notice_order_date', 'mark') . ' and is currently ' . beans_open_markup('woo_view_order_notice_order_status', 'mark', array('class' => 'order-status')) . '%s' . beans_close_markup('woo_view_order_notice_order_status', 'mark') . '.', 'woocommerce'), $order->get_order_number(), date_i18n(get_option('date_format'), strtotime($order->order_date)), wc_get_order_status_name($order->get_status()));
echo beans_close_markup('woo_view_order_notice', 'p');
if ($notes = $order->get_customer_order_notes()) {
    echo beans_open_markup('woo_view_order_title', 'h2');
    _e('Order Updates', 'woocommerce');
    echo beans_close_markup('woo_view_order_title', 'h2');
    echo beans_open_markup('woo_view_order_comment_list', 'ol', array('class' => 'commentlist notes'));
    foreach ($notes as $note) {
        echo beans_open_markup('woo_view_order_comment_list_item', 'li', array('class' => 'comment note'));
        echo beans_open_markup('woo_view_order_comment_container', 'div', array('class' => 'comment_container'));
        echo beans_open_markup('woo_view_order_comment_text', 'div', array('class' => 'comment-text'));
        echo beans_open_markup('woo_view_order_comment_meta', 'p', array('class' => 'meta'));
        echo date_i18n(__('l jS \\o\\f F Y, h:ia', 'woocommerce'), strtotime($note->comment_date));
        echo beans_close_markup('woo_view_order_comment_meta', 'p');
        echo beans_open_markup('woo_view_order_comment_description', 'div', array('class' => 'description'));
        echo wpautop(wptexturize($note->comment_content));
 /**
  * Trigger function
  *
  * @since 1.0.0
  * @param int $order_id
  */
 public function trigger($order_id)
 {
     if ($order_id) {
         $this->object = wc_get_order($order_id);
         if ('customer' == $this->type) {
             $this->recipient = $this->object->billing_email;
         }
         // Supported variables in subject, heading and body text
         $this->find['order-date'] = '{order_date}';
         $this->find['order-number'] = '{order_number}';
         $this->find['order-status'] = '{order_status}';
         $this->find['billing-first-name'] = '{billing_first_name}';
         $this->find['billing-last-name'] = '{billing_last_name}';
         $this->find['billing-company'] = '{billing_company}';
         /**
          * Filter the supported variables in subject, heading and body text
          *
          * @since 1.1.1
          *
          * @param array $find Associative array of placeholders.
          * @param string $id E-mail ID
          * @param string $type E-mail type
          */
         $this->find = apply_filters('wc_order_status_manager_order_status_email_find_variables', $this->find, $this->id, $this->type);
         $this->replace['order-date'] = date_i18n(wc_date_format(), strtotime($this->object->order_date));
         $this->replace['order-number'] = $this->object->get_order_number();
         $this->replace['order-status'] = wc_get_order_status_name($this->object->get_status());
         $this->replace['billing-first-name'] = $this->object->billing_first_name;
         $this->replace['billing-last-name'] = $this->object->billing_last_name;
         $this->replace['billing-company'] = $this->object->billing_company;
         /**
          * Filter the the srtings to replace in subject, heading and body text.
          *
          * @since 1.1.1
          *
          * @param array $replace Associative array of strings.
          * @param string $id E-mail ID
          * @param string $type E-mail type
          */
         $this->replace = apply_filters('wc_order_status_manager_order_status_email_replace_variables', $this->replace, $this->id, $this->type);
     }
     if (!$this->is_enabled() || !$this->get_recipient()) {
         return;
     }
     $this->send($this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments());
 }
예제 #18
0
 /**
  * Gets order
  *
  * @access public
  * @param int $ID
  * @return array
  */
 public static function getOrder($ID)
 {
     $order = array();
     if (self::isActive()) {
         $object = wc_get_order($ID);
         if (!empty($object)) {
             $order['ID'] = $ID;
             $order['object'] = $object;
             $order['number'] = $object->get_order_number();
             $order['date'] = $object->order_date;
             $order['author'] = $object->post->post_author;
             $order['status'] = $object->get_status();
             $order['condition'] = wc_get_order_status_name($order['status']);
             $order['total'] = $object->get_formatted_order_total();
             $order['totals'] = $object->get_order_item_totals();
             $order['products'] = $object->get_items();
             foreach ($order['products'] as &$product) {
                 $product['subtotal'] = $object->get_formatted_line_subtotal($product);
                 $product['meta'] = new WC_Order_Item_Meta($product['item_meta']);
             }
             $order['customer'] = $object->get_user_id();
             $order['email'] = $object->billing_email;
             $order['phone'] = $object->billing_phone;
             $order['billing_address'] = $object->get_formatted_billing_address();
             $order['shipping_address'] = $object->get_formatted_shipping_address();
             $order['customer_note'] = $object->post->post_excerpt;
             $order['order_note'] = self::getNote($order['ID']);
         }
     }
     return $order;
 }
예제 #19
0
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see 	http://docs.woothemes.com/document/template-structure/
 * @author  WooThemes
 * @package WooCommerce/Templates
 * @version 2.2.0
 */
if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
?>

<p class="order-info"><?php 
echo wp_kses_post(apply_filters('woocommerce_order_tracking_status', sprintf(__('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>.', 'woocommerce'), $order->get_order_number(), date_i18n(get_option('date_format'), strtotime($order->order_date)), wc_get_order_status_name($order->get_status())), $order));
?>
</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">
예제 #20
0
 /**
  * Handle the status transition.
  */
 protected function status_transition()
 {
     if ($this->_status_transition) {
         if (!empty($this->_status_transition['from'])) {
             $transition_note = sprintf(__('Order status changed from %s to %s.', 'woocommerce'), wc_get_order_status_name($this->_status_transition['from']), wc_get_order_status_name($this->_status_transition['to']));
             do_action('woocommerce_order_status_' . $this->_status_transition['from'] . '_to_' . $this->_status_transition['to'], $this->get_id());
             do_action('woocommerce_order_status_changed', $this->get_id(), $this->_status_transition['from'], $this->_status_transition['to']);
         } else {
             $transition_note = sprintf(__('Order status set to %s.', 'woocommerce'), wc_get_order_status_name($this->_status_transition['to']));
         }
         do_action('woocommerce_order_status_' . $this->_status_transition['to'], $this->get_id());
         // Note the transition occured
         $this->add_order_note(trim($this->_status_transition['note'] . ' ' . $transition_note), 0, $this->_status_transition['manual']);
         // This has ran, so reset status transition variable
         $this->_status_transition = false;
     }
 }
예제 #21
0
        /**
         * Output custom columns for coupons
         * @param  string $column
         */
        public function render_shop_order_columns($column)
        {
            global $post, $woocommerce, $the_order;
            if (empty($the_order) || $the_order->id != $post->ID) {
                $the_order = wc_get_order($post->ID);
            }
            switch ($column) {
                case 'order_status':
                    printf('<mark class="%s tips" data-tip="%s">%s</mark>', sanitize_title($the_order->get_status()), wc_get_order_status_name($the_order->get_status()), wc_get_order_status_name($the_order->get_status()));
                    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);
                        $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="' . wc_sanitize_tooltip($the_order->customer_message) . '">' . __('Yes', 'woocommerce') . '</span>';
                    } else {
                        echo '<span class="na">&ndash;</span>';
                    }
                    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, $product);
                            $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 ($product) {
                                ?>
									<?php 
                                echo wc_product_sku_enabled() && $product->get_sku() ? $product->get_sku() . ' - ' : '';
                                ?>
<a href="<?php 
                                echo get_edit_post_link($product->id);
                                ?>
" title="<?php 
                                echo apply_filters('woocommerce_order_item_name', $item['name'], $item, false);
                                ?>
"><?php 
                                echo apply_filters('woocommerce_order_item_name', $item['name'], $item, false);
                                ?>
</a>
								<?php 
                            } else {
                                ?>
									<?php 
                                echo apply_filters('woocommerce_order_item_name', $item['name'], $item, false);
                                ?>
								<?php 
                            }
                            ?>
								<?php 
                            if (!empty($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 '&ndash;';
                    }
                    break;
                case 'shipping_address':
                    if ($address = $the_order->get_formatted_shipping_address()) {
                        echo '<a target="_blank" href="' . esc_url($the_order->get_shipping_address_map_url()) . '">' . esc_html(preg_replace('#<br\\s*/?>#i', ', ', $address)) . '</a>';
                    } else {
                        echo '&ndash;';
                    }
                    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
                        $status = 'trash' !== $post->post_status ? '' : 'post-trashed';
                        $latest_notes = get_comments(array('post_id' => $post->ID, 'number' => 1, 'status' => $status));
                        $latest_note = current($latest_notes);
                        if ($post->comment_count == 1) {
                            echo '<span class="note-on tips" data-tip="' . wc_sanitize_tooltip($latest_note->comment_content) . '">' . __('Yes', 'woocommerce') . '</span>';
                        } elseif (isset($latest_note->comment_content)) {
                            echo '<span class="note-on tips" data-tip="' . wc_sanitize_tooltip($latest_note->comment_content . '<br/><small style="display:block">' . sprintf(_n('plus %d other note', 'plus %d other notes', $post->comment_count - 1, 'woocommerce'), $post->comment_count - 1) . '</small>') . '">' . __('Yes', 'woocommerce') . '</span>';
                        } else {
                            echo '<span class="note-on tips" data-tip="' . wc_sanitize_tooltip(sprintf(_n('%d note', '%d notes', $post->comment_count, 'woocommerce'), $post->comment_count)) . '">' . __('Yes', 'woocommerce') . '</span>';
                        }
                    } else {
                        echo '<span class="na">&ndash;</span>';
                    }
                    break;
                case 'order_total':
                    echo $the_order->get_formatted_order_total();
                    if ($the_order->payment_method_title) {
                        echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($the_order->payment_method_title) . '</small>';
                    }
                    break;
                case 'order_title':
                    $customer_tip = array();
                    if ($address = $the_order->get_formatted_billing_address()) {
                        $customer_tip[] = __('Billing:', 'woocommerce') . ' ' . $address . '<br/><br/>';
                    }
                    if ($the_order->billing_phone) {
                        $customer_tip[] = __('Tel:', 'woocommerce') . ' ' . $the_order->billing_phone;
                    }
                    if ($the_order->user_id) {
                        $user_info = get_userdata($the_order->user_id);
                    }
                    if (!empty($user_info)) {
                        $username = '******' . absint($user_info->ID) . '">';
                        if ($user_info->first_name || $user_info->last_name) {
                            $username .= esc_html(ucfirst($user_info->first_name) . ' ' . ucfirst($user_info->last_name));
                        } else {
                            $username .= esc_html(ucfirst($user_info->display_name));
                        }
                        $username .= '</a>';
                    } else {
                        if ($the_order->billing_first_name || $the_order->billing_last_name) {
                            $username = trim($the_order->billing_first_name . ' ' . $the_order->billing_last_name);
                        } else {
                            $username = __('Guest', 'woocommerce');
                        }
                    }
                    printf(_x('%s by %s', 'Order number by X', 'woocommerce'), '<a href="' . admin_url('post.php?post=' . absint($post->ID) . '&action=edit') . '" class="row-title"><strong>#' . esc_attr($the_order->get_order_number()) . '</strong></a>', $username);
                    if ($the_order->billing_email) {
                        echo '<small class="meta email"><a href="' . esc_url('mailto:' . $the_order->billing_email) . '">' . esc_html($the_order->billing_email) . '</a></small>';
                    }
                    echo '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __('Show more details', 'woocommerce') . '</span></button>';
                    break;
                case 'order_actions':
                    ?>
<p>
					<?php 
                    do_action('woocommerce_admin_order_actions_start', $the_order);
                    $actions = array();
                    if ($the_order->has_status(array('pending', 'on-hold'))) {
                        $actions['processing'] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce_mark_order_status&status=processing&order_id=' . $post->ID), 'woocommerce-mark-order-status'), 'name' => __('Processing', 'woocommerce'), 'action' => "processing");
                    }
                    if ($the_order->has_status(array('pending', 'on-hold', 'processing'))) {
                        $actions['complete'] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce_mark_order_status&status=completed&order_id=' . $post->ID), 'woocommerce-mark-order-status'), '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) {
                        printf('<a class="button tips %s" href="%s" data-tip="%s">%s</a>', esc_attr($action['action']), esc_url($action['url']), esc_attr($action['name']), esc_attr($action['name']));
                    }
                    do_action('woocommerce_admin_order_actions_end', $the_order);
                    ?>
				</p><?php 
                    break;
            }
        }
예제 #22
0
function wc_get_customer_orders()
{
    // Get all customer orders
    $customer_orders = get_posts(array('numberposts' => 4, 'meta_key' => '_customer_user', 'meta_value' => get_current_user_id(), 'post_type' => wc_get_order_types(), 'post_status' => array_keys(wc_get_order_statuses())));
    if ($customer_orders > 0) {
        $has_orders = 1;
    } else {
        $has_orders = 0;
    }
    do_action('woocommerce_before_account_orders', $has_orders);
    ?>
	<div class="pedidos">

<?php 
    if ($has_orders) {
        ?>
		<h4>Pedidos Recentes</h4>
		<table class="woocommerce-MyAccount-orders shop_table shop_table_responsive my_account_orders account-orders-table">
			<thead>
				<tr>
					<?php 
        foreach (wc_get_account_orders_columns() as $column_id => $column_name) {
            ?>
						<th class="<?php 
            echo esc_attr($column_id);
            ?>
"><span class="nobr"><?php 
            echo esc_html($column_name);
            ?>
</span></th>
					<?php 
        }
        ?>
				</tr>
			</thead>

			<tbody>
	 			<?php 
        foreach ($customer_orders as $customer_order) {
            $order = wc_get_order($customer_order);
            $item_count = $order->get_item_count();
            ?>
					<tr class="order">
						<?php 
            foreach (wc_get_account_orders_columns() as $column_id => $column_name) {
                ?>
							<td class="<?php 
                echo esc_attr($column_id);
                ?>
" data-title="<?php 
                echo esc_attr($column_name);
                ?>
">
								<?php 
                if (has_action('woocommerce_my_account_my_orders_column_' . $column_id)) {
                    ?>
									<?php 
                    do_action('woocommerce_my_account_my_orders_column_' . $column_id, $order);
                    ?>

								<?php 
                } elseif ('order-number' === $column_id) {
                    ?>
									<a href="<?php 
                    echo esc_url($order->get_view_order_url());
                    ?>
">
										<?php 
                    echo _x('#', 'hash before order number', 'woocommerce') . $order->get_order_number();
                    ?>
									</a>

								<?php 
                } elseif ('order-date' === $column_id) {
                    ?>
									<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>

								<?php 
                } elseif ('order-status' === $column_id) {
                    ?>
									<?php 
                    echo wc_get_order_status_name($order->get_status());
                    ?>

								<?php 
                } elseif ('order-total' === $column_id) {
                    ?>
									<?php 
                    echo sprintf(_n('%s for %s item', '%s for %s items', $item_count, 'woocommerce'), $order->get_formatted_order_total(), $item_count);
                    ?>

								<?php 
                } elseif ('order-actions' === $column_id) {
                    ?>
									<?php 
                    $actions = array('pay' => array('url' => $order->get_checkout_payment_url(), 'name' => __('Pay', 'woocommerce')), 'view' => array('url' => $order->get_view_order_url(), 'name' => __('View', 'woocommerce')), 'cancel' => array('url' => $order->get_cancel_order_url(wc_get_page_permalink('myaccount')), 'name' => __('Cancel', 'woocommerce')));
                    if (!$order->needs_payment()) {
                        unset($actions['pay']);
                    }
                    if (!in_array($order->get_status(), apply_filters('woocommerce_valid_order_statuses_for_cancel', array('pending', 'failed'), $order))) {
                        unset($actions['cancel']);
                    }
                    if ($actions = apply_filters('woocommerce_my_account_my_orders_actions', $actions, $order)) {
                        foreach ($actions as $key => $action) {
                            echo '<a href="' . esc_url($action['url']) . '" class="button ' . sanitize_html_class($key) . '">' . esc_html($action['name']) . '</a>';
                        }
                    }
                    ?>
								<?php 
                }
                ?>
							</td>
						<?php 
            }
            ?>
					</tr>
				<?php 
        }
        ?>
			</tbody>
		</table>
<?php 
    } else {
        ?>
		
		<div class="woocommerce-Message woocommerce-Message--info woocommerce-info">
			<a class="woocommerce-Button button" href="<?php 
        echo esc_url(apply_filters('woocommerce_return_to_shop_redirect', wc_get_page_permalink('shop')));
        ?>
">
				<?php 
        _e('Go Shop', 'woocommerce');
        ?>
			</a>
			<?php 
        _e('No order has been made yet.', 'woocommerce');
        ?>
		</div>


<?php 
    }
    ?>

<?php 
    echo '<p><a href="' . esc_url(wc_get_endpoint_url('orders')) . '">Ver Todos</a></p>';
    do_action('woocommerce_after_account_orders', $has_orders);
    $customer_id = get_current_user_id();
    if (!wc_ship_to_billing_address_only() && wc_shipping_enabled()) {
        $get_addresses = apply_filters('woocommerce_my_account_get_addresses', array('billing' => __('Billing Address', 'woocommerce'), 'shipping' => __('Shipping Address', 'woocommerce')), $customer_id);
    } else {
        $get_addresses = apply_filters('woocommerce_my_account_get_addresses', array('billing' => __('Billing Address', 'woocommerce')), $customer_id);
    }
    $oldcol = 1;
    $col = 1;
    ?>

<?php 
    if (!wc_ship_to_billing_address_only() && wc_shipping_enabled()) {
        echo '<div class="u-columns woocommerce-Addresses col2-set addresses">';
    }
    ?>

<?php 
    foreach ($get_addresses as $name => $title) {
        ?>

	<div class="u-column<?php 
        echo ($col = $col * -1) < 0 ? 1 : 2;
        ?>
 col-<?php 
        echo ($oldcol = $oldcol * -1) < 0 ? 1 : 2;
        ?>
 woocommerce-Address">
		<header class="woocommerce-Address-title title">
			<h3>Cadastro</h3>
			<a href="<?php 
        echo esc_url(wc_get_endpoint_url('edit-address', $name));
        ?>
" class="edit"><?php 
        _e('Edit', 'woocommerce');
        ?>
</a>
		</header>
		<address>
			<?php 
        $address = apply_filters('woocommerce_my_account_my_address_formatted_address', array('first_name' => get_user_meta($customer_id, $name . '_first_name', true), 'last_name' => get_user_meta($customer_id, $name . '_last_name', true), 'company' => get_user_meta($customer_id, $name . '_company', true), 'address_1' => get_user_meta($customer_id, $name . '_address_1', true), 'address_2' => get_user_meta($customer_id, $name . '_address_2', true), 'city' => get_user_meta($customer_id, $name . '_city', true), 'state' => get_user_meta($customer_id, $name . '_state', true), 'postcode' => get_user_meta($customer_id, $name . '_postcode', true), 'country' => get_user_meta($customer_id, $name . '_country', true)), $customer_id, $name);
        $formatted_address = WC()->countries->get_formatted_address($address);
        if (!$formatted_address) {
            _e('You have not set up this type of address yet.', 'woocommerce');
        } else {
            echo $formatted_address;
        }
        ?>
		</address>
	</div>

<?php 
    }
    ?>

<?php 
    if (!wc_ship_to_billing_address_only() && wc_shipping_enabled()) {
        echo '</div>';
    }
    ?>


</div><!-- pedidos -->
<?php 
}
예제 #23
0
 /**
  * Output the suborder metaboxes
  *
  * @param $post     The post object
  * @param $param    Callback args
  *
  * @return void
  * @author Andrea Grillo <*****@*****.**>
  */
 public function output($post, $param)
 {
     switch ($param['args']['metabox']) {
         case 'suborders':
             $suborder_ids = self::get_suborder(absint($post->ID));
             echo '<ul class="suborders-list single-orders">';
             foreach ($suborder_ids as $suborder_id) {
                 $suborder = wc_get_order(absint($suborder_id));
                 $vendor = yith_get_vendor($suborder->post->post_author, 'user');
                 $suborder_uri = esc_url('post.php?post=' . absint($suborder_id) . '&action=edit');
                 echo '<li class="suborder-info">';
                 printf('<mark class="%s tips" data-tip="%s">%s</mark> <strong><a href="%s">#%s</a></strong> <small class="single-order yith-wcmv-suborder-owner">%s %s</small><br/>', sanitize_title($suborder->get_status()), wc_get_order_status_name($suborder->get_status()), wc_get_order_status_name($suborder->get_status()), $suborder_uri, $suborder_id, __('in', 'Order table details', 'yith_wc_product_vendors'), $vendor->name);
                 echo '<li>';
             }
             echo '</ul>';
             break;
         case 'parent-order':
             $parent_order_id = wp_get_post_parent_id(absint($post->ID));
             $parent_order_uri = esc_url('post.php?post=' . absint($parent_order_id) . '&action=edit');
             printf('<a href="%s">&#8592; %s</a>', $parent_order_uri, _x('Return to main order', 'Admin: single order page. Link to parent order', 'yith_wc_product_vendors'));
             break;
     }
 }
예제 #24
0
 *
 * @author    WooThemes
 * @package   WooCommerce/Templates
 * @version   2.2.0
 */
if (!defined('ABSPATH')) {
    exit;
}
?>
<div class="info-box order-details-box">
<?php 
wc_print_notices();
?>

<p class="order-info"><?php 
printf(wp_kses(__('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>.', 'greek'), array('span' => array())), $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', 'greek');
    ?>
</h2>
	<ol class="commentlist notes">
		<?php 
    foreach ($notes as $note) {
        ?>
		<li class="comment note">
예제 #25
0
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see 	https://docs.woocommerce.com/document/template-structure/
 * @author  WooThemes
 * @package WooCommerce/Templates
 * @version 2.2.0
 */
if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
?>

<p class="order-info"><?php 
echo wp_kses_post(apply_filters('woocommerce_order_tracking_status', sprintf(__('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'), $order->get_date_created()) . '</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="commentlist notes">
		<?php 
    foreach ($notes as $note) {
        ?>
		<li class="comment note">
예제 #26
0
 /**
  * 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?
  * @return bool Successful change or not
  */
 public function update_status($new_status, $note = '', $manual = false)
 {
     if (!$this->id) {
         return false;
     }
     // Standardise status names.
     $new_status = 'wc-' === substr($new_status, 0, 3) ? substr($new_status, 3) : $new_status;
     $old_status = $this->get_status();
     // If the statuses are the same there is no need to update, unless the post status is not a valid 'wc' status.
     if ($new_status === $old_status && in_array($this->post_status, array_keys(wc_get_order_statuses()))) {
         return false;
     }
     $this->post_status = 'wc-' . $new_status;
     $update_post_data = array('ID' => $this->id, 'post_status' => $this->post_status);
     if ('pending' === $old_status && !$manual) {
         $update_post_data['post_date'] = current_time('mysql', 0);
         $update_post_data['post_date_gmt'] = current_time('mysql', 1);
     }
     wp_update_post($update_post_data);
     $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;
     }
     return true;
 }
예제 #27
0
        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" data-title="<?php 
        _e('Status', 'woocommerce');
        ?>
" style="text-align:left; white-space:nowrap;">
						<?php 
        echo wc_get_order_status_name($order->get_status());
        ?>
					</td>
					<td class="order-total" data-title="<?php 
        _e('Total', 'woocommerce');
        ?>
">
						<?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();
        if (in_array($order->get_status(), apply_filters('woocommerce_valid_order_statuses_for_payment', array('pending', 'failed'), $order))) {
            $actions['pay'] = array('url' => $order->get_checkout_payment_url(), 'name' => __('Pay', 'woocommerce'));
예제 #28
0
function show_my_custom_orders()
{
    $page_id = get_the_ID();
    $product_id = (int) get_post_meta($page_id, 'report_product_id', true);
    $after = strtotime(get_post_meta($page_id, 'report_after_date', true));
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    if ($product_id && $after) {
        global $wpdb;
        $after = strftime('%Y-%m-%d %H:%M:%S', $after);
        // Получаем id релевантных посты-заказы.
        $sql = $wpdb->prepare("SELECT oi.order_id FROM {$wpdb->prefix}woocommerce_order_itemmeta AS om\n                               JOIN {$wpdb->prefix}woocommerce_order_items AS oi ON om.order_item_id=oi.order_item_id\n                               JOIN {$wpdb->posts} AS p ON p.ID=oi.order_id\n                               WHERE om.meta_key='_product_id' AND om.meta_value=%d AND p.post_date >=%s", $product_id, $after);
        $order_ids = $wpdb->get_col($sql);
        if ($order_ids) {
            // Дальше используем стандартные методы
            $args = array('ignore_sticky_posts' => true, 'posts_per_page' => 50, 'paged' => $paged, 'post_type' => 'shop_order', 'post_status' => 'publish', 'post__in' => $order_ids);
            $loop = new WP_Query($args);
            while ($loop->have_posts()) {
                $loop->the_post();
                $order_id = $loop->post->ID;
                $order = new WC_Order($order_id);
                ?>
				<article>
					<header>
						<h2><?php 
                _e('Order', 'woocommerce');
                ?>
							№<?php 
                echo $order_id;
                ?>
 &mdash; <?php 
                the_time('d.m.Y h:i:s');
                ?>
</time></h2>
					</header>
					<table cellspacing="0" cellpadding="2">
						<thead>
						<tr>
							<th scope="col" style="text-align:left;"><?php 
                _e('Product', 'woocommerce');
                ?>
</th>
							<th scope="col" style="text-align:left;"><?php 
                _e('Quantity', 'woocommerce');
                ?>
</th>
							<th scope="col" style="text-align:left;"><?php 
                _e('Price', 'woocommerce');
                ?>
</th>
						</tr>
						</thead>
						<tfoot>
						<tr>
							<th scope="row" colspan="2"
							    style="text-align:left; padding-top: 12px;"><?php 
                _e('Subtotal:', 'woocommerce');
                ?>
</th>
							<td style="text-align:left; padding-top: 12px;"><?php 
                echo $order->get_subtotal_to_display();
                ?>
</td>
						</tr>
						<tr>
							<th scope="row" colspan="2"
							    style="text-align:left; padding-top: 12px;"><?php 
                _e('Status', 'woocommerce');
                ?>
</th>
							<td style="text-align:left; padding-top: 12px;"><?php 
                echo _e(wc_get_order_status_name(get_post_status()), 'woocommerce');
                ?>
</td>
						</tr>
						<?php 
                if ($order->order_shipping > 0) {
                    ?>
							<tr>
								<th scope="row" colspan="2"
								    style="text-align:left;"><?php 
                    _e('Shipping:', 'woocommerce');
                    ?>
</th>
								<td style="text-align:left;"><?php 
                    echo $order->get_shipping_to_display();
                    ?>
</td>
							</tr>
						<?php 
                }
                ?>
						<?php 
                if ($order->order_discount > 0) {
                    ?>
							<tr>
								<th scope="row" colspan="2"
								    style="text-align:left;"><?php 
                    _e('Discount:', 'woocommerce');
                    ?>
</th>
								<td style="text-align:left;"><?php 
                    echo woocommerce_price($order->order_discount);
                    ?>
</td>
							</tr>
						<?php 
                }
                ?>
						<?php 
                if ($order->get_total_tax() > 0) {
                    ?>
							<tr>
								<th scope="row" colspan="2"
								    style="text-align:left;"><?php 
                    _e('Tax:', 'woocommerce');
                    ?>
</th>
								<td style="text-align:left;"><?php 
                    echo woocommerce_price($order->get_total_tax());
                    ?>
</td>
							</tr>
						<?php 
                }
                ?>
						<tr>
							<th scope="row" colspan="2"
							    style="text-align:left;"><?php 
                _e('Total:', 'woocommerce');
                ?>
</th>
							<td style="text-align:left;"><?php 
                echo woocommerce_price($order->order_total);
                ?>
</td>
						</tr>
						</tfoot>
						<tbody>
						<?php 
                echo $order->email_order_items_table();
                ?>
						</tbody>
					</table>

					<?php 
                show_customer_details($order);
                ?>

					<hr>

					<div style="clear:both;"></div>
				</article>
				<?php 
            }
            ?>
			<nav>
				<span style="float:left"><?php 
            previous_posts_link('&laquo; Назад', $loop->max_num_pages);
            ?>
</span>
				<span style="float:right"><?php 
            next_posts_link('Вперёд &raquo;', $loop->max_num_pages);
            ?>
</span>
			</nav>

			<?php 
            wp_reset_query();
        } else {
            ?>
			<p>Заказов товара <?php 
            echo $product_id;
            ?>
 после <?php 
            echo $after;
            ?>
 нет.</p>
			<?php 
        }
    }
}
예제 #29
0
    /**
     * Show the pay page
     */
    private static function order_pay($order_id)
    {
        do_action('before_woocommerce_pay');
        wc_print_notices();
        $order_id = absint($order_id);
        // Handle payment
        if (isset($_GET['pay_for_order']) && isset($_GET['key']) && $order_id) {
            // Pay for existing order
            $order_key = $_GET['key'];
            $order = wc_get_order($order_id);
            $valid_order_statuses = apply_filters('woocommerce_valid_order_statuses_for_payment', array('pending', 'failed'), $order);
            if (!current_user_can('pay_for_order', $order_id)) {
                echo '<div class="woocommerce-error">' . __('Invalid order. If you have an account please log in and try again.', 'woocommerce') . ' <a href="' . get_permalink(wc_get_page_id('myaccount')) . '" class="wc-forward">' . __('My Account', 'woocommerce') . '</a>' . '</div>';
                return;
            }
            if ($order->id == $order_id && $order->order_key == $order_key) {
                if ($order->has_status($valid_order_statuses)) {
                    // Set customer location to order location
                    if ($order->billing_country) {
                        WC()->customer->set_country($order->billing_country);
                    }
                    if ($order->billing_state) {
                        WC()->customer->set_state($order->billing_state);
                    }
                    if ($order->billing_postcode) {
                        WC()->customer->set_postcode($order->billing_postcode);
                    }
                    wc_get_template('checkout/form-pay.php', array('order' => $order));
                } else {
                    wc_add_notice(sprintf(__('This order&rsquo;s status is &ldquo;%s&rdquo;&mdash;it cannot be paid for. Please contact us if you need assistance.', 'woocommerce'), wc_get_order_status_name($order->get_status())), 'error');
                }
            } else {
                wc_add_notice(__('Sorry, this order is invalid and cannot be paid for.', 'woocommerce'), 'error');
            }
        } elseif ($order_id) {
            // Pay for order after checkout step
            $order_key = isset($_GET['key']) ? wc_clean($_GET['key']) : '';
            $order = wc_get_order($order_id);
            $valid_order_statuses = apply_filters('woocommerce_valid_order_statuses_for_payment', array('pending', 'failed'), $order);
            if ($order->id == $order_id && $order->order_key == $order_key) {
                if ($order->has_status($valid_order_statuses)) {
                    ?>
					<ul class="order_details">
						<li class="order">
							<?php 
                    _e('Order Number:', 'woocommerce');
                    ?>
							<strong><?php 
                    echo $order->get_order_number();
                    ?>
</strong>
						</li>
						<li class="date">
							<?php 
                    _e('Date:', 'woocommerce');
                    ?>
							<strong><?php 
                    echo date_i18n(get_option('date_format'), strtotime($order->order_date));
                    ?>
</strong>
						</li>
						<li class="total">
							<?php 
                    _e('Total:', 'woocommerce');
                    ?>
							<strong><?php 
                    echo $order->get_formatted_order_total();
                    ?>
</strong>
						</li>
						<?php 
                    if ($order->payment_method_title) {
                        ?>
						<li class="method">
							<?php 
                        _e('Payment Method:', 'woocommerce');
                        ?>
							<strong><?php 
                        echo $order->payment_method_title;
                        ?>
</strong>
						</li>
						<?php 
                    }
                    ?>
					</ul>

					<?php 
                    do_action('woocommerce_receipt_' . $order->payment_method, $order_id);
                    ?>

					<div class="clear"></div>
					<?php 
                } else {
                    wc_add_notice(sprintf(__('This order&rsquo;s status is &ldquo;%s&rdquo;&mdash;it cannot be paid for. Please contact us if you need assistance.', 'woocommerce'), wc_get_order_status_name($order->get_status())), 'error');
                }
            } else {
                wc_add_notice(__('Sorry, this order is invalid and cannot be paid for.', 'woocommerce'), 'error');
            }
        } else {
            wc_add_notice(__('Invalid order.', 'woocommerce'), 'error');
        }
        wc_print_notices();
        do_action('after_woocommerce_pay');
    }
예제 #30
0
        ?>
</span></th>
				<th class="order-status"><span class="nobr"><?php 
        _e('Status', 'rewards');
        ?>
</span></th>
				<th class="order-actions">&nbsp;</th>
			</tr>
		</thead>
		
		<tbody><?php 
        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();