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


PHP WC_Order::get_formatted_shipping_address方法代码示例

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


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

示例1: States

 /**
  * Test: get_formatted_shipping_address
  */
 function test_get_formatted_shipping_address()
 {
     $object = new WC_Order();
     $object->set_shipping_first_name('Barney');
     $object->set_shipping_last_name('Rubble');
     $object->set_shipping_company('Bedrock Ltd.');
     $object->set_shipping_address_1('34 Stonepants avenue');
     $object->set_shipping_address_2('Rockville');
     $object->set_shipping_city('Bedrock');
     $object->set_shipping_state('Boulder');
     $object->set_shipping_postcode('00001');
     $object->set_shipping_country('US');
     $this->assertEquals('Barney Rubble<br/>Bedrock Ltd.<br/>34 Stonepants avenue<br/>Rockville<br/>Bedrock, BOULDER 00001<br/>United States (US)', $object->get_formatted_shipping_address());
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:17,代码来源:crud.php

示例2: strtotime

			</tr>
		</thead>

		<tbody><?php
			foreach ($customer_orders as $customer_order) :
				$order = new WC_Order();

				$order->populate( $customer_order );

				$status = get_term_by('slug', $order->status, 'shop_order_status');

				?><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,代码行数:30,代码来源:my-orders.php

示例3: sm_woo_get_packing_slip


//.........这里部分代码省略.........

                position: relative;
                top:-30pt;
            }
            .producthead{ 
                text-align: left;
            }
            .pricehead{
                text-align: right;
            }
            .sm_address_div{
                position: relative;
                left:28pt;
            }
            .sm_email_span{
                position: relative;
                left:10pt;
            }

        </style>
        <?php 
        $counter = 0;
        foreach ($purchase_id_arr as $purchase_id_value) {
            $order = new WC_Order($purchase_id_value);
            $date_format = get_option('date_format');
            if (is_plugin_active('woocommerce-sequential-order-numbers-pro/woocommerce-sequential-order-numbers.php')) {
                $purchase_display_id = isset($order->order_custom_fields['_order_number_formatted'][0]) ? $order->order_custom_fields['_order_number_formatted'][0] : $purchase_id_value;
            } else {
                $purchase_display_id = $purchase_id_value;
            }
            $counter++;
            if (count($purchase_id_arr) == $counter) {
                echo '<div id="wrapper_last">';
            } else {
                echo '<div id="wrapper">';
            }
            echo smart_manager_print_logo();
            echo '<div style="margin-top:-0.8em;">';
            echo '<h4 style="font:bold 1.2em/2em "Century Gothic","Trebuchet MS",Arial,Helvetica,sans-serif;
                    position:relative; 12pt;">&nbsp; ' . get_bloginfo('name') . '</h4>';
            echo '<table class="address" style="position:relative; top:-22pt; left:-35pt;">';
            echo '<tr><td class="address_border" colspan="2" valign="top" width="50%"><span style="position:relative; left:27pt; top:10pt;">
                    <b>Order # ' . $purchase_display_id . ' - ' . date($date_format, strtotime($order->order_date)) . '</b></span><br/></td></tr>';
            echo '<tr><td class="address_border" width="35%" align="center"><br/><div class="sm_address_div">';
            $formatted_billing_address = $order->get_formatted_billing_address();
            if ($formatted_billing_address != '') {
                echo '<b>' . __('Billing Address', 'smart-manager') . '</b><p>';
                echo $formatted_billing_address;
                echo '</p></td>';
            }
            $formatted_shipping_address = $order->get_formatted_shipping_address();
            if ($formatted_shipping_address != '') {
                echo '<td class="address_border" width="30%"><br/><div style="position:relative; top:3pt;"><b>' . __('Shipping Address', 'smart-manager') . '</b><p>';
                echo $formatted_shipping_address;
                echo '</p></div></td>';
            }
            echo '</tr>';
            echo '<tr><td colspan="2" class="address_border"><span class="sm_email_span"><table class="address"><tr><td colspan="2" class="address_border" >
                    <b>' . __('Email id', 'smart-manager') . ':</b> ' . $order->billing_email . '</td></tr>
                    <tr><td class="address_border"><b>' . __('Tel', 'smart-manager') . ' :</b> ' . $order->billing_phone . '</td></tr></table> </span></td></tr>';
            echo '</table>';
            echo '<div class="datagrid"><table><tr class="column1">
                    <td class="producthead">' . __('Product', 'smart-manager') . '</td><td>' . __('SKU', 'smart-manager') . '</td>
                    <td>' . __('Quantity', 'smart-manager') . '</td><td class="pricehead">' . __('Price', 'smart-manager') . '</td></tr>';
            foreach ($order->get_items() as $item) {
                $_product = $order->get_product_from_item($item);
                $sku = $variation = '';
                $sku = $_product->get_sku();
                $formatted_variation = woocommerce_get_formatted_variation($_product->variation_data, true);
                $variation = !empty($formatted_variation) ? ' (' . $formatted_variation . ')' : '';
                $item_total = $_product->get_price() * $item['item_meta']['_qty'][0];
                $total_order += $item_total;
                echo '<tr><td class="producthead">';
                echo $item['name'] . $variation;
                echo '</td><td>' . $sku . '</td><td>';
                echo $item['item_meta']['_qty'][0];
                echo '</td><td class="pricehead">';
                echo woocommerce_price($item_total);
                echo '</td></tr>';
            }
            echo '<tr><td colspan="2" rowspan="5" class="address_border" valign="top"><br/>
                    <i>' . ($order->customer_note != '' ? __('Order Notes', 'smart-manager') . ' : ' . $order->customer_note : '') . '</i></td><td style="text-align:right;" class="address_border" valign="top">
                    <b>Subtotal </b></td><td class="pricehead">' . $order->get_subtotal_to_display() . '</td></tr>';
            echo '<tr><td style="text-align:right;" class="address_border"><b>' . __('Shipping', 'smart-manager') . ' </b></td><td class="pricehead">' . $order->get_shipping_to_display() . '</td></tr>';
            if ($order->cart_discount > 0) {
                echo '<tr><td style="text-align:right;" class="address_border">' . __('Cart Discount', 'smart-manager') . '</td><td style="text-align:right;">';
                echo woocommerce_price($order->cart_discount);
                echo '</td></tr>';
            }
            if ($order->order_discount > 0) {
                echo '<tr><td style="text-align:right;" class="address_border"><b>' . __('Order Discount', 'smart-manager') . ' </b></td>';
                echo '<td class="pricehead">' . woocommerce_price($order->order_discount) . '</td></tr>';
            }
            echo '<tr><td style="text-align:right;" class="address_border"><b>' . __('Tax', 'smart-manager') . ' </b></td><td class="pricehead">' . woocommerce_price($order->get_total_tax()) . '</td></tr>';
            echo '<tr><td class="column1" style="text-align:right;"><b>' . __('Total', 'smart-manager') . ' </b></td><td class="column1" style="text-align:right;">' . woocommerce_price($order->order_total) . ' -via ' . $order->payment_method_title . '</td></tr>';
            echo '</table></div></div></div>';
        }
    }
    exit;
}
开发者ID:bulats,项目名称:chef,代码行数:101,代码来源:woo.php

示例4: array

    /**
     *  Get Orders to display in admin 
     *
     * @return $orders
     */
    function get_orders()
    {
        $user_id = get_current_user_id();
        $orders = array();
        $vendor_products = $this->get_vendor_products($user_id);
        $products = array();
        foreach ($vendor_products as $_product) {
            $products[] = $_product->ID;
        }
        $_orders = $this->get_orders_for_vendor_products($products);
        $model_id = 0;
        if (!empty($_orders)) {
            foreach ($_orders as $order) {
                $order = new WC_Order($order->order_id);
                $valid_items = WCV_Queries::get_products_for_order($order->id);
                $valid = array();
                $items = $order->get_items();
                foreach ($items as $key => $value) {
                    if (in_array($value['variation_id'], $valid_items) || in_array($value['product_id'], $valid_items)) {
                        $valid[] = $value;
                    }
                }
                $products = '';
                foreach ($valid as $key => $item) {
                    $item_meta = new WC_Order_Item_Meta($item['item_meta']);
                    // $item_meta = $item_meta->display( false, true );
                    $item_meta = $item_meta->get_formatted();
                    $products .= '<strong>' . $item['qty'] . ' x ' . $item['name'] . '</strong><br />';
                    foreach ($item_meta as $key => $meta) {
                        // Remove the sold by meta key for display
                        if (strtolower($key) != 'sold by') {
                            $products .= $meta['label'] . ' : ' . $meta['value'] . '<br />';
                        }
                    }
                }
                $shippers = (array) get_post_meta($order->id, 'wc_pv_shipped', true);
                $shipped = in_array($user_id, $shippers) ? 'Yes' : 'No';
                $sum = WCV_Queries::sum_for_orders(array($order->id), array('vendor_id' => get_current_user_id()));
                $total = $sum[0]->line_total;
                $comment_output = '';
                //  Need to fix how form is submitted for adding comments if at all possible.
                if ($this->can_view_comments) {
                    $order_notes = $order->get_customer_order_notes();
                    $comment_output .= '<a href="#TB_inline?width=600&height=550&inlineId=order-comment-window-' . $model_id . '" class="thickbox">';
                    $comment_output .= sprintf(__('Comments (%s)', 'wcvendors'), count($order_notes));
                    $comment_output .= '</a>';
                    $comment_output .= '<div id="order-comment-window-' . $model_id . '" style="display:none;">';
                    $comment_output .= '<h3>' . __('Comments to Customer', 'wcvendors') . '</h3>';
                    if (!empty($order_notes)) {
                        foreach ($order_notes as $order_note) {
                            $last_added = human_time_diff(strtotime($order_note->comment_date_gmt), current_time('timestamp', 1));
                            $comment_output .= '<p>';
                            $comment_output .= $order_note->comment_content;
                            $comment_output .= '<br />';
                            $comment_output .= sprintf(__('added %s ago', 'wcvendors'), $last_added);
                            $comment_output .= '<br />';
                            $comment_output .= '</p>';
                        }
                    } else {
                        $comment_output .= '<p>' . __('No comments currently to customer.', 'wcvendors') . '</p>';
                    }
                    if ($this->can_add_comments) {
                        $comment_output .= wp_nonce_field('add-comment');
                        $comment_output .= '
							<textarea name="comment_text" style="width:97%"></textarea>
							<input type="hidden" name="order_id" value="' . $order->id . '">
							<input type="hidden" name="action" value="add_comment">
							<input class="btn btn-large btn-block" type="submit" name="submit_comment" value="' . __('Add comment', 'wcvendors') . '">';
                    }
                    $comment_output .= '</div>';
                }
                $order_items = array();
                $order_items['order_id'] = $order->id;
                $order_items['customer'] = $order->get_formatted_shipping_address();
                $order_items['products'] = $products;
                $order_items['total'] = woocommerce_price($total);
                $order_items['date'] = date_i18n(wc_date_format(), strtotime($order->order_date));
                // $order_items[ 'comments' ]  = $comment_output;
                $order_items['status'] = $shipped;
                $orders[] = (object) $order_items;
                $model_id++;
            }
        }
        return $orders;
    }
开发者ID:oleggen,项目名称:wcvendors,代码行数:90,代码来源:class-vendor-admin-dashboard.php

示例5: isset

        $orderDate = isset($ourOrder->order_date) ? $ourOrder->order_date : '1';
        $items = $ourOrder->get_items();
        //$discounts      = isset($ourOrder->get_total_discount()) ? $ourOrder->get_total_discount() : '1';
        $authProfile = isset($ourOrder->wc_authorize_net_cim_customer_profile_id) ? $ourOrder->wc_authorize_net_cim_customer_profile_id : '1';
        /*
         * 	The below foreach will pull the items array apart and process each item, finding its SKU and adding them to a comma separated list.
         */
        foreach ($items as $item) {
            $id = '';
            $id = isset($item['item_meta']['_variation_id']) ? $item['item_meta']['_variation_id'][0] : $item['item_meta']['_product_id'][0];
            $item = new WC_Product($id);
            $skus[] = $item->get_sku();
        }
        var_dump($skus);
        $orderItems = implode($skus, ",");
        $params = array('order_Id' => $orderID->ID, 'user_id' => $customerUser, 'subscription_id' => $subscriptionID, 'name' => $first . " " . $last, 'date' => date('Y-m-d', strtotime($orderDate)), 'email' => $customerEmail, 'products' => $orderItems, 'order_total' => $orderTotal, 'auth_profile' => $authProfile, 'address' => $ourOrder->get_formatted_shipping_address());
        $wpdb->insert($wpdb->prefix . 'orders_archived', $params);
        /*
         * 	This is the scary part of the plugin. While active, the below few lines will delete the original orders from the many 
         *  tables found in both wordpress and woocommerce after saving the important information to the archived orders table.
         */
        //if ($_GET['delete']) {
        if ($_POST['delete']) {
            wp_delete_post($orderID->ID);
            $wpdb->delete($wpdb->prefix . 'woocommerce_order_items', array("order_item_id" => $orderID->ID));
            $wpdb->delete($wpdb->prefix . 'woocommerce_order_itemmeta', array("order_item_id" => $orderID->ID));
        }
    }
}
?>
开发者ID:CamanoIslandCoffeeRoasters,项目名称:woocommerce-order-archiver,代码行数:30,代码来源:dashboard.php

示例6: array

 /**
  *  Get Orders to display in admin 
  *
  * @return $orders
  */
 function get_orders()
 {
     $user_id = get_current_user_id();
     $orders = array();
     $vendor_products = $this->get_vendor_products($user_id);
     $products = array();
     foreach ($vendor_products as $_product) {
         $products[] = $_product->ID;
     }
     $_orders = $this->get_orders_for_vendor_products($products);
     $model_id = 0;
     if (!empty($_orders)) {
         foreach ($_orders as $order) {
             $order = new WC_Order($order->order_id);
             $valid_items = WCV_Queries::get_products_for_order($order->id);
             $valid = array();
             $items = $order->get_items();
             foreach ($items as $key => $item) {
                 if (in_array($item['variation_id'], $valid_items) || in_array($item['product_id'], $valid_items)) {
                     $valid[] = $item;
                 }
             }
             $products = '';
             foreach ($valid as $key => $item) {
                 $wc_product = new WC_Product($item['product_id']);
                 $products .= '<strong>' . $item['qty'] . ' x ' . $item['name'] . '</strong><br />';
                 if ($metadata = $order->has_meta($item['product_id'])) {
                     $products .= '<table cellspacing="0" class="wcv_display_meta">';
                     foreach ($metadata as $meta) {
                         // Skip hidden core fields
                         if (in_array($meta['meta_key'], apply_filters('woocommerce_hidden_order_itemmeta', array('_qty', '_tax_class', '_product_id', '_variation_id', '_line_subtotal', '_line_subtotal_tax', '_line_total', '_line_tax', WC_Vendors::$pv_options->get_option('sold_by_label'))))) {
                             continue;
                         }
                         // Skip serialised meta
                         if (is_serialized($meta['meta_value'])) {
                             continue;
                         }
                         // Get attribute data
                         if (taxonomy_exists(wc_sanitize_taxonomy_name($meta['meta_key']))) {
                             $term = get_term_by('slug', $meta['meta_value'], wc_sanitize_taxonomy_name($meta['meta_key']));
                             $meta['meta_key'] = wc_attribute_label(wc_sanitize_taxonomy_name($meta['meta_key']));
                             $meta['meta_value'] = isset($term->name) ? $term->name : $meta['meta_value'];
                         } else {
                             $meta['meta_key'] = apply_filters('woocommerce_attribute_label', wc_attribute_label($meta['meta_key'], $wc_product), $meta['meta_key']);
                         }
                         $products .= '<tr><th>' . wp_kses_post(rawurldecode($meta['meta_key'])) . ':</th><td>' . wp_kses_post(wpautop(make_clickable(rawurldecode($meta['meta_value'])))) . '</td></tr>';
                     }
                     $products .= '</table>';
                 }
             }
             $shippers = (array) get_post_meta($order->id, 'wc_pv_shipped', true);
             $shipped = in_array($user_id, $shippers) ? 'Yes' : 'No';
             $sum = WCV_Queries::sum_for_orders(array($order->id), array('vendor_id' => get_current_user_id()));
             $total = $sum[0]->line_total;
             $comment_output = '';
             //  Need to fix how form is submitted for adding comments if at all possible.
             // if ( $this->can_view_comments) {
             // 	$order_notes = $order->get_customer_order_notes();
             // 	$comment_output .= '<a href="#TB_inline?width=600&height=550&inlineId=order-comment-window-'.$model_id.'" class="thickbox">';
             // 	$comment_output .= sprintf( __( 'Comments (%s)', 'wcvendors' ), count( $order_notes ) );
             // 	$comment_output .= '</a>';
             // 	$comment_output .= '<div id="order-comment-window-'.$model_id.'" style="display:none;">';
             // 	$comment_output .= '<h3>'.__('Comments to Customer', 'wcvendors' ). '</h3>';
             // 	if ( !empty( $order_notes ) ) {
             // 		foreach ($order_notes as $order_note) {
             // 			$last_added = human_time_diff( strtotime( $order_note->comment_date_gmt ), current_time( 'timestamp', 1 ) );
             // 			$comment_output .= '<p>';
             // 			$comment_output .= $order_note->comment_content;
             // 			$comment_output .= '<br />';
             // 		    $comment_output .= sprintf(__( 'added %s ago', 'wcvendors' ), $last_added );
             // 			$comment_output .= '<br />';
             // 			$comment_output .= '</p>';
             // 		}
             // 	} else {
             // 		$comment_output .= '<p>'.__('No comments currently to customer.', 'wcvendors' ). '</p>';
             // 	}
             // 	if ( $this->can_add_comments ) {
             // 		$comment_output .=  wp_nonce_field( 'add-comment' );
             // 		$comment_output .= '
             // 			<textarea name="comment_text" style="width:97%"></textarea>
             // 			<input type="hidden" name="order_id" value="'. $order->id .'">
             // 			<input type="hidden" name="action" value="add_comment">
             // 			<input class="btn btn-large btn-block" type="submit" name="submit_comment" value="'.__( 'Add comment', 'wcvendors' ).'">';
             // 	}
             // 	$comment_output .= '</div>';
             // }
             $order_items = array();
             $order_items['order_id'] = $order->id;
             $order_items['customer'] = $order->get_formatted_shipping_address();
             $order_items['products'] = $products;
             $order_items['total'] = woocommerce_price($total);
             $order_items['date'] = date_i18n(wc_date_format(), strtotime($order->order_date));
             // $order_items[ 'comments' ]  = $comment_output;
             $order_items['status'] = $shipped;
             $orders[] = (object) $order_items;
//.........这里部分代码省略.........
开发者ID:stodorovic,项目名称:wcvendors,代码行数:101,代码来源:class-vendor-admin-dashboard.php

示例7: urlencode

            }
            // See if product needs shipping
            $product = new WC_Product($value['product_id']);
            $needs_shipping = !$product->needs_shipping() || $product->is_downloadable('yes') ? false : true;
        }
        $shippers = (array) get_post_meta($order->id, 'wc_pv_shipped', true);
        $shipped = in_array($user_id, $shippers);
        ?>

			<tr>
				<td><?php 
        echo $order->get_order_number();
        ?>
</td>
				<td><?php 
        echo apply_filters('wcvendors_dashboard_google_maps_link', '<a target="_blank" href="' . esc_url('http://maps.google.com/maps?&q=' . urlencode(esc_html(preg_replace('#<br\\s*/?>#i', ', ', $order->get_formatted_shipping_address()))) . '&z=16') . '">' . esc_html(preg_replace('#<br\\s*/?>#i', ', ', $order->get_formatted_shipping_address())) . '</a>');
        ?>
</td>
				<td><?php 
        $sum = WCV_Queries::sum_for_orders(array($order->id), array('vendor_id' => get_current_user_id()));
        $total = $sum[0]->line_total;
        $totals += $total;
        echo woocommerce_price($total);
        ?>
</td>
				<td><?php 
        echo $order->order_date;
        ?>
</td>
				<td>
				<a href="#" class="view-items" id="<?php 
开发者ID:soydiegomen,项目名称:plazajilo,代码行数:31,代码来源:orders.php

示例8: array

 function get_orders()
 {
     $user_id = get_current_user_id();
     $orders = array();
     $vendor_products = WCV_Queries::get_commission_products($user_id);
     $products = array();
     foreach ($vendor_products as $_product) {
         $products[] = $_product->ID;
     }
     $_orders = WCV_Queries::get_orders_for_products($products);
     if (!empty($_orders)) {
         foreach ($_orders as $order) {
             $order = new WC_Order($order->order_id);
             $valid_items = WCV_Queries::get_products_for_order($order->id);
             $valid = array();
             $items = $order->get_items();
             foreach ($items as $key => $value) {
                 if (in_array($value['variation_id'], $valid_items) || in_array($value['product_id'], $valid_items)) {
                     $valid[] = $value;
                 }
             }
             $products = '';
             foreach ($valid as $key => $item) {
                 $item_meta = new WC_Order_Item_Meta($item['item_meta']);
                 // $item_meta = $item_meta->display( false, true );
                 $item_meta = $item_meta->get_formatted();
                 $products .= '<strong>' . $item['qty'] . ' x ' . $item['name'] . '</strong><br />';
                 foreach ($item_meta as $key => $meta) {
                     // Remove the sold by meta key for display
                     if (strtolower($key) != 'sold by') {
                         $products .= $meta['label'] . ' : ' . $meta['value'] . '<br />';
                     }
                 }
             }
             $shippers = (array) get_post_meta($order->id, 'wc_pv_shipped', true);
             $shipped = in_array($user_id, $shippers) ? 'Yes' : 'No';
             $sum = WCV_Queries::sum_for_orders(array($order->id), array('vendor_id' => get_current_user_id()));
             $total = $sum[0]->line_total;
             $order_items = array();
             $order_items['order_id'] = $order->id;
             $order_items['customer'] = $order->get_formatted_shipping_address();
             $order_items['products'] = $products;
             $order_items['total'] = woocommerce_price($total);
             $order_items['date'] = date_i18n(wc_date_format(), strtotime($order->order_date));
             $order_items['status'] = $shipped;
             $orders[] = (object) $order_items;
         }
     }
     return $orders;
 }
开发者ID:soydiegomen,项目名称:plazajilo,代码行数:50,代码来源:class-vendor-admin-dashboard.php

示例9: custom_columns

        /**
         * 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>';
//.........这里部分代码省略.........
开发者ID:chhavinav,项目名称:fr.ilovejuice,代码行数:101,代码来源:class-wc-admin-cpt-shop_order.php

示例10: woocommerce_custom_order_columns

function woocommerce_custom_order_columns($column)
{
    global $post, $woocommerce;
    $order = new WC_Order($post->ID);
    switch ($column) {
        case "order_status":
            echo sprintf('<mark class="%s">%s</mark>', sanitize_title($order->status), __($order->status, 'woocommerce'));
            break;
        case "order_title":
            if ($order->user_id) {
                $user_info = get_userdata($order->user_id);
            }
            if (isset($user_info) && $user_info) {
                $user = '<a href="user-edit.php?user_id=' . esc_attr($user_info->ID) . '">';
                if ($user_info->first_name || $user_info->last_name) {
                    $user .= $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=' . $post->ID . '&action=edit') . '"><strong>' . sprintf(__('Order #%s', 'woocommerce'), $post->ID) . '</strong></a> ' . __('made by', 'woocommerce') . ' ' . $user;
            if ($order->billing_email) {
                echo '<small class="meta">' . __('Email:', 'woocommerce') . ' ' . '<a href="' . esc_url('mailto:' . $order->billing_email) . '">' . esc_html($order->billing_email) . '</a></small>';
            }
            if ($order->billing_phone) {
                echo '<small class="meta">' . __('Tel:', 'woocommerce') . ' ' . esc_html($order->billing_phone) . '</small>';
            }
            break;
        case "billing_address":
            if ($order->get_formatted_billing_address()) {
                echo '<a target="_blank" href="' . esc_url('http://maps.google.com/maps?&q=' . urlencode($order->get_billing_address()) . '&z=16') . '">' . preg_replace('#<br\\s*/?>#i', ', ', $order->get_formatted_billing_address()) . '</a>';
            } else {
                echo '&ndash;';
            }
            if ($order->payment_method_title) {
                echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($order->payment_method_title) . '</small>';
            }
            break;
        case "shipping_address":
            if ($order->get_formatted_shipping_address()) {
                echo '<a target="_blank" href="' . esc_url('http://maps.google.com/maps?&q=' . urlencode($order->get_shipping_address()) . '&z=16') . '">' . preg_replace('#<br\\s*/?>#i', ', ', $order->get_formatted_shipping_address()) . '</a>';
            } else {
                echo '&ndash;';
            }
            if ($order->shipping_method_title) {
                echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($order->shipping_method_title) . '</small>';
            }
            break;
        case "total_cost":
            echo woocommerce_price($order->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);
                $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="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post) . '</abbr>';
            break;
        case "order_actions":
            ?>
<p>
				<?php 
            if (in_array($order->status, array('pending', 'on-hold'))) {
                ?>
<a class="button" href="<?php 
                echo wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce-mark-order-processing&order_id=' . $post->ID), 'woocommerce-mark-order-processing');
                ?>
"><?php 
                _e('Processing', 'woocommerce');
                ?>
</a><?php 
            }
            ?>
				<?php 
            if (in_array($order->status, array('pending', 'on-hold', 'processing'))) {
                ?>
<a class="button" href="<?php 
                echo wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce-mark-order-complete&order_id=' . $post->ID), 'woocommerce-mark-order-complete');
                ?>
"><?php 
                _e('Complete', 'woocommerce');
                ?>
</a><?php 
            }
            ?>
				<a class="button" href="<?php 
            echo admin_url('post.php?post=' . $post->ID . '&action=edit');
            ?>
"><?php 
//.........这里部分代码省略.........
开发者ID:rosslavery,项目名称:woocommerce,代码行数:101,代码来源:shop_order.php

示例11: order_delivery

 public function order_delivery($order_id = 0)
 {
     if (!$order_id || !$this->settings['pickup_location'] || !$this->settings['pickup_name'] || !$this->settings['pickup_phone']) {
         return false;
     }
     // Get order object
     $order = new WC_Order($order_id);
     if (!$order) {
         return false;
     }
     // Get customer user ID
     $user = $order->get_user();
     if (!$user) {
         return false;
     }
     $delivery_address = str_replace('<br/>', ', ', $order->get_formatted_shipping_address());
     if (!$delivery_address) {
         return false;
     }
     if (!$order->billing_phone) {
         return false;
     }
     $delivery_address_data = $this->get_address_data($delivery_address);
     $args = array('pickup_address' => (string) $this->settings['pickup_location'], 'pickup_contact_name' => (string) $this->settings['pickup_name'], 'pickup_contact_phone' => (string) $this->settings['pickup_phone'], 'customer_identifier' => (string) $user->user_login, 'dropoff_contact_name' => (string) $user->display_name, 'dropoff_contact_phone' => (string) $order->billing_phone, 'dropoff_address' => (string) $delivery_address_data['address'], 'dropoff_coordinates' => (string) $delivery_address_data['location']);
     if ($this->settings['pickup_coords']) {
         $args['pickup_coordinates'] = (string) $this->settings['pickup_coords'];
     }
     if ($this->settings['pickup_remarks']) {
         $args['pickup_remarks'] = (string) $this->settings['pickup_remarks'];
     }
     if ($this->settings['city']) {
         $args['city'] = (string) $this->settings['city'];
     }
     $delivery_notes = $order->customer_note;
     if ($delivery_notes) {
         $args['dropoff_remarks'] = (string) $this->settings['delivery_notes'];
     }
     $delivery = $this->api('deliveries', $args, 'post');
     if ($delivery && isset($delivery->id)) {
         update_post_meta($order_id, '_wumdrop_delivery_id', $delivery->id);
         if (isset($delivery->distance_estimate)) {
             update_post_meta($order_id, '_wumdrop_distance_estimate', $delivery->distance_estimate);
         }
         if (isset($delivery->time_estimate)) {
             update_post_meta($order_id, '_wumdrop_time_estimate', $delivery->time_estimate);
         }
         if (isset($delivery->message)) {
             update_post_meta($order_id, '_wumdrop_delivery_message', $delivery->message);
         }
         if (isset($delivery->time_estimate)) {
             update_post_meta($order_id, '_wumdrop_delivery_price', $delivery->price);
         }
         $order_note = __('WumDrop delivery order placed.', 'woocommerce-wumdrop');
         if ('completed' != $order->get_status()) {
             $order->update_status('completed', $order_note);
         } else {
             $order->add_order_note($order_note);
         }
         return true;
     }
     return false;
 }
开发者ID:WumDrop,项目名称:WumDrop-for-WooCommerce,代码行数:62,代码来源:class-wc-wumdrop.php

示例12: woocommerce_order_data_meta_box


//.........这里部分代码省略.........
    $users = new WP_User_Query(array('orderby' => 'display_name'));
    $users = $users->get_results();
    if ($users) {
        foreach ($users as $user) {
            echo '<option value="' . $user->ID . '" ';
            selected($customer_user, $user->ID);
            echo '>' . $user->display_name . ' (' . $user->user_email . ')</option>';
        }
    }
    ?>
				</select></p>
				
				<p class="form-field form-field-wide"><label for="excerpt"><?php 
    _e('Customer Note:', 'woocommerce');
    ?>
</label>
				<textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt" placeholder="<?php 
    _e('Customer\'s notes about the order', 'woocommerce');
    ?>
"><?php 
    echo $post->post_excerpt;
    ?>
</textarea></p>
			
			</div>
			<div class="order_data_right">
				<div class="order_data">
					<h2><?php 
    _e('Billing Details', 'woocommerce');
    ?>
 <a class="edit_address" href="#">(<?php 
    _e('Edit', 'woocommerce');
    ?>
)</a></h2>
					<?php 
    $billing_data = apply_filters('woocommerce_admin_billing_fields', array('first_name' => array('label' => __('First Name', 'woocommerce'), 'show' => false), 'last_name' => array('label' => __('Last Name', 'woocommerce'), 'show' => false), 'company' => array('label' => __('Company', 'woocommerce'), 'show' => false), 'address_1' => array('label' => __('Address 1', 'woocommerce'), 'show' => false), 'address_2' => array('label' => __('Address 2', 'woocommerce'), 'show' => false), 'city' => array('label' => __('City', 'woocommerce'), 'show' => false), 'postcode' => array('label' => __('Postcode', 'woocommerce'), 'show' => false), 'country' => array('label' => __('Country', 'woocommerce'), 'show' => false), 'state' => array('label' => __('State/County', 'woocommerce'), 'show' => false), 'email' => array('label' => __('Email', 'woocommerce')), 'phone' => array('label' => __('Phone', 'woocommerce'))));
    // Display values
    echo '<div class="address">';
    if ($order->get_formatted_billing_address()) {
        echo '<p><strong>' . __('Address', 'woocommerce') . ':</strong><br/> ' . $order->get_formatted_billing_address() . '</p>';
    } else {
        echo '<p class="none_set"><strong>' . __('Address', 'woocommerce') . ':</strong> ' . __('No billing address set.', 'woocommerce') . '</p>';
    }
    foreach ($billing_data as $key => $field) {
        if (isset($field['show']) && !$field['show']) {
            continue;
        }
        $field_name = 'billing_' . $key;
        echo '<p><strong>' . $field['label'] . ':</strong> ' . $order->{$field_name} . '</p>';
    }
    echo '</div>';
    // Display form
    echo '<div class="edit_address"><p><button class="button load_customer_billing">' . __('Load customer billing address', 'woocommerce') . '</button></p>';
    foreach ($billing_data as $key => $field) {
        woocommerce_wp_text_input(array('id' => '_billing_' . $key, 'label' => $field['label']));
    }
    echo '</div>';
    ?>
				</div>
				<div class="order_data order_data_alt">
					
					<h2><?php 
    _e('Shipping Details', 'woocommerce');
    ?>
 <a class="edit_address" href="#">(<?php 
    _e('Edit', 'woocommerce');
    ?>
)</a></h2>
					<?php 
    $shipping_data = apply_filters('woocommerce_admin_shipping_fields', array('first_name' => array('label' => __('First Name', 'woocommerce'), 'show' => false), 'last_name' => array('label' => __('Last Name', 'woocommerce'), 'show' => false), 'company' => array('label' => __('Company', 'woocommerce'), 'show' => false), 'address_1' => array('label' => __('Address 1', 'woocommerce'), 'show' => false), 'address_2' => array('label' => __('Address 2', 'woocommerce'), 'show' => false), 'city' => array('label' => __('City', 'woocommerce'), 'show' => false), 'postcode' => array('label' => __('Postcode', 'woocommerce'), 'show' => false), 'country' => array('label' => __('Country', 'woocommerce'), 'show' => false), 'state' => array('label' => __('State/County', 'woocommerce'), 'show' => false)));
    // Display values
    echo '<div class="address">';
    if ($order->get_formatted_shipping_address()) {
        echo '<p><strong>' . __('Address', 'woocommerce') . ':</strong><br/> ' . $order->get_formatted_shipping_address() . '</p>';
    } else {
        echo '<p class="none_set"><strong>' . __('Address', 'woocommerce') . ':</strong> ' . __('No shipping address set.', 'woocommerce') . '</p>';
    }
    foreach ($shipping_data as $key => $field) {
        if (isset($field['show']) && !$field['show']) {
            continue;
        }
        $field_name = 'shipping_' . $key;
        echo '<p><strong>' . $field['label'] . ':</strong> ' . $order->{$field_name} . '</p>';
    }
    echo '</div>';
    // Display form
    echo '<div class="edit_address"><p><button class="button load_customer_shipping">' . __('Load customer shipping address', 'woocommerce') . '</button></p>';
    foreach ($shipping_data as $key => $field) {
        woocommerce_wp_text_input(array('id' => '_shipping_' . $key, 'label' => $field['label']));
    }
    echo '</div>';
    ?>
				</div>
			</div>
			<div class="clear"></div>

		</div>
	</div>
	<?php 
}
开发者ID:bidhanbaral,项目名称:fotodep_store,代码行数:101,代码来源:writepanel-order_data.php

示例13: array

 /**
  *  Get current vendor orders
  *
  * @return array
  */
 function wcmp_get_vendor_orders()
 {
     global $WCMp;
     $user_id = get_current_user_id();
     $vendor = get_wcmp_vendor($user_id);
     $orders = array();
     $vendor_orders_array = $vendor->get_orders();
     if (!$vendor_orders_array) {
         $vendor_orders_array = array();
     }
     $_orders = array_unique($vendor_orders_array);
     if (!empty($_orders)) {
         foreach ($_orders as $order_id) {
             $order = new WC_Order($order_id);
             $valid_items = $vendor->get_vendor_items_from_order($order->id, $vendor->term_id);
             $products = '';
             foreach ($valid_items as $key => $item) {
                 $item_meta = new WC_Order_Item_Meta($item['item_meta']);
                 // $item_meta = $item_meta->display( false, true );
                 $item_meta = $item_meta->get_formatted();
                 $products .= '<strong>' . $item['qty'] . ' x ' . $item['name'] . '</strong><br />';
                 foreach ($item_meta as $key => $meta) {
                     // Remove the sold by meta key for display
                     if (strtolower($key) != 'sold by') {
                         if ($meta['label'] == 'flat_shipping_per_item') {
                             $products .= __('Flat Shipping Charges', $WCMp->text_domain) . ' : ' . $meta['value'] . '<br />';
                         } else {
                             $products .= $meta['label'] . ' : ' . $meta['value'] . '<br />';
                         }
                     }
                 }
             }
             $shippers = (array) get_post_meta($order->id, 'dc_pv_shipped', true);
             $shipped = in_array($user_id, $shippers) ? 'Yes' : 'No';
             if ($order->id && $vendor->term_id) {
                 $commission_total = 0;
                 $commissions = false;
                 $args = array('post_type' => 'dc_commission', 'post_status' => array('publish', 'private'), 'posts_per_page' => -1, 'meta_query' => array(array('key' => '_commission_vendor', 'value' => absint($vendor->term_id), 'compare' => '='), array('key' => '_commission_order_id', 'value' => absint($order->id), 'compare' => '=')));
                 $commissions = get_posts($args);
                 if (!empty($commissions)) {
                     foreach ($commissions as $commission) {
                         $commission_total = $commission_total + (double) get_post_meta($commission->ID, '_commission_amount', true) + (double) get_post_meta($commission->ID, '_shipping', true) + (double) get_post_meta($commission->ID, '_tax', true);
                     }
                 }
             }
             $extra_checkout_fields_for_brazil_active_datas = '';
             if (WC_Dependencies_Product_Vendor::woocommerce_extra_checkout_fields_for_brazil_active_check()) {
                 $settings = get_option('wcbcf_settings');
                 if (0 != $settings['person_type']) {
                     // Person type information.
                     if (1 == $order->billing_persontype && 1 == $settings['person_type'] || 2 == $settings['person_type']) {
                         $extra_checkout_fields_for_brazil_active_datas .= '<strong>' . __('CPF', $WCMp->text_domain) . ': </strong>' . esc_html($order->billing_cpf) . '<br />';
                         if (isset($settings['rg'])) {
                             $extra_checkout_fields_for_brazil_active_datas .= '<strong>' . __('RG', $WCMp->text_domain) . ': </strong>' . esc_html($order->billing_rg) . '<br />';
                         }
                     }
                     if (2 == $order->billing_persontype && 1 == $settings['person_type'] || 3 == $settings['person_type']) {
                         $extra_checkout_fields_for_brazil_active_datas .= '<strong>' . __('Company Name', $WCMp->text_domain) . ': </strong>' . esc_html($order->billing_company) . '<br />';
                         $extra_checkout_fields_for_brazil_active_datas .= '<strong>' . __('CNPJ', $WCMp->text_domain) . ': </strong>' . esc_html($order->billing_cnpj) . '<br />';
                         if (isset($settings['ie'])) {
                             $extra_checkout_fields_for_brazil_active_datas .= '<strong>' . __('State Registration', $WCMp->text_domain) . ': </strong>' . esc_html($order->billing_ie) . '<br />';
                         }
                     }
                 } else {
                     $extra_checkout_fields_for_brazil_active_datas .= '<strong>' . __('Company', $WCMp->text_domain) . ': </strong>' . esc_html($order->billing_company) . '<br />';
                 }
                 if (isset($settings['birthdate_sex'])) {
                     // Birthdate information.
                     $extra_checkout_fields_for_brazil_active_datas .= '<strong>' . __('Birthdate', $WCMp->text_domain) . ': </strong>' . esc_html($order->billing_birthdate) . '<br />';
                     // Sex Information.
                     $extra_checkout_fields_for_brazil_active_datas .= '<strong>' . __('Sex', $WCMp->text_domain) . ': </strong>' . esc_html($order->billing_sex) . '<br />';
                 }
                 $extra_checkout_fields_for_brazil_active_datas .= '<strong>' . __('Phone', $WCMp->text_domain) . ': </strong>' . esc_html($order->billing_phone) . '<br />';
                 // Cell Phone Information.
                 if (!empty($order->billing_cellphone)) {
                     $extra_checkout_fields_for_brazil_active_datas .= '<strong>' . __('Cell Phone', $WCMp->text_domain) . ': </strong>' . esc_html($order->billing_cellphone) . '<br />';
                 }
             }
             $customer_user_name = get_post_meta($order->id, '_shipping_first_name', true) . ' ' . get_post_meta($order->id, '_shipping_last_name', true);
             $order_items = array();
             $order_items['order_id'] = $order->id;
             $order_items['customer'] = $customer_user_name . '<br>' . apply_filters('wcmp_dashboard_google_maps_link', '<a target="_blank" href="' . esc_url('http://maps.google.com/maps?&q=' . urlencode(esc_html(preg_replace('#<br\\s*/?>#i', ', ', $order->get_formatted_shipping_address()))) . '&z=16') . '">' . esc_html(preg_replace('#<br\\s*/?>#i', ', ', $order->get_formatted_shipping_address())) . '</a><br />' . $extra_checkout_fields_for_brazil_active_datas);
             $order_items['products'] = $products;
             $order_items['total'] = woocommerce_price($commission_total);
             $order_items['date'] = date_i18n(wc_date_format(), strtotime($order->order_date));
             $order_items['status'] = $shipped;
             $orders[] = (object) $order_items;
         }
     }
     return $orders;
 }
开发者ID:qhuit,项目名称:UrbanPekor,代码行数:96,代码来源:class-wcmp-vendor-order-page.php

示例14: array

 /**
  * notify_new_order
  *
  * Send notification when new order is received
  *
  * @access public
  * @return void
  */
 function notify_new_order($order_id)
 {
     global $woocommerce;
     $order = new WC_Order($order_id);
     // Send notifications if order total is greater than $0
     // Or if free order notification is enabled
     if (0 < absint($order->order_total) || $this->notify_free_order) {
         $order_items = "";
         $exclude = array("type", "item_meta", "tax_class", "product_id", "variation_id", "line_subtotal", "line_tax", "line_subtotal_tax");
         $replace = array("name" => "Товар", "qty" => "Количество", "line_total" => "На сумму", "pa_base" => "Основа", "pa_size" => "Размер", "pa_color" => "Цвет");
         foreach ($order->get_items() as $item_id => $id) {
             foreach ($id as $key => $value) {
                 if (!in_array($key, $exclude)) {
                     $order_items .= strtr($key, $replace) . ": " . urldecode($value) . "\r\n";
                 }
             }
             $order_items .= "\r\n";
         }
         $title = sprintf(__('Заказ %d', 'wc_xmpp'), $order_id);
         $message = $order->get_formatted_shipping_address() . "\r\n" . $order_items . "Общая сумма: " . $order->order_total . $this->xmpp_get_currency_symbol();
         $url = get_admin_url();
         $this->send_notification($title, $message, $url);
         $this->add_log(__('Order items', 'wc_xmpp') . "\n" . print_r($order, true));
     }
 }
开发者ID:JamesonBR,项目名称:xmpp-for-woocommerce,代码行数:33,代码来源:class-wc-xmpp.php

示例15: 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


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