当前位置: 首页>>代码示例>>PHP>>正文


PHP WC_Order::get_formatted_order_total方法代码示例

本文整理汇总了PHP中WC_Order::get_formatted_order_total方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Order::get_formatted_order_total方法的具体用法?PHP WC_Order::get_formatted_order_total怎么用?PHP WC_Order::get_formatted_order_total使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WC_Order的用法示例。


在下文中一共展示了WC_Order::get_formatted_order_total方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_total

 /**
  * Get the total amount with or without refunds
  * @return string
  */
 public function get_total()
 {
     $total = '';
     if ($this->order->get_total_refunded() > 0) {
         $total_after_refund = $this->order->get_total() - $this->order->get_total_refunded();
         $total = '<del class="total-without-refund">' . strip_tags($this->order->get_formatted_order_total()) . '</del> <ins>' . wc_price($total_after_refund, array('currency' => $this->order->get_order_currency())) . '</ins>';
     } else {
         $total = $this->order->get_formatted_order_total();
     }
     return $total;
 }
开发者ID:siggykun,项目名称:woocommerce-pdf-invoices,代码行数:15,代码来源:bewpi-invoice.php

示例2: strtotime

		</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');

				?><tr class="order">
					<td class="order-number" width="1%">
						<a href="<?php echo esc_url( add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('view_order'))) ); ?>"><?php echo $order->get_order_number(); ?></a> &ndash; <time 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-shipto"><address><?php if ($order->get_formatted_shipping_address()) echo $order->get_formatted_shipping_address(); else echo '&ndash;'; ?></address></td>
					<td class="order-total" width="1%"><?php echo $order->get_formatted_order_total(); ?></td>
					<td class="order-status" style="text-align:left; white-space:nowrap;">
						<?php echo ucfirst( __( $status->name, 'woocommerce' ) ); ?>
						<?php if (in_array($order->status, array('pending', 'failed'))) : ?>
							<a href="<?php echo esc_url( $order->get_cancel_order_url() ); ?>" class="cancel" title="<?php _e('Click to cancel this order', 'woocommerce'); ?>">(<?php _e('Cancel', 'woocommerce'); ?>)</a>
						<?php endif; ?>
					</td>
					<td class="order-actions" style="text-align:right; white-space:nowrap;">

						<?php if (in_array($order->status, array('pending', 'failed'))) : ?>
							<a href="<?php echo esc_url( $order->get_checkout_payment_url() ); ?>" class="button btn theme pay"><?php _e('Pay', 'woocommerce'); ?></a>
						<?php endif; ?>

						<a href="<?php echo esc_url( add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('view_order'))) ); ?>" class="btn button"><?php _e('View', 'woocommerce'); ?></a>

开发者ID:phanhoanglong2610,项目名称:flowershop,代码行数:29,代码来源:my-orders.php

示例3:

 function meta_box()
 {
     global $woocommerce, $post;
     $order = new WC_Order($post->ID);
     $order_discount = $order->get_total_discount();
     $order_tax = $order->get_total_tax();
     $order_subtotal = $order->get_subtotal_to_display();
     $order_total = $order->get_formatted_order_total();
     get_payment_gateway_fields('paypal');
     woocommerce_wp_select(array('id' => 'payment_type', 'label' => '', 'value' => 'default', 'options' => ins_get_payment_methods(), 'class' => 'chosen-select'));
     woocommerce_wp_select(array('id' => 'add_coupon', 'label' => '', 'value' => 'default', 'options' => ins_get_coupons(), 'class' => 'chosen-select'));
     woocommerce_wp_text_input(array('id' => 'sub_total', 'label' => __('Order Subtotal', 'instore'), 'placeholder' => 0.0, 'value' => $order_subtotal));
     woocommerce_wp_text_input(array('id' => 'order_tax', 'label' => __('Order Tax', 'instore'), 'placeholder' => 0.0, 'value' => $order_tax));
     woocommerce_wp_text_input(array('id' => 'applied_discount', 'label' => __('Applied Discount', 'instore'), 'placeholder' => 0.0, 'value' => $order_discount));
 }
开发者ID:jusmark123,项目名称:instore-Dev,代码行数:15,代码来源:class-instore-admin-shop-metabox.php

示例4: strtotime

" 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 ucfirst(__($status->name, 'dokan'));
            ?>
                                        </td>
                                        <td class="order-total">
                                            <?php 
            echo sprintf(_n('%s for %s item', '%s for %s items', $item_count, 'dokan'), $order->get_formatted_order_total(), $item_count);
            ?>
                                        </td>
                                        <td class="order-actions">
                                            <?php 
            $actions = array();
            if (in_array($order->status, apply_filters('woocommerce_valid_order_statuses_for_payment', array('pending', 'failed'), $order))) {
                $actions['pay'] = array('url' => $order->get_checkout_payment_url(), 'name' => __('Pay', 'dokan'));
            }
            if (in_array($order->status, apply_filters('woocommerce_valid_order_statuses_for_cancel', array('pending', 'failed'), $order))) {
                $actions['cancel'] = array('url' => $order->get_cancel_order_url(get_permalink(wc_get_page_id('myaccount'))), 'name' => __('Cancel', 'dokan'));
            }
            $actions['view'] = array('url' => $order->get_view_order_url(), 'name' => __('View', 'dokan'));
            $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>';
开发者ID:uwitec,项目名称:findgreatmaster,代码行数:31,代码来源:my-orders.php

示例5: woocommerce_custom_order_columns

/**
 * Values for the custom columns on the orders page.
 *
 * @access public
 * @param mixed $column
 * @return void
 */
function woocommerce_custom_order_columns($column)
{
    global $post, $woocommerce, $the_order;
    if (empty($the_order) || $the_order->id != $post->ID) {
        $the_order = new WC_Order($post->ID);
    }
    switch ($column) {
        case "order_status":
            printf('<mark class="%s tips" data-tip="%s">%s</mark>', sanitize_title($the_order->status), esc_html__($the_order->status, 'woocommerce'), esc_html__($the_order->status, 'woocommerce'));
            break;
        case "order_title":
            if ($the_order->user_id) {
                $user_info = get_userdata($the_order->user_id);
            }
            if (!empty($user_info)) {
                $user = '<a href="user-edit.php?user_id=' . absint($user_info->ID) . '">';
                if ($user_info->first_name || $user_info->last_name) {
                    $user .= esc_html($user_info->first_name . ' ' . $user_info->last_name);
                } else {
                    $user .= esc_html($user_info->display_name);
                }
                $user .= '</a>';
            } else {
                $user = __('Guest', 'woocommerce');
            }
            echo '<a href="' . admin_url('post.php?post=' . absint($post->ID) . '&action=edit') . '"><strong>' . sprintf(__('Order %s', 'woocommerce'), esc_attr($the_order->get_order_number())) . '</strong></a> ' . __('made by', 'woocommerce') . ' ' . $user;
            if ($the_order->billing_email) {
                echo '<small class="meta">' . __('Email:', 'woocommerce') . ' ' . '<a href="' . esc_url('mailto:' . $the_order->billing_email) . '">' . esc_html($the_order->billing_email) . '</a></small>';
            }
            if ($the_order->billing_phone) {
                echo '<small class="meta">' . __('Tel:', 'woocommerce') . ' ' . esc_html($the_order->billing_phone) . '</small>';
            }
            break;
        case "billing_address":
            if ($the_order->get_formatted_billing_address()) {
                echo '<a target="_blank" href="' . esc_url('http://maps.google.com/maps?&q=' . urlencode($the_order->get_billing_address()) . '&z=16') . '">' . esc_html(preg_replace('#<br\\s*/?>#i', ', ', $the_order->get_formatted_billing_address())) . '</a>';
            } else {
                echo '&ndash;';
            }
            if ($the_order->payment_method_title) {
                echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($the_order->payment_method_title) . '</small>';
            }
            break;
        case "shipping_address":
            if ($the_order->get_formatted_shipping_address()) {
                echo '<a target="_blank" href="' . esc_url('http://maps.google.com/maps?&q=' . urlencode($the_order->get_shipping_address()) . '&z=16') . '">' . esc_html(preg_replace('#<br\\s*/?>#i', ', ', $the_order->get_formatted_shipping_address())) . '</a>';
            } else {
                echo '&ndash;';
            }
            if ($the_order->shipping_method_title) {
                echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($the_order->shipping_method_title) . '</small>';
            }
            break;
        case "total_cost":
            echo esc_html(strip_tags($the_order->get_formatted_order_total()));
            break;
        case "order_date":
            if ('0000-00-00 00:00:00' == $post->post_date) {
                $t_time = $h_time = __('Unpublished', 'woocommerce');
            } else {
                $t_time = get_the_time(__('Y/m/d g:i:s A', 'woocommerce'), $post);
                $gmt_time = strtotime($post->post_date_gmt . ' UTC');
                $time_diff = current_time('timestamp', 1) - $gmt_time;
                if ($time_diff > 0 && $time_diff < 24 * 60 * 60) {
                    $h_time = sprintf(__('%s ago', 'woocommerce'), human_time_diff($gmt_time, current_time('timestamp', 1)));
                } else {
                    $h_time = get_the_time(__('Y/m/d', 'woocommerce'), $post);
                }
            }
            echo '<abbr title="' . esc_attr($t_time) . '">' . esc_html(apply_filters('post_date_column_time', $h_time, $post)) . '</abbr>';
            break;
        case "order_actions":
            ?>
<p>
				<?php 
            do_action('woocommerce_admin_order_actions_start', $the_order);
            $actions = array();
            if (in_array($the_order->status, array('pending', 'on-hold'))) {
                $actions['processing'] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce-mark-order-processing&order_id=' . $post->ID), 'woocommerce-mark-order-processing'), 'name' => __('Processing', 'woocommerce'), 'action' => "processing");
            }
            if (in_array($the_order->status, array('pending', 'on-hold', 'processing'))) {
                $actions['complete'] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce-mark-order-complete&order_id=' . $post->ID), 'woocommerce-mark-order-complete'), 'name' => __('Complete', 'woocommerce'), 'action' => "complete");
            }
            $actions['view'] = array('url' => admin_url('post.php?post=' . $post->ID . '&action=edit'), 'name' => __('View', 'woocommerce'), 'action' => "view");
            $actions = apply_filters('woocommerce_admin_order_actions', $actions, $the_order);
            foreach ($actions as $action) {
                $image = isset($action['image_url']) ? $action['image_url'] : $woocommerce->plugin_url() . '/assets/images/icons/' . $action['action'] . '.png';
                printf('<a class="button tips" href="%s" data-tip="%s"><img src="%s" alt="%s" width="14" /></a>', esc_url($action['url']), esc_attr($action['name']), esc_attr($image), esc_attr($action['name']));
            }
            do_action('woocommerce_admin_order_actions_end', $the_order);
            ?>

			</p><?php 
//.........这里部分代码省略.........
开发者ID:joshquila,项目名称:demo2-youse,代码行数:101,代码来源:shop_order.php

示例6:

 /**
  * Test: get_formatted_order_total
  */
 function test_get_formatted_order_total()
 {
     $object = new WC_Order();
     $object->set_total(100);
     $object->set_currency('USD');
     $this->assertEquals('<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">&#36;</span>100.00</span>', $object->get_formatted_order_total());
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:10,代码来源:crud.php

示例7: foreach

         </tr>
     </thead>
     <tbody>
         <?php 
 foreach ($user_orders as $order) {
     $the_order = new WC_Order($order->order_id);
     ?>
             <tr>
                 <td class="dokan-order-id">
                     <?php 
     echo '<a href="' . wp_nonce_url(add_query_arg(array('order_id' => $the_order->id), dokan_get_navigation_url('orders')), 'dokan_view_order') . '"><strong>' . sprintf(__('Order %s', 'dokan'), esc_attr($the_order->get_order_number())) . '</strong></a>';
     ?>
                 </td>
                 <td class="dokan-order-total">
                     <?php 
     echo esc_html(strip_tags($the_order->get_formatted_order_total()));
     ?>
                 </td>
                 <td class="dokan-order-status">
                     <?php 
     printf(__('<span class="dokan-label dokan-label-%s">%s</span>', 'dokan'), dokan_get_order_status_class($the_order->status), esc_html__($the_order->status));
     ?>
                 </td>
                 <td class="dokan-order-customer">
                     <?php 
     if ($the_order->user_id) {
         $user_info = get_userdata($the_order->user_id);
     }
     if (!empty($user_info)) {
         $user = '';
         if ($user_info->first_name || $user_info->last_name) {
开发者ID:Artgorae,项目名称:wp-artgorae,代码行数:31,代码来源:listing.php

示例8: array


//.........这里部分代码省略.........
                    $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">
  <table class="shop_table order_details">
	<thead>
		<tr>
			<th class="product-name"><?php 
                    _e('Product', 'woocommerce');
                    ?>
</th>
			<th class="product-total"><?php 
                    _e('Total', 'woocommerce');
                    ?>
</th>
		</tr>
	</thead>
    
	<tfoot>
	
	</tfoot>
	<tbody>
		<?php 
                    if (sizeof($order->get_items()) > 0) {
                        foreach ($order->get_items() as $item) {
                            $_product = apply_filters('woocommerce_order_item_product', $order->get_product_from_item($item), $item);
                            $item_meta = new WC_Order_Item_Meta($item['item_meta'], $_product);
                            ?>
				<tr class="<?php 
                            echo esc_attr(apply_filters('woocommerce_order_item_class', 'order_item', $item, $order));
                            ?>
开发者ID:sawan34,项目名称:tanzi,代码行数:67,代码来源:inventory.php

示例9: array

        function my_account_orders()
        {
            global $woocommerce;
            $customer_id = get_current_user_id();
            if (version_compare(WC_VERSION, '2.2.0', '<')) {
                $args = array('numberposts' => 50, 'meta_key' => '_customer_user', 'meta_value' => $customer_id, 'post_type' => 'shop_order', 'meta_query' => array(array('key' => '_funds_deposited', 'value' => '1')));
            } else {
                $args = array('numberposts' => 50, 'meta_key' => '_customer_user', 'meta_value' => $customer_id, 'post_type' => 'shop_order', 'post_status' => array('wc-completed', 'wc-processing', 'wc-on-hold'), 'meta_query' => array(array('key' => '_funds_deposited', 'value' => '1')));
            }
            $deposits = get_posts($args);
            ?>
            <h2><?php 
            _e('Recent Deposits', 'wc_account_funds');
            ?>
</h2>
            <?php 
            if ($deposits) {
                ?>
            <table class="shop_table my_account_deposits">

                <thead>
                    <tr>
                        <th class="order-number"><span class="nobr"><?php 
                _e('Order', 'woocommerce');
                ?>
</span></th>
                        <th class="order-date"><span class="nobr"><?php 
                _e('Date', 'woocommerce');
                ?>
</span></th>
                        <th class="order-total"><span class="nobr"><?php 
                _e('Total', 'woocommerce');
                ?>
</span></th>
                        <th class="order-status" colspan="2"><span class="nobr"><?php 
                _e('Status', 'woocommerce');
                ?>
</span></th>
                    </tr>
                </thead>

                <tbody><?php 
                foreach ($deposits as $deposit) {
                    $order = new WC_Order();
                    $order->populate($deposit);
                    $status = get_term_by('slug', $order->status, 'shop_order_status');
                    ?>
<tr class="order">
                            <td class="order-number" width="1%">
                                <a href="<?php 
                    echo esc_url(add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('view_order'))));
                    ?>
"><?php 
                    echo $order->get_order_number();
                    ?>
</a>
                            </td>
                            <td class="order-date"><time 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-total" width="1%"><?php 
                    echo $order->get_formatted_order_total();
                    ?>
</td>
                            <td class="order-status" style="text-align:left; white-space:nowrap;">
                                <?php 
                    echo ucfirst(__($status->name, 'woocommerce'));
                    ?>
                                <?php 
                    if (in_array($order->status, array('pending', 'failed'))) {
                        ?>
                                    <a href="<?php 
                        echo esc_url($order->get_cancel_order_url());
                        ?>
" class="cancel" title="<?php 
                        _e('Click to cancel this order', 'woocommerce');
                        ?>
">(<?php 
                        _e('Cancel', 'woocommerce');
                        ?>
)</a>
                                <?php 
                    }
                    ?>
                            </td>
                            <td class="order-actions" style="text-align:right; white-space:nowrap;">

                                <?php 
                    if (in_array($order->status, array('pending', 'failed'))) {
                        ?>
                                    <a href="<?php 
                        echo esc_url($order->get_checkout_payment_url());
                        ?>
" class="button pay"><?php 
                        _e('Pay', 'woocommerce');
                        ?>
//.........这里部分代码省略.........
开发者ID:bulbulbigboss,项目名称:bigboss-woocommerce-deposit-funds,代码行数:101,代码来源:bigbosswoocommerce-deposit-funds.php

示例10: ucfirst

            ?>
</time>
					</td>
					<td class="order-number">
						<a href="<?php 
            echo esc_url(add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('view_order'))));
            ?>
">
							<?php 
            echo $order->get_order_number();
            ?>
						</a>
					</td>
					<td class="order-amount">
						<?php 
            echo $order->get_formatted_order_total();
            ?>
					</td>
					<td class="order-status" style="text-align:left; white-space:nowrap;">
						<?php 
            echo ucfirst(__($status->name, 'woocommerce'));
            ?>
					</td>
					<td class="order-actions">
						<?php 
            $actions = array();
            if (in_array($order->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'));
            }
            if (in_array($order->status, apply_filters('woocommerce_valid_order_statuses_for_cancel', array('pending', 'failed'), $order))) {
                $actions['cancel'] = array('url' => $order->get_cancel_order_url(), 'name' => __('Cancel', 'woocommerce'));
开发者ID:roycocup,项目名称:enclothed,代码行数:31,代码来源:my-orders.php

示例11: get_formatted_order_total

 /**
  * Gets order total - formatted for display.
  *
  * @return string
  */
 public function get_formatted_order_total($tax_display = '', $display_refunded = true)
 {
     if ($this->get_total() > 0 && !empty($this->billing_period)) {
         $formatted_order_total = wcs_price_string($this->get_price_string_details($this->get_total()));
     } else {
         $formatted_order_total = parent::get_formatted_order_total();
     }
     return apply_filters('woocommerce_get_formatted_subscription_total', $formatted_order_total, $this);
 }
开发者ID:ltdat287,项目名称:id.nhomdichvu,代码行数:14,代码来源:class-wc-subscription.php

示例12: 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">&nbsp;</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) {
//.........这里部分代码省略.........
开发者ID:abcode619,项目名称:wpstuff,代码行数:101,代码来源:wc-template.php

示例13: custom_columns


//.........这里部分代码省略.........
								<?php 
                            }
                            ?>
							</td>
						</tr>
						<?php 
                        }
                        echo '</table>';
                    } else {
                        echo '&ndash;';
                    }
                    break;
                case 'shipping_address':
                    if ($the_order->get_formatted_shipping_address()) {
                        echo '<a target="_blank" href="' . esc_url('http://maps.google.com/maps?&q=' . urlencode($the_order->get_shipping_address()) . '&z=16') . '">' . esc_html(preg_replace('#<br\\s*/?>#i', ', ', $the_order->get_formatted_shipping_address())) . '</a>';
                    } else {
                        echo '&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
                        $post->post_status !== 'trash' ? $status = '' : ($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="' . esc_attr($latest_note->comment_content) . '">' . __('Yes', 'woocommerce') . '</span>';
                        } else {
                            $note_tip = isset($latest_note->comment_content) ? esc_attr($latest_note->comment_content . '<small style="display:block">' . sprintf(_n('plus %d other note', 'plus %d other notes', $post->comment_count - 1, 'woocommerce'), $post->comment_count - 1) . '</small>') : sprintf(_n('%d note', '%d notes', $post->comment_count, 'woocommerce'), $post->comment_count);
                            echo '<span class="note-on tips" data-tip="' . $note_tip . '">' . __('Yes', 'woocommerce') . '</span>';
                        }
                    } else {
                        echo '<span class="na">&ndash;</span>';
                    }
                    break;
                case 'order_total':
                    echo esc_html(strip_tags($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 = '';
                    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;
                    }
                    echo '<div class="tips" data-tip="' . esc_attr($customer_tip) . '">';
                    if ($the_order->user_id) {
                        $user_info = get_userdata($the_order->user_id);
                    }
                    if (!empty($user_info)) {
                        $username = '<a href="user-edit.php?user_id=' . 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(__('%s by %s', 'woocommerce'), '<a href="' . admin_url('post.php?post=' . absint($post->ID) . '&action=edit') . '"><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 '</div>';
                    break;
                case 'order_actions':
                    ?>
<p>
					<?php 
                    do_action('woocommerce_admin_order_actions_start', $the_order);
                    $actions = array();
                    if (in_array($the_order->status, array('pending', 'on-hold'))) {
                        $actions['processing'] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce_mark_order_processing&order_id=' . $post->ID), 'woocommerce-mark-order-processing'), 'name' => __('Processing', 'woocommerce'), 'action' => "processing");
                    }
                    if (in_array($the_order->status, array('pending', 'on-hold', 'processing'))) {
                        $actions['complete'] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce_mark_order_complete&order_id=' . $post->ID), 'woocommerce-mark-order-complete'), 'name' => __('Complete', 'woocommerce'), 'action' => "complete");
                    }
                    $actions['view'] = array('url' => admin_url('post.php?post=' . $post->ID . '&action=edit'), 'name' => __('View', 'woocommerce'), 'action' => "view");
                    $actions = apply_filters('woocommerce_admin_order_actions', $actions, $the_order);
                    foreach ($actions as $action) {
                        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;
            }
        }
开发者ID:chhavinav,项目名称:fr.ilovejuice,代码行数:101,代码来源:class-wc-admin-cpt-shop_order.php

示例14: generate_attendee_csv

function generate_attendee_csv($export_event_id)
{
    $all_attendees = TribeEventsTickets::get_event_attendees($export_event_id);
    $export_attendee_list = array();
    $counter = 0;
    $attendee_counter = 1;
    $old_order_id = 0;
    foreach ($all_attendees as $attendee) {
        $order_id = $attendee['order_id'];
        $order = new WC_Order($order_id);
        $order_meta = get_post_meta($order_id);
        $_product_id = $attendee['product_id'];
        // Purchaser Name
        $purchaser_name = $order_meta['_billing_first_name'][0] . ' ' . $order_meta['_billing_last_name'][0];
        // Company
        $company = $order_meta['_billing_company'][0];
        // Address
        $address1 = $order_meta['_billing_address_1'][0];
        $address2 = $order_meta['_billing_address_2'][0];
        $address = $address1 . ' ' . $address2;
        // City, State & Zip
        $city = $order_meta['_billing_city'][0];
        $state = $order_meta['_billing_state'][0];
        $zip = $order_meta['_billing_postcode'][0];
        // Email
        $purchaser_email = $order_meta['_billing_email'][0];
        // Amount paid
        $amt_paid = $order->get_formatted_order_total();
        $amt_paid = html_entity_decode(strip_tags($amt_paid), ENT_QUOTES, 'utf-8');
        // Reset the counter after each order
        if ($old_order_id == 0) {
            $old_order_id = $order_id;
        } else {
            if ($order_id != $old_order_id) {
                $attendee_counter = 1;
                $old_order_id = $order_id;
            }
        }
        // Attendee Name, Attendee Email, Job Title, Dietary Restrictions & Phone
        //$attendee_name                 = get_post_meta( $order_id, 'attendee_name_'.$_product_id.'_'.$attendee_counter, true);
        $attendee_first_name = get_post_meta($order_id, 'attendee_first_name_' . $_product_id . '_' . $attendee_counter, true);
        if (empty($attendee_first_name)) {
            $attendee_first_name = get_post_meta($order_id, 'attendee_name_' . $_product_id . '_' . $attendee_counter, true);
        }
        $attendee_last_name = get_post_meta($order_id, 'attendee_last_name_' . $_product_id . '_' . $attendee_counter, true);
        $attendee_email = get_post_meta($order_id, 'attendee_email_' . $_product_id . '_' . $attendee_counter, true);
        $attendee_job_title = get_post_meta($order_id, 'attendee_job_title_' . $_product_id . '_' . $attendee_counter, true);
        $attendee_dietary_restrictions = get_post_meta($order_id, 'attendee_dietary_restrictions_' . $_product_id . '_' . $attendee_counter, true);
        $phone = $order_meta['_billing_phone'][0];
        $discount = round($order_meta['_cart_discount'][0], 2);
        $coupons = $order->get_used_coupons();
        $coupon = $coupons[0];
        if (!$coupon) {
            $coupon = $discount = "";
        } else {
            $discount = "\$" . $discount;
        }
        $export_attendee_list[$counter] = array($purchaser_name, $phone, $company, $address, $city, $state, $zip, $purchaser_email, $amt_paid, $attendee_first_name, $attendee_last_name, $attendee_email, $attendee_company, $attendee_job_title, $attendee_dietary_restrictions, $attendee_cell_phone, $attendee_work_phone, $coupon, $discount);
        $counter++;
        $attendee_counter++;
    }
    $event = get_post($export_event_id);
    if (!empty($export_attendee_list)) {
        $charset = get_option('blog_charset');
        $start_date = strtotime(get_post_meta($event, '_EventStartDate', true));
        $filename = $event->post_name;
        // output headers so that the file is downloaded rather than displayed
        header("Content-Type: text/csv; charset={$charset}");
        header("Content-Disposition: attachment; filename={$filename}-attendees.csv");
        // create a file pointer connected to the output stream
        $output = fopen('php://output', 'w');
        fputcsv($output, array('Purchaser Name', 'Purchaser Phone', 'Purchaser Company', 'Address', 'City', 'State', 'Zip', 'Purchaser Email', 'Amount Paid', 'Attendee First Name', 'Attendee Last Name', 'Attendee Email', 'Attendee Company', 'Job Title', 'Dietary Restrictions', 'Cell Phone', 'Work Phone', 'Coupon Code', 'Coupon Amount'));
        foreach ($export_attendee_list as $item) {
            fputcsv($output, $item);
        }
        fclose($output);
        exit;
    }
}
开发者ID:georgi-kovachev,项目名称:mapClass,代码行数:79,代码来源:attendees-export.php

示例15: woocommerce_pay

/**
 * Outputs the pay page - payment gateways can hook in here to show payment forms etc
 **/
function woocommerce_pay()
{
    global $woocommerce;
    $woocommerce->nocache();
    do_action('before_woocommerce_pay');
    $woocommerce->show_messages();
    if (isset($_GET['pay_for_order']) && isset($_GET['order']) && isset($_GET['order_id'])) {
        // Pay for existing order
        $order_key = urldecode($_GET['order']);
        $order_id = (int) $_GET['order_id'];
        $order = new WC_Order($order_id);
        if ($order->id == $order_id && $order->order_key == $order_key && in_array($order->status, array('pending', 'failed'))) {
            // Set customer location to order location
            if ($order->billing_country) {
                $woocommerce->customer->set_country($order->billing_country);
            }
            if ($order->billing_state) {
                $woocommerce->customer->set_state($order->billing_state);
            }
            if ($order->billing_postcode) {
                $woocommerce->customer->set_postcode($order->billing_postcode);
            }
            // Show form
            woocommerce_get_template('checkout/form-pay.php', array('order' => $order));
        } elseif (!in_array($order->status, array('pending', 'failed'))) {
            $woocommerce->add_error(__('Your order has already been paid for. Please contact us if you need assistance.', 'woocommerce'));
            $woocommerce->show_messages();
        } else {
            $woocommerce->add_error(__('Invalid order.', 'woocommerce'));
            $woocommerce->show_messages();
        }
    } else {
        // Pay for order after checkout step
        if (isset($_GET['order'])) {
            $order_id = $_GET['order'];
        } else {
            $order_id = 0;
        }
        if (isset($_GET['key'])) {
            $order_key = $_GET['key'];
        } else {
            $order_key = '';
        }
        if ($order_id > 0) {
            $order = new WC_Order($order_id);
            if ($order->order_key == $order_key && in_array($order->status, array('pending', 'failed'))) {
                ?>
				<ul class="order_details">
					<li class="order">
						<?php 
                _e('Order:', '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>
//.........这里部分代码省略.........
开发者ID:rajveerbeniwal,项目名称:rooms-dhkh,代码行数:101,代码来源:shortcode-pay.php


注:本文中的WC_Order::get_formatted_order_total方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。