• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wc_get_order_statuses函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wc_get_order_statuses函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_get_order_statuses函数的具体用法?PHP wc_get_order_statuses怎么用?PHP wc_get_order_statuses使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: change_order_status

 /**
  * Update a order status
  *
  * @return void
  */
 function change_order_status()
 {
     check_ajax_referer('dokan_change_status');
     $order_id = intval($_POST['order_id']);
     $order_status = $_POST['order_status'];
     $order = new WC_Order($order_id);
     $order->update_status($order_status);
     $statuses = wc_get_order_statuses();
     $status_label = isset($statuses[$order_status]) ? $statuses[$order_status] : $order_status;
     $status_class = dokan_get_order_status_class($order_status);
     echo '<label class="dokan-label dokan-label-' . $status_class . '">' . $status_label . '</label>';
     exit;
 }
开发者ID:nuwe1,项目名称:dokan-lite,代码行数:18,代码来源:ajax.php


示例2: get_settings

 /**
  * Get settings array
  *
  * @return array
  */
 public function get_settings()
 {
     global $woocommerce, $wp_roles;
     $statuses = wc_crm_get_statuses_slug();
     $settings = array();
     $filters = array('name' => __('Filters', 'wc_crm'), 'desc_tip' => 'Choose which filters you would like to display on the Customers page.', 'id' => 'wc_crm_filters', 'class' => 'chosen_select', 'type' => 'multiselect', 'options' => array('user_roles' => __('User Roles', 'wc_crm'), 'last_order' => __('Last Order', 'wc_crm'), 'state' => __('State', 'wc_crm'), 'city' => __('City', 'wc_crm'), 'country' => __('Country', 'wc_crm'), 'customer_name' => __('Customer Name', 'wc_crm'), 'products' => __('Products', 'wc_crm'), 'products_variations' => __('Products Variations', 'wc_crm'), 'order_status' => __('Order Status', 'wc_crm'), 'customer_status' => __('Customer Status', 'wc_crm'), 'products_categories' => __('Product Categories', 'wc_crm')), 'defa');
     if (class_exists('WC_Brands_Admin')) {
         $filters['options']['products_brands'] = __('Product Brands', 'wc_crm');
     }
     $settings[] = array('title' => __('General Options', 'woocommerce'), 'type' => 'title', 'desc' => '', 'id' => 'general_crm_options');
     $settings[] = array('name' => __('Username', 'wc_crm'), 'desc_tip' => __('Choose what the username is when customers are added.', 'wc_crm'), 'id' => 'wc_crm_username_add_customer', 'type' => 'select', 'class' => 'wc-enhanced-select', 'options' => array(1 => __('First & last name e.g. johnsmith', 'wc_crm'), 2 => __('Hyphen separated e.g. john-smith', 'wc_crm'), 3 => __('Email address', 'wc_crm')), 'autoload' => true);
     $settings[] = $filters;
     $settings[] = array('name' => __('Value', 'wc_crm'), 'desc_tip' => __('Choose which statuses the customer orders must be before appearing in the Value column.', 'wc_crm'), 'id' => 'wc_crm_total_value', 'class' => 'chosen_select', 'type' => 'multiselect', 'options' => wc_get_order_statuses());
     $settings[] = array('title' => __('Automatic Emails', 'wc_crm'), 'desc' => __('Check this box to send an email with username and password when creating a new customer.', 'wc_crm'), 'id' => 'wc_crm_automatic_emails_new_customer', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'start');
     if (class_exists('WC_Subscriptions')) {
         $settings[] = array('title' => __('Subscribers', 'wc_crm'), 'desc' => __('Check this box to show column indicating whether customer is an active subscriber.', 'wc_crm'), 'id' => 'wc_crm_show_subscribers_column', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'start');
     }
     if (class_exists('Groups_WordPress') && class_exists('Groups_WS')) {
         $settings[] = array('title' => __('Groups Integration', 'wc_crm'), 'desc' => __('Check this box to show column indicating which group is the customer a member of.', 'wc_crm'), 'id' => 'wc_crm_show_groups_wc_column', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'start');
     }
     $settings[] = array('type' => 'sectionend', 'id' => 'general_crm_options');
     $settings[] = array('title' => __('Fetch Customers', 'wc_crm'), 'type' => 'title', 'desc' => __('The following options affects how the customers in the customers table should be fetched.', 'wc_crm'), 'id' => 'crm_fetch_customers');
     $settings[] = array('name' => __('User Roles', 'wc_crm'), 'desc_tip' => 'Choose which User Roles of the customers/users that will be shown in the customers table.', 'id' => 'wc_crm_user_roles', 'type' => 'multiselect', 'class' => 'chosen_select', 'options' => $wp_roles->role_names);
     $settings[] = array('title' => __('Guest Customers', 'woocommerce'), 'desc' => 'Select whether Guest customers appear on the customers table.', 'id' => 'wc_crm_guest_customers', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'start');
     $settings[] = array('name' => __('Customer Name Format', 'wc_crm'), 'desc_tip' => __('Choose the format of the names displayed on the Customers page.', 'wc_crm'), 'id' => 'wc_crm_customer_name', 'type' => 'select', 'class' => 'wc-enhanced-select', 'default' => 'fl', 'options' => array('fl' => __('First Last', 'wc_crm'), 'lf' => __('Last, First', 'wc_crm')));
     $settings[] = array('type' => 'sectionend', 'id' => 'crm_fetch_customers');
     $settings[] = array('title' => __('Default Status', 'wc_crm'), 'type' => 'title', 'desc' => __('The following options determine the default status for the customers when added to this site.', 'wc_crm'), 'id' => 'crm_default_customer_status');
     $settings[] = array('name' => __('Manually Added', 'wc_crm'), 'desc_tip' => __('Added manually via this plugin.', 'wc_crm'), 'id' => 'wc_crm_default_status_crm', 'type' => 'select', 'class' => 'wc-enhanced-select', 'default' => 'Lead', 'options' => $statuses);
     $settings[] = array('name' => __('Purchased Customers', 'wc_crm'), 'desc_tip' => __('Added automatically via purchases made.', 'wc_crm'), 'id' => 'wc_crm_default_status_store', 'type' => 'select', 'class' => 'wc-enhanced-select', 'default' => 'Customer', 'options' => $statuses);
     $settings[] = array('name' => __('Registration Page', 'wc_crm'), 'desc_tip' => __('Added via the account registration page.', 'wc_crm'), 'id' => 'wc_crm_default_status_account', 'type' => 'select', 'class' => 'wc-enhanced-select', 'default' => 'Prospect', 'options' => $statuses);
     $settings[] = array('type' => 'sectionend', 'id' => 'crm_default_customer_status');
     return apply_filters('woocommerce_customer_relationship_general_settings_fields', $settings);
 }
开发者ID:daanbakker1995,项目名称:vanteun,代码行数:38,代码来源:wc-crm-settings-general.php


示例3: wc_get_order_status_name

/**
 * Get the nice name for an order status
 *
 * @since  2.2
 * @param  string $status
 * @return string
 */
function wc_get_order_status_name($status)
{
    $statuses = wc_get_order_statuses();
    $status = 'wc-' === substr($status, 0, 3) ? substr($status, 3) : $status;
    $status = isset($statuses['wc-' . $status]) ? $statuses['wc-' . $status] : $status;
    return $status;
}
开发者ID:amusiiko,项目名称:armo,代码行数:14,代码来源:wc-order-functions.php


示例4: init_form_fields

 function init_form_fields()
 {
     global $woocommerce;
     require_once $woocommerce->plugin_path() . '/includes/wc-order-functions.php';
     $this->form_fields = array('enabled' => array('title' => 'Habilitar/Deshabilitar', 'type' => 'checkbox', 'label' => 'Habilitar modulo de pago TodoPago', 'default' => 'no'), 'title' => array('title' => 'Título', 'type' => 'text', 'description' => 'Título que el usuario ve durante el checkout', 'default' => 'TodoPago'), 'description' => array('title' => 'Descripción', 'type' => 'textarea', 'description' => 'Descripción que el usuario ve durante el checkout', 'default' => 'Paga de manera segura mediante TodoPago<br>Solo para la república argentina'), 'ambiente' => array('title' => 'Ambiente', 'type' => 'select', 'description' => 'Seleccione el ambiente con el que desea trabajar', 'options' => array('test' => 'developers', 'prod' => 'produccion')), 'tipo_segmento' => array('title' => 'Tipo de Segmento', 'type' => 'select', 'description' => 'Seleccione el tipo de segmento con el que desea trabajar', 'options' => array('retail' => 'Retail')), 'deadline' => array('title' => 'Deadline', 'type' => 'text', 'description' => 'Dias maximos para la entrega'), 'titulo_testing' => array('title' => 'Ambiente de Developers', 'type' => 'title', 'description' => 'Datos correspondientes al ambiente de developers', 'id' => 'testing_options'), 'http_header_test' => array('title' => 'HTTP Header', 'type' => 'text', 'description' => 'Header en formato JSON. Ejemplo: <br>
                       {"Authorization":"PRISMA 912EC803B2CE49E4A541068D12345678"}'), 'security_test' => array('title' => 'Security', 'type' => 'text', 'description' => 'Código provisto por Todo Pago'), 'merchant_id_test' => array('title' => 'Merchant ID', 'type' => 'text', 'description' => 'Nombre de comercio provisto por Todo Pago'), 'titulo_produccion' => array('title' => 'Ambiente de Producción', 'type' => 'title', 'description' => 'Datos correspondientes al ambiente de producción', 'id' => 'produccion_options'), 'http_header_prod' => array('title' => 'HTTP Header', 'type' => 'text', 'description' => 'Header en formato JSON. Ejemplo: <br>
                       {"Authorization":"PRISMA 912EC803B2CE49E4A541068D12345678"}'), 'security_prod' => array('title' => 'Security', 'type' => 'text', 'description' => 'Código provisto por Todo Pago'), 'merchant_id_prod' => array('title' => 'Merchant ID', 'type' => 'text', 'description' => 'Nombre de comercio provisto por Todo Pago'), 'titulo_estados_pedidos' => array('title' => 'Estados del Pedido', 'type' => 'title', 'description' => 'Datos correspondientes al estado de los pedidos', 'id' => 'estados_pedido_options'), 'estado_inicio' => array('title' => 'Estado cuando la transacción ha<br>sido iniciada', 'type' => 'select', 'options' => wc_get_order_statuses(), 'default' => 'wc-pending', 'description' => 'Valor por defecto: Pendiente de pago'), 'estado_aprobacion' => array('title' => 'Estado cuando la transacción ha<br>sido aprobada', 'type' => 'select', 'options' => wc_get_order_statuses(), 'default' => 'wc-completed', 'description' => 'Valor por defecto: Completado'), 'estado_rechazo' => array('title' => 'Estado cuando la transacción ha<br>sido rechazada', 'type' => 'select', 'options' => wc_get_order_statuses(), 'default' => 'wc-failed', 'description' => 'Valor por defecto: Falló'), 'estado_offline' => array('title' => 'Estado cuando la transacción ha<br>sido offline', 'type' => 'select', 'options' => wc_get_order_statuses()));
 }
开发者ID:guillermoluced,项目名称:Plugin-WooCommerce,代码行数:8,代码来源:index.php


示例5: test_wc_orders_count

 /**
  * Test wc_orders_count().
  * @since 2.4
  */
 public function test_wc_orders_count()
 {
     foreach (wc_get_order_statuses() as $status) {
         $this->assertEquals(0, wc_orders_count($status));
     }
     // Invalid status returns 0
     $this->assertEquals(0, wc_orders_count('unkown-status'));
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:12,代码来源:functions.php


示例6: orders_dashboard_model

 public function orders_dashboard_model($dashboard_model)
 {
     // $dashboard_model[$this->dashboard_key]['tables']['posts']['where']['post_status'] = array('wc-pending', 'wc-processing', 'wc-on-hold', 'wc-completed', 'wc-cancelled', 'wc-refunded', 'wc-failed');
     $dashboard_model[$this->dashboard_key]['tables']['posts']['where']['post_type'] = 'shop_order';
     $post_type_col_index = sm_multidimesional_array_search('posts_post_status', 'index', $dashboard_model[$this->dashboard_key]['columns']);
     $dashboard_model[$this->dashboard_key]['columns'][$post_type_col_index]['values'] = wc_get_order_statuses();
     return $dashboard_model;
 }
开发者ID:JaneJieYing,项目名称:kiddoonline_dvlpment,代码行数:8,代码来源:class-smart-manager-shop-order.php


示例7: dokan_order_show_suborders

/**
 * Show sub-orders on a parent order if available
 *
 * @param WC_Order $parent_order
 * @return void
 */
function dokan_order_show_suborders($parent_order)
{
    $sub_orders = get_children(array('post_parent' => $parent_order->id, 'post_type' => 'shop_order', 'post_status' => array('wc-pending', 'wc-completed', 'wc-processing', 'wc-on-hold')));
    if (!$sub_orders) {
        return;
    }
    $statuses = wc_get_order_statuses();
    dokan_get_template_part('sub-orders', '', array('sub_orders' => $sub_orders, 'statuses' => $statuses));
}
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:15,代码来源:wc-template.php


示例8: get_order_statuses

 /**
  * get_order_statuses.
  */
 function get_order_statuses()
 {
     $result = array();
     $statuses = function_exists('wc_get_order_statuses') ? wc_get_order_statuses() : array();
     foreach ($statuses as $status => $status_name) {
         $result[substr($status, 3)] = $statuses[$status];
     }
     return $result;
 }
开发者ID:ltdat287,项目名称:id.nhomdichvu,代码行数:12,代码来源:class-wc-gateway-wcj-custom.php


示例9: handle_status_change

 /**
  * @param $order_id
  * @param $old_status
  * @param $new_status
  *
  * @return bool|void
  */
 public function handle_status_change($order_id, $old_status, $new_status)
 {
     $statuses = wc_get_order_statuses();
     // if we don't get a wc-prefixed status.
     $status = 'wc-' === substr($new_status, 0, 3) ? substr($new_status, 3) : $new_status;
     if (isset($statuses['wc-' . $status]) && 'wc-' . $status === $this->settings->onstatus) {
         return $this->process_items($order_id);
     }
     return false;
 }
开发者ID:BooXtream,项目名称:BooXtream-WooCommerce,代码行数:17,代码来源:class-wc-booxtream-order.php


示例10: get_order_status

 /**
  * Returns the order status key for the $status given.
  * Order status keys have changed in WC 2.2 and this is provided to make
  * it easier to handle.
  * 
  * @param string $status key, one of 'pending', 'failed', 'on-hold', 'processing', 'completed', 'refunded', 'cancelled'
  * @return string status key for current WC
  */
 public static function get_order_status($status)
 {
     $result = $status;
     if (function_exists('wc_get_order_statuses')) {
         // only from WC 2.2
         if (in_array('wc-' . $status, array_keys(wc_get_order_statuses()))) {
             $result = 'wc-' . $status;
         }
     }
     return $result;
 }
开发者ID:arobbins,项目名称:spellestate,代码行数:19,代码来源:class-groups-ws-helper.php


示例11: wc_onc_get_settings

 /**
  * Get all the settings for this plugin for @see woocommerce_admin_fields() function.
  *
  * @return array Array of settings for @see woocommerce_admin_fields() function.
  */
 public static function wc_onc_get_settings()
 {
     $wc_onc_settings = array();
     $wc_onc_order_statuses = wc_get_order_statuses();
     $wc_onc_settings[] = array('name' => __('Order Note Colors', 'colored-order-notes-for-woocommerce'), 'type' => 'title', 'desc' => 'Here you can specify the bacground color for order note based on order status', 'id' => 'wc_settings_order_note_colors');
     /* This loop will provide color setting option for all default + custom order status */
     foreach ($wc_onc_order_statuses as $wc_onc_order_status) {
         $wc_onc_order_status_id = strtolower("onc_" . str_replace(' ', '_', $wc_onc_order_status));
         $wc_onc_settings[] = array('name' => __($wc_onc_order_status, 'colored-order-notes-for-woocommerce'), 'type' => 'color', 'id' => $wc_onc_order_status_id);
     }
     $wc_onc_settings[] = array('type' => 'sectionend', 'id' => 'wc_settings_order_note_colors_end');
     return apply_filters('wc_settings_tab_order_note_color_settings', $wc_onc_settings);
 }
开发者ID:ItsMePN,项目名称:colored-order-notes-for-woocommerce,代码行数:18,代码来源:woocommerce-colored-order-notes.php


示例12: wc_create_order

/**
 * Create a new order programmatically.
 *
 * Returns a new order object on success which can then be used to add additional data.
 *
 * @param  array $args
 *
 * @return WC_Order|WP_Error WC_Order on success, WP_Error on failure.
 */
function wc_create_order($args = array())
{
    $default_args = array('status' => '', 'customer_id' => null, 'customer_note' => null, 'order_id' => 0, 'created_via' => '', 'cart_hash' => '', 'parent' => 0);
    $args = wp_parse_args($args, $default_args);
    $order_data = array();
    if ($args['order_id'] > 0) {
        $updating = true;
        $order_data['ID'] = $args['order_id'];
    } else {
        $updating = false;
        $order_data['post_type'] = 'shop_order';
        $order_data['post_status'] = 'wc-' . apply_filters('woocommerce_default_order_status', 'pending');
        $order_data['ping_status'] = 'closed';
        $order_data['post_author'] = 1;
        $order_data['post_password'] = uniqid('order_');
        $order_data['post_title'] = sprintf(__('Order &ndash; %s', 'woocommerce'), strftime(_x('%b %d, %Y @ %I:%M %p', 'Order date parsed by strftime', 'woocommerce')));
        $order_data['post_parent'] = absint($args['parent']);
    }
    if ($args['status']) {
        if (!in_array('wc-' . $args['status'], array_keys(wc_get_order_statuses()))) {
            return new WP_Error('woocommerce_invalid_order_status', __('Invalid order status', 'woocommerce'));
        }
        $order_data['post_status'] = 'wc-' . $args['status'];
    }
    if (!is_null($args['customer_note'])) {
        $order_data['post_excerpt'] = $args['customer_note'];
    }
    if ($updating) {
        $order_id = wp_update_post($order_data);
    } else {
        $order_id = wp_insert_post(apply_filters('woocommerce_new_order_data', $order_data), true);
    }
    if (is_wp_error($order_id)) {
        return $order_id;
    }
    if (!$updating) {
        update_post_meta($order_id, '_order_key', 'wc_' . apply_filters('woocommerce_generate_order_key', uniqid('order_')));
        update_post_meta($order_id, '_order_currency', get_woocommerce_currency());
        update_post_meta($order_id, '_prices_include_tax', get_option('woocommerce_prices_include_tax'));
        update_post_meta($order_id, '_customer_ip_address', WC_Geolocation::get_ip_address());
        update_post_meta($order_id, '_customer_user_agent', isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '');
        update_post_meta($order_id, '_customer_user', 0);
        update_post_meta($order_id, '_created_via', sanitize_text_field($args['created_via']));
        update_post_meta($order_id, '_cart_hash', sanitize_text_field($args['cart_hash']));
    }
    if (is_numeric($args['customer_id'])) {
        update_post_meta($order_id, '_customer_user', $args['customer_id']);
    }
    update_post_meta($order_id, '_order_version', WC_VERSION);
    return wc_get_order($order_id);
}
开发者ID:AndyA,项目名称:River,代码行数:60,代码来源:wc-core-functions.php


示例13: column_default

 /**
  * column_default function.
  *
  * @param WP_User $user
  * @param string $column_name
  * @return string
  */
 public function column_default($user, $column_name)
 {
     global $wpdb;
     if ('orders' == $column_name) {
         if (!($count = get_user_meta($user->ID, '_order_count', true))) {
             global $wpdb;
             $count = $wpdb->get_var("SELECT COUNT(*)\r\n\t\t\t\t\tFROM {$wpdb->posts} as posts\r\n\r\n\t\t\t\t\tLEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id\r\n\r\n\t\t\t\t\tWHERE   meta.meta_key       = '_customer_user'\r\n\t\t\t\t\tAND     posts.post_type     IN ('" . implode("','", wc_get_order_types('order-count')) . "')\r\n\t\t\t\t\tAND     posts.post_status   IN ('" . implode("','", array_keys(wc_get_order_statuses())) . "')\r\n\t\t\t\t\tAND     posts.post_parent   = 0\r\n\t\t\t\t\tAND     meta_value          = {$user->ID}\r\n\t\t\t\t");
             update_user_meta($user->ID, '_order_count', absint($count));
         }
         $result = absint($count);
     } else {
         $result = parent::column_default($user, $column_name);
     }
     return $result;
 }
开发者ID:shwetadubey,项目名称:upfit,代码行数:22,代码来源:class.yith-report-customer-list.php


示例14: get_order_statuses_id_to_name

 public function get_order_statuses_id_to_name()
 {
     $result = array();
     if (function_exists('wc_get_order_statuses')) {
         $result['version'] = 2.2;
         //[slug] => name
         $result['statuses'] = wc_get_order_statuses();
     } else {
         $args = array('hide_empty' => false, 'fields' => 'id=>name');
         $result['version'] = 2.1;
         //[id] => name
         $result['statuses'] = get_terms('shop_order_status', $args);
     }
     return $result;
 }
开发者ID:baden03,项目名称:access48,代码行数:15,代码来源:WCAM_Notifier.php


示例15: mark_order_status

 /**
  * Mark an order with a status
  *
  * TODO: Remove once 2.2 compatibility is dropped {@link https://github.com/woothemes/woocommerce/pull/6791}
  *
  * @since 1.0.0
  */
 public static function mark_order_status()
 {
     if (!current_user_can('edit_shop_orders')) {
         wp_die(__('You do not have sufficient permissions to access this page.', WC_Order_Status_Manager::TEXT_DOMAIN), '', array('response' => 403));
     }
     if (!check_admin_referer('wc-order-status-manager-mark-order-status')) {
         wp_die(__('You have taken too long. Please go back and retry.', WC_Order_Status_Manager::TEXT_DOMAIN), '', array('response' => 403));
     }
     $status = isset($_GET['status']) ? esc_attr($_GET['status']) : '';
     $order_statuses = wc_get_order_statuses();
     if (!$status || !isset($order_statuses['wc-' . $status])) {
         die;
     }
     $order_id = isset($_GET['order_id']) && (int) $_GET['order_id'] ? (int) $_GET['order_id'] : '';
     if (!$order_id) {
         die;
     }
     $order = wc_get_order($order_id);
     $order->update_status($status);
     wp_safe_redirect(wp_get_referer() ? wp_get_referer() : admin_url('edit.php?post_type=shop_order'));
     die;
 }
开发者ID:seoduda,项目名称:Patua,代码行数:29,代码来源:class-wc-order-status-manager-ajax.php


示例16: column_default

    /**
     * column_default function.
     *
     * @param mixed  $user
     * @param string $column_name
     * @return int|string
     * @todo Inconsistent return types, and void return at the end. Needs a rewrite.
     */
    function column_default($user, $column_name)
    {
        global $wpdb;
        switch ($column_name) {
            case 'customer_name':
                if ($user->last_name && $user->first_name) {
                    return $user->last_name . ', ' . $user->first_name;
                } else {
                    return '-';
                }
            case 'username':
                return $user->user_login;
                break;
            case 'location':
                $state_code = get_user_meta($user->ID, 'billing_state', true);
                $country_code = get_user_meta($user->ID, 'billing_country', true);
                $state = isset(WC()->countries->states[$country_code][$state_code]) ? WC()->countries->states[$country_code][$state_code] : $state_code;
                $country = isset(WC()->countries->countries[$country_code]) ? WC()->countries->countries[$country_code] : $country_code;
                $value = '';
                if ($state) {
                    $value .= $state . ', ';
                }
                $value .= $country;
                if ($value) {
                    return $value;
                } else {
                    return '-';
                }
                break;
            case 'email':
                return '<a href="mailto:' . $user->user_email . '">' . $user->user_email . '</a>';
            case 'spent':
                if (!($spent = get_user_meta($user->ID, '_money_spent', true))) {
                    $spent = $wpdb->get_var("SELECT SUM(meta2.meta_value)\n\t\t\t\t\t\tFROM {$wpdb->posts} as posts\n\n\t\t\t\t\t\tLEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id\n\t\t\t\t\t\tLEFT JOIN {$wpdb->postmeta} AS meta2 ON posts.ID = meta2.post_id\n\n\t\t\t\t\t\tWHERE   meta.meta_key       = '_customer_user'\n\t\t\t\t\t\tAND     meta.meta_value     = {$user->ID}\n\t\t\t\t\t\tAND     posts.post_type     IN ('" . implode("','", wc_get_order_types('reports')) . "')\n\t\t\t\t\t\tAND     posts.post_status   = 'wc-completed'\n\t\t\t\t\t\tAND     meta2.meta_key      = '_order_total'\n\t\t\t\t\t");
                    update_user_meta($user->ID, '_money_spent', $spent);
                }
                return wc_price($spent);
                break;
            case 'orders':
                if (!($count = get_user_meta($user->ID, '_order_count', true))) {
                    $count = $wpdb->get_var("SELECT COUNT(*)\n\t\t\t\t\t\tFROM {$wpdb->posts} as posts\n\n\t\t\t\t\t\tLEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id\n\n\t\t\t\t\t\tWHERE   meta.meta_key       = '_customer_user'\n\t\t\t\t\t\tAND     posts.post_type     IN ('" . implode("','", wc_get_order_types('order-count')) . "')\n\t\t\t\t\t\tAND     posts.post_status   = 'wc-completed'\n\t\t\t\t\t\tAND     meta_value          = {$user->ID}\n\t\t\t\t\t");
                    update_user_meta($user->ID, '_order_count', $count);
                }
                return absint($count);
                break;
            case 'last_order':
                $order_ids = get_posts(array('posts_per_page' => 1, 'post_type' => 'shop_order', 'orderby' => 'date', 'order' => 'desc', 'post_status' => array_keys(wc_get_order_statuses()), 'meta_query' => array(array('key' => '_customer_user', 'value' => $user->ID)), 'fields' => 'ids'));
                if ($order_ids) {
                    $order = wc_get_order($order_ids[0]);
                    echo '<a href="' . admin_url('post.php?post=' . $order->id . '&action=edit') . '">' . $order->get_order_number() . '</a> &ndash; ' . date_i18n(get_option('date_format'), strtotime($order->order_date));
                } else {
                    echo '-';
                }
                break;
            case 'user_actions':
                ?>
<p>
					<?php 
                do_action('woocommerce_admin_user_actions_start', $user);
                $actions = array();
                $actions['edit'] = array('url' => admin_url('user-edit.php?user_id=' . $user->ID), 'name' => __('Edit', 'woocommerce'), 'action' => "edit");
                $actions['view'] = array('url' => admin_url('edit.php?post_type=shop_order&_customer_user=' . $user->ID), 'name' => __('View orders', 'woocommerce'), 'action' => "view");
                $order_ids = get_posts(array('posts_per_page' => 1, 'post_type' => wc_get_order_types(), 'post_status' => array_keys(wc_get_order_statuses()), 'meta_query' => array(array('key' => '_customer_user', 'value' => array(0, ''), 'compare' => 'IN'), array('key' => '_billing_email', 'value' => $user->user_email)), 'fields' => 'ids'));
                if ($order_ids) {
                    $actions['link'] = array('url' => wp_nonce_url(add_query_arg('link_orders', $user->ID), 'link_orders'), 'name' => __('Link previous orders', 'woocommerce'), 'action' => "link");
                }
                $actions = apply_filters('woocommerce_admin_user_actions', $actions, $user);
                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_user_actions_end', $user);
                ?>
				</p><?php 
                break;
        }
    }
开发者ID:donpapa26,项目名称:bakancslistad,代码行数:84,代码来源:class-wc-report-customer-list.php


示例17: output

    /**
     * Output the metabox
     */
    public static function output($post)
    {
        global $theorder;
        if (!is_object($theorder)) {
            $theorder = wc_get_order($post->ID);
        }
        $order = $theorder;
        self::init_address_fields();
        if (WC()->payment_gateways()) {
            $payment_gateways = WC()->payment_gateways->payment_gateways();
        } else {
            $payment_gateways = array();
        }
        $payment_method = !empty($order->payment_method) ? $order->payment_method : '';
        wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
        ?>
		<style type="text/css">
			#post-body-content, #titlediv { display:none }
		</style>
		<div class="panel-wrap woocommerce">
			<input name="post_title" type="hidden" value="<?php 
        echo empty($post->post_title) ? 'Order' : esc_attr($post->post_title);
        ?>
" />
			<input name="post_status" type="hidden" value="<?php 
        echo esc_attr($post->post_status);
        ?>
" />
			<div id="order_data" class="panel">

				<h2><?php 
        printf(__('Order #%s Details', 'woocommerce'), esc_html($order->get_order_number()));
        ?>
</h2>
				<p class="order_number"><?php 
        if ($payment_method) {
            printf(__('Payment via %s', 'woocommerce'), isset($payment_gateways[$payment_method]) ? esc_html($payment_gateways[$payment_method]->get_title()) : esc_html($payment_method));
            if ($transaction_id = $order->get_transaction_id()) {
                if (isset($payment_gateways[$payment_method]) && ($url = $payment_gateways[$payment_method]->get_transaction_url($order))) {
                    echo ' (<a href="' . esc_url($url) . '" target="_blank">' . esc_html($transaction_id) . '</a>)';
                } else {
                    echo ' (' . esc_html($transaction_id) . ')';
                }
            }
            echo '. ';
        }
        if ($ip_address = get_post_meta($post->ID, '_customer_ip_address', true)) {
            echo __('Customer IP', 'woocommerce') . ': ' . esc_html($ip_address);
        }
        ?>
</p>

				<div class="order_data_column_container">
					<div class="order_data_column">
						<h4><?php 
        _e('General Details', 'woocommerce');
        ?>
</h4>

						<p class="form-field form-field-wide"><label for="order_date"><?php 
        _e('Order date:', 'woocommerce');
        ?>
</label>
							<input type="text" class="date-picker" name="order_date" id="order_date" maxlength="10" value="<?php 
        echo date_i18n('Y-m-d', strtotime($post->post_date));
        ?>
" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />@<input type="text" class="hour" placeholder="<?php 
        _e('h', 'woocommerce');
        ?>
" name="order_date_hour" id="order_date_hour" maxlength="2" size="2" value="<?php 
        echo date_i18n('H', strtotime($post->post_date));
        ?>
" pattern="\-?\d+(\.\d{0,})?" />:<input type="text" class="minute" placeholder="<?php 
        _e('m', 'woocommerce');
        ?>
" name="order_date_minute" id="order_date_minute" maxlength="2" size="2" value="<?php 
        echo date_i18n('i', strtotime($post->post_date));
        ?>
" pattern="\-?\d+(\.\d{0,})?" />
						</p>

						<p class="form-field form-field-wide"><label for="order_status"><?php 
        _e('Order status:', 'woocommerce');
        ?>
</label>
						<select id="order_status" name="order_status" class="wc-enhanced-select">
							<?php 
        $statuses = wc_get_order_statuses();
        foreach ($statuses as $status => $status_name) {
            echo '<option value="' . esc_attr($status) . '" ' . selected($status, 'wc-' . $order->get_status(), false) . '>' . esc_html($status_name) . '</option>';
        }
        ?>
						</select></p>

						<p class="form-field form-field-wide wc-customer-user">
							<label for="customer_user"><?php 
        _e('Customer:', 'woocommerce');
//.........这里部分代码省略.........
开发者ID:abcode619,项目名称:wpstuff,代码行数:101,代码来源:class-wc-meta-box-order-data.php


示例18: get_order_statuses

 /**
  * Get order statuses.
  *
  * @return array
  */
 protected function get_order_statuses()
 {
     $order_statuses = array();
     foreach (array_keys(wc_get_order_statuses()) as $status) {
         $order_statuses[] = str_replace('wc-', '', $status);
     }
     return $order_statuses;
 }
开发者ID:coderkevin,项目名称:woocommerce,代码行数:13,代码来源:class-wc-rest-orders-controller.php


示例19: wc_get_customer_order_count

/**
 * Get total orders by customer.
 * @param  int $user_id
 * @return int
 */
function wc_get_customer_order_count($user_id)
{
    if (!($count = get_user_meta($user_id, '_order_count', true))) {
        global $wpdb;
        $count = $wpdb->get_var("SELECT COUNT(*)\n\t\t\tFROM {$wpdb->posts} as posts\n\n\t\t\tLEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id\n\n\t\t\tWHERE   meta.meta_key       = '_customer_user'\n\t\t\tAND     posts.post_type     IN ('" . implode("','", wc_get_order_types('order-count')) . "')\n\t\t\tAND     posts.post_status   IN ('" . implode("','", array_keys(wc_get_order_statuses())) . "')\n\t\t\tAND     meta_value          = {$user_id}\n\t\t");
        update_user_meta($user_id, '_order_count', absint($count));
    }
    return absint($count);
}
开发者ID:robbenz,项目名称:plugs,代码行数:14,代码来源:wc-user-functions.php


示例20: get_posts

<?php

/**
 * My Orders
 *
 * Shows recent orders on the account page
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     2.2.0
 */
if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
$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' => wc_get_order_types('view-orders'), 'post_status' => array_keys(wc_get_order_statuses()))));
if ($customer_orders) {
    ?>

	<h2><?php 
    echo apply_filters('woocommerce_my_account_my_orders_title', __('Recent Quote Requests', 'woocommerce'));
    ?>
</h2>

	<table class="shop_table shop_table_responsive my_account_orders">

		<thead>
			<tr>
				<th class="order-number"><span class="nobr"><?php 
    _e('Order', 'woocommerce');
    ?>
开发者ID:GolgoSoft,项目名称:KeenerWP,代码行数:31,代码来源:my-orders.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wc_get_order_types函数代码示例发布时间:2022-05-23
下一篇:
PHP wc_get_order_status_name函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap