コード例 #1
0
 /**
  * Display orders in customer account
  * @param integer $customer_id
  * @return string
  */
 function display_orders_in_account($customer_id = '')
 {
     $output = '';
     $customer_id = !empty($customer_id) ? $customer_id : get_current_user_id();
     $from_admin = !empty($customer_id) ? true : false;
     $wps_orders_mdl = new wps_orders_mdl();
     $orders = $wps_orders_mdl->get_customer_orders($customer_id);
     // Display orders
     ob_start();
     require_once wpshop_tools::get_template_part(WPS_ORDERS_DIR, $this->template_dir, "frontend", "orders_list_in_account");
     $output = ob_get_contents();
     ob_end_clean();
     return $output;
 }
コード例 #2
0
<?php

/**	Get customer orders list for statistic displaying	*/
$wps_orders_mdl = new wps_orders_mdl();
$orders = $wps_orders_mdl->get_customer_orders($current_user_id_in_list);
$color_label = array('awaiting_payment' => 'jaune', 'canceled' => 'rouge', 'partially_paid' => 'orange', 'incorrect_amount' => 'orange', 'denied' => 'rouge', 'shipped' => 'bleu', 'payment_refused' => 'rouge', 'completed' => 'vert', 'refunded' => 'rouge');
if (!empty($orders)) {
    $currency = wpshop_tools::wpshop_get_currency(false);
    $orders_status = unserialize(WPSHOP_ORDER_STATUS);
    $customer_order_total_amount = $customer_order_real_total_amount = 0;
    $order_statuses = array();
    $ordered_products = array();
    foreach ($orders as $order) {
        $order_meta = get_post_meta($order->ID, '_order_postmeta', true);
        if (empty($order_statuses[$order_meta['order_status']])) {
            $order_statuses[$order_meta['order_status']] = 1;
        } else {
            $order_statuses[$order_meta['order_status']] += 1;
        }
        $customer_order_total_amount += $order_meta['order_grand_total'];
        if ('completed' == $order_meta['order_status']) {
            $customer_order_real_total_amount += $order_meta['order_grand_total'];
        }
        if (!empty($order_meta) && !empty($order_meta['order_items'])) {
            foreach ($order_meta['order_items'] as $order_item) {
                $ordered_products[$order_item['item_id']] = $order_item['item_name'];
            }
        }
    }
    $order_list = '  ';
    foreach ($order_statuses as $order_status => $nb_of_order_with_status) {