get_formatted_order_total() public méthode

Gets order total - formatted for display.
public get_formatted_order_total ( string $tax_display = '', boolean $display_refunded = true ) : string
$tax_display string Type of tax display.
$display_refunded boolean If should include refunded value.
Résultat string
 /**
  * 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;
 }
		</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>

 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));
 }
Exemple #4
0
" 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>';
Exemple #5
0
/**
 * 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 = '******' . 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 
            break;
        case "note":
            if ($the_order->customer_note) {
                echo '<img src="' . $woocommerce->plugin_url() . '/assets/images/note.png" alt="yes" class="tips" data-tip="' . __('Yes', 'woocommerce') . '" width="14" height="14" />';
            } else {
                echo '<img src="' . $woocommerce->plugin_url() . '/assets/images/note-off.png" alt="no" class="tips" data-tip="' . __('No', 'woocommerce') . '" width="14" height="14" />';
            }
            break;
        case "order_comments":
            echo '<div class="post-com-count-wrapper">
				<a href="' . esc_url(admin_url('post.php?post=' . $post->ID . '&action=edit')) . '" class="post-com-count"><span class="comment-count">' . $post->comment_count . '</span></a>
				</div>';
            break;
    }
}
Exemple #6
0
 /**
  * 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());
 }
Exemple #7
0
         </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) {
Exemple #8
0
    function shortcode_altereports_func()
    {
        include_once ABSPATH . 'wp-admin/includes/plugin.php';
        include_once ABSPATH . WPINC . '/functions.php';
        global $wpdb, $woocommerce, $WC_Order, $woo_options, $WC_API_Reports, $WC_Admin_Dashboard, $WC_Admin_Reports, $WC_Admin_Report, $WC_Report_Customers, $WC_Report_Stock, $WC_alterinventory;
        $results = $wpdb->get_results('SELECT * FROM wp_options WHERE option_id = 1', OBJECT);
        $out = get_option('<h1 style="color:#F00">alterinventory_error_message</h1>', '<h1 style="color:#F00">Please use your Username and Password to Log In </h1>');
        $options = get_option('alterinventory_options');
        $user = wp_get_current_user();
        if (empty($user->ID)) {
            echo $out;
        }
        if (!is_user_logged_in()) {
            wp_login_form();
        } else {
            ?>
    <?php 
            /**
             * Template for Direct Sells
             */
            if (!defined('ABSPATH')) {
                exit;
            }
            global $wpdb, $Product, $item, $item_meta, $product, $woocommerce, $woo_options, $order_count, $WC_API_Reports, $WC_Admin_Dashboard, $WC_Admin_Reports, $WC_Admin_Report, $WC_Report_Customers, $WC_Report_Stock, $WC_alterinventory;
            $customer_orders = get_posts(apply_filters('woocommerce_my_account_my_orders_query', array('numberposts' => $order_count, 'meta_key' => '_customer_user', 'meta_value' => get_current_user_id(), 'post_type' => 'shop_order', 'post_status' => 'publish', 'posts_per_page' => -1, 'paged' => get_query_var('paged'))));
            if ($customer_orders) {
                ?>
<div align="right" style="margin-bottom:-60px" >
<script type="text/javascript">
 function printPage(){
        var tableData = '<table border="1">'+document.getElementsByTagName('table')[0].innerHTML+'</table>';
        var data = '<button onclick="window.print()"> Print </button>'+tableData;
        myWindow=window.open('','','width=1000,height=800px');
        myWindow.innerWidth = screen.width;
        myWindow.innerHeight = screen.height;
        myWindow.screenX = 0;
        myWindow.screenY = 0;
        myWindow.document.write(data);
        myWindow.focus();
    };
 </script>

 <br />
    <a href="javascript:void(0);" class="button" type="submit"  id="printPage" onclick="printPage();">Print</a>
    |
    <a href="alter-inventory/" class="button" type="submit" >
Aggiorna</a>
    <br />
    
    </div>
   
	
<div style="margin-bottom: 40px;" >
<?php 
                $form = '<form role="search" method="get" id="searchform" action="' . esc_url(home_url('/')) . '">
	<div>
		<label class="screen-reader-text" for="s">' . __('Cerca Vendite:', 'woocommerce') . '</label>
		<input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="' . __('Vendite..', 'woocommerce') . '" />
		<input class="button" type="submit" id="searchsubmit" value="' . esc_attr__('Search', 'woocommerce') . '" />
		<input type="hidden" name="post_type" value="product" />
	</div>
</form>';
                echo $form;
                ?>
</div>
<h2>VENDITE</h2>
   
	<table class="shop_table my_account_orders">

		<thead>
        
			<tr>
   
				<th class="order-number"><span class="nobr"><?php 
                _e('#ID Vendita', 'woocommerce');
                ?>
</span></th>
				<th class="order-date"><span class="nobr"><?php 
                _e('Data', 'woocommerce');
                ?>
</span></th>
				<th class="order-status"><span class="nobr"><?php 
                _e('Stato', 'woocommerce');
                ?>
</span></th>
				<th class="order-total"><span class="nobr"><?php 
                _e('Totale', 'woocommerce');
                ?>
</span></th>
                <th class="order-actions"><span class="nobr"><?php 
                _e('Prodotti / Attributi / Totale', 'woocommerce');
                ?>
</span></th>
				<th class="order-actions"><span class="nobr"><?php 
                _e('Dettagli', 'woocommerce');
                ?>
</span></th>
                <th class="order-actions"><span class="nobr"><?php 
                _e('Annullare', 'woocommerce');
                ?>
</span></th>
			</tr>
		</thead>

 <style>
								
								.hentry img { height: auto; max-width: 35%;}
								.woocommerce-message { display:none;}
						    </style>
		<tbody><?php 
                foreach ($customer_orders as $customer_order) {
                    $order = new WC_Order();
                    $order->populate($customer_order);
                    $status = get_term_by('slug', $order->status, 'shop_order_status');
                    $item_count = $order->get_item_count();
                    ?>
<tr class="order">
					<td class="order-number">
						<a href="<?php 
                    echo $order->get_view_order_url();
                    ?>
">
							<?php 
                    echo $order->get_order_number();
                    ?>
						</a>
					</td>
					<td class="order-date">
						<time datetime="<?php 
                    echo date('Y-m-d', strtotime($order->order_date));
                    ?>
" title="<?php 
                    echo esc_attr(strtotime($order->order_date));
                    ?>
"><?php 
                    echo date_i18n(get_option('date_format'), strtotime($order->order_date));
                    ?>
</time>
					</td>
					<td class="order-status" style="text-align:left; text-transform:uppercase; white-space:nowrap; color:#0C0"  >
						<?php 
                    echo ucfirst(__($status->name, 'woocommerce'));
                    ?>
					</td>
					<td class="order-total">
						<?php 
                    echo sprintf(_n('<strong>%s</strong> x <strong>%s Prodotto</strong>', '%s for %s items', $item_count, 'woocommerce'), $order->get_formatted_order_total(), $item_count);
                    ?>
					</td>
                   
		
                 <td class="order-actions">
  <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));
                            ?>
">
					<td  style="text-transform:uppercase;">
						<?php 
                            if ($_product && !$_product->is_visible()) {
                                echo apply_filters('woocommerce_order_item_name', $item['name'], $item);
                            } else {
                                echo apply_filters('woocommerce_order_item_name', sprintf('<a href="%s">%s</a>', get_permalink($item['product_id']), $item['name']), $item);
                            }
                            echo apply_filters('woocommerce_order_item_quantity_html', ' <strong class="product-quantity">' . sprintf('&times; %s', $item['qty']) . '</strong>', $item);
                            $item_meta->display();
                            if ($_product && $_product->exists() && $_product->is_downloadable() && $order->is_download_permitted()) {
                                $download_files = $order->get_item_downloads($item);
                                $i = 0;
                                $links = array();
                                foreach ($download_files as $download_id => $file) {
                                    $i++;
                                    $links[] = '<small><a href="' . esc_url($file['download_url']) . '">' . sprintf(__('Download file%s', 'woocommerce'), count($download_files) > 1 ? ' ' . $i . ': ' : ': ') . esc_html($file['name']) . '</a></small>';
                                }
                                echo '<br/>' . implode('<br/>', $links);
                            }
                            ?>
					</td>
					<td class="product-total" style="color:#F00">
						<?php 
                            echo $order->get_formatted_line_subtotal($item);
                            ?>
					</td>
				</tr>
				
					<?php 
                        }
                    }
                    ?>
	</tbody>
</table>
<div class="clear"></div>
</td>
<td class="order-actions">
                 
						<?php 
                    $actions = array();
                    if (in_array($order->status, apply_filters('woocommerce_valid_order_statuses_for_payment', array('Incompleta', 'Fallita'), $order))) {
                    }
                    $actions['view'] = array('url' => $order->get_view_order_url(), 'name' => __('Dettagli', 'woocommerce'));
                    $actions = apply_filters('woocommerce_my_account_my_orders_actions', $actions, $order);
                    if ($actions) {
                        foreach ($actions as $key => $action) {
                            echo '<a href="' . esc_url($action['url']) . '" class="button ' . sanitize_html_class($key) . '">' . esc_html($action['name']) . '</a>';
                        }
                    }
                    ?>
  				</td>
                    <td class="order-actions">
                    	<?php 
                    $actions = array();
                    $actions['cancel'] = array('url' => $order->get_cancel_order_url(get_permalink(wc_get_page_id('alter-inventory'))), 'name' => __('Cancel', 'woocommerce'));
                    if ($actions) {
                        foreach ($actions as $key => $action) {
                            echo '<a href="' . esc_url($action['url']) . '" class="button ' . sanitize_html_class($key) . '">' . esc_html($action['name']) . '</a>';
                        }
                    }
                    ?>
					</td>
				</tr><?php 
                }
                ?>
</tbody>

	</table>
<?php 
            }
            ?>

	
	<?php 
        }
    }
        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');
                        ?>
</a>
                                <?php 
                    }
                    ?>

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


                            </td>
                        </tr><?php 
                }
                ?>
</tbody>

            </table>
            <?php 
            } else {
                ?>
            <p><?php 
                _e('You have no recent deposits.', 'wc_account_funds');
                ?>
</p>
            <?php 
            }
        }
Exemple #10
0
            ?>
</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'));
 /**
  * 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);
 }
Exemple #12
0
/**
 * 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) {
            echo '<a href="' . esc_url($action['url']) . '" class="button ' . sanitize_html_class($key) . '">' . esc_html($action['name']) . '</a>';
        }
        ?>
                    </td>
                </tr>
            <?php 
    }
    ?>
        </tbody>
    </table>
    <?php 
}
        /**
         * Define our custom columns shown in admin.
         * @param  string $column
         */
        public function custom_columns($column)
        {
            global $post, $woocommerce, $the_order;
            if (empty($the_order) || $the_order->id != $post->ID) {
                $the_order = new WC_Order($post->ID);
            }
            switch ($column) {
                case 'order_status':
                    printf('<mark class="%s tips" data-tip="%s">%s</mark>', sanitize_title($the_order->status), esc_html__($the_order->status, 'woocommerce'), esc_html__($the_order->status, 'woocommerce'));
                    break;
                case 'order_date':
                    if ('0000-00-00 00:00:00' == $post->post_date) {
                        $t_time = $h_time = __('Unpublished', 'woocommerce');
                    } else {
                        $t_time = get_the_time(__('Y/m/d g:i:s A', 'woocommerce'), $post);
                        $gmt_time = strtotime($post->post_date_gmt . ' UTC');
                        $time_diff = current_time('timestamp', 1) - $gmt_time;
                        $h_time = get_the_time(__('Y/m/d', 'woocommerce'), $post);
                    }
                    echo '<abbr title="' . esc_attr($t_time) . '">' . esc_html(apply_filters('post_date_column_time', $h_time, $post)) . '</abbr>';
                    break;
                case 'customer_message':
                    if ($the_order->customer_message) {
                        echo '<span class="note-on tips" data-tip="' . esc_attr($the_order->customer_message) . '">' . __('Yes', 'woocommerce') . '</span>';
                    } else {
                        echo '<span class="na">&ndash;</span>';
                    }
                    break;
                case 'billing_address':
                    if ($the_order->get_formatted_billing_address()) {
                        echo '<a target="_blank" href="' . esc_url('http://maps.google.com/maps?&q=' . urlencode($the_order->get_billing_address()) . '&z=16') . '">' . esc_html(preg_replace('#<br\\s*/?>#i', ', ', $the_order->get_formatted_billing_address())) . '</a>';
                    } else {
                        echo '&ndash;';
                    }
                    if ($the_order->payment_method_title) {
                        echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($the_order->payment_method_title) . '</small>';
                    }
                    break;
                case 'order_items':
                    printf('<a href="#" class="show_order_items">' . _n('%d item', '%d items', sizeof($the_order->get_items()), 'woocommerce') . '</a>', sizeof($the_order->get_items()));
                    if (sizeof($the_order->get_items()) > 0) {
                        echo '<table class="order_items" cellspacing="0">';
                        foreach ($the_order->get_items() as $item) {
                            $_product = apply_filters('woocommerce_order_item_product', $the_order->get_product_from_item($item), $item);
                            $item_meta = new WC_Order_Item_Meta($item['item_meta']);
                            $item_meta_html = $item_meta->display(true, true);
                            ?>
						<tr>
							<td class="qty"><?php 
                            echo absint($item['qty']);
                            ?>
</td>
							<td class="name">
								<?php 
                            if (wc_product_sku_enabled() && $_product && $_product->get_sku()) {
                                echo $_product->get_sku() . ' - ';
                            }
                            echo apply_filters('woocommerce_order_item_name', $item['name'], $item);
                            ?>
								<?php 
                            if ($item_meta_html) {
                                ?>
									<a class="tips" href="#" data-tip="<?php 
                                echo esc_attr($item_meta_html);
                                ?>
">[?]</a>
								<?php 
                            }
                            ?>
							</td>
						</tr>
						<?php 
                        }
                        echo '</table>';
                    } else {
                        echo '&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 = '******' . 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;
            }
        }
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;
    }
}
/**
 * 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>
				<?php 
            } 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();
        }
    }
    do_action('after_woocommerce_pay');
}
" 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, ETHEME_DOMAIN));
        ?>
					</td>
					<td class="order-total">
						<?php 
        echo sprintf(_n('%s for %s item', '%s for %s items', $item_count, ETHEME_DOMAIN), $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', ETHEME_DOMAIN));
        }
        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', ETHEME_DOMAIN));
        }
        $actions['view'] = array('url' => $order->get_view_order_url(), 'name' => __('Xem', ETHEME_DOMAIN));
        $actions = apply_filters('woocommerce_my_account_my_orders_actions', $actions, $order);
        if ($actions) {
            foreach ($actions as $key => $action) {
" 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, 'woocommerce'));
        ?>
					</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();
        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'));
        }
        $actions['view'] = array('url' => add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('view_order'))), 'name' => __('View', 'woocommerce'));
        $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>';
Exemple #18
-1
function get_order_item_totals1( $tax_display = '' ) {
	if(is_wc_endpoint_url( 'order-received' ))
	{
		
		$order_id=wc_get_order_id_by_order_key( $_GET['key']);
		$order=new WC_Order($order_id);
		/*echo '<pre>';
		print_r($order);
		echo '</pre>';*/
		$coupons=$order->get_used_coupons();
		$coupon_code=$coupons[0];
		$coupon_data=new WC_Coupon($coupon_code);
		$discount = get_post_meta($coupon_data->id,'coupon_amount',true);
		$type = get_post_meta($coupon_data->id,'discount_type',true);
		
		if($type=='percent'){
			$coupon_label=$discount.'&#37; Rabatt';
		}
		else{
			$coupon_label='Rabatt';
		}
		if ( ! $tax_display ) {
			$tax_display = $order->tax_display_cart;
		}
		
		
		if ( 'itemized' == get_option( 'woocommerce_tax_total_display' ) ) {
			
			
			foreach ( $order->get_tax_totals() as $code => $tax ) {
				$tax->rate = WC_Tax::get_rate_percent( $tax->rate_id );
				
				if ( ! isset( $tax_array[ 'tax_rate'] ) )
					$tax_array[ 'tax_rate' ] = array( 'tax' => $tax, 'amount' => $tax->amount, 'contains' => array( $tax ) );
				else {
					array_push( $tax_array[ 'tax_rate' ][ 'contains' ], $tax );
					$tax_array[ 'tax_rate' ][ 'amount' ] += $tax->amount;
				}
			}
			if(isset($tax_array['tax_rate']['tax']->rate))
			$tax_label='<span class="include_tax">(inkl.&nbsp;'.$tax_array['tax_rate']['tax']->rate.'&nbsp;'.$tax_array['tax_rate']['tax']->label.')</span>';
		}
			
		$total_rows = array();
		
		$shippingcost='0 '.get_woocommerce_currency_symbol();
		
		if ( $order->get_total_discount() > 0 ) {
			$total_rows['discount'] = array(
				'label' => __( $coupon_label, 'woocommerce' ),
				'value'	=> '-' . $order->get_discount_to_display( $tax_display )
			);
		}

		
			$total_rows['shipping'] = array(
				'label' => __( 'Versandkosten', 'woocommerce' ),
				'value'	=>$shippingcost
			);
		

		$total_rows['order_total'] = array(
			'label' => __( 'Gesamtsumme '.$tax_label, 'woocommerce' ),
			'value'	=> $order->get_formatted_order_total( $tax_display )
		);

		return $total_rows;
	}
}