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


PHP wc_get_order_statuses函数代码示例

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


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


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