public function shortcodehandler($attrs)
 {
     $vars = shortcode_atts(array('id' => null, 'price' => 'regular_price', 'role' => 'current'), $attrs, 'wc_rbp');
     if ($vars['id'] == null) {
         global $product;
         if (!isset($product->id)) {
             return __('Invalid Product ID Given', WC_RBP_TXT);
         }
         $vars['id'] = $product->id;
     }
     if ($vars['role'] == null) {
         return __('Invalid User Role Given', WC_RBP_TXT);
     }
     if ($vars['price'] == 'product_regular_price' || $vars['price'] == 'product_selling_price') {
         return self::get_base_product_price($vars['id'], $vars['price']);
     }
     if ($vars['price'] != 'regular_price' && $vars['price'] != 'selling_price') {
         return __('Invalid Price Type Given', WC_RBP_TXT);
     }
     $product_status = self::get_status($vars['id']);
     if ($product_status) {
         if ($vars['role'] == 'current') {
             $vars['role'] = WC_RBP()->current_role();
         }
         $price = self::get_db_price($vars['id']);
         return self::get_selprice($vars['role'], $vars['price']);
     }
     return '';
 }
 public function get_selectbox_user_role()
 {
     $user_roles = WC_RBP()->get_registered_roles();
     $list_roles = '';
     $roles = array_keys($user_roles);
     foreach ($roles as $role) {
         $list_roles[$role] = $user_roles[$role]['name'];
     }
     return $list_roles;
 }
 public function wc_rbp_importer_function($post_id, $data, $import_options)
 {
     //$product = get_product( $post_id);
     $roles = array_keys(WC_RBP()->get_allowed_roles());
     $enable = $data['_enable_role_based_price'];
     $prices = array();
     foreach ($roles as $role) {
         $prices[$role] = '';
         $prices[$role]['regular_price'] = $data[$role . '_regular_price'];
         $prices[$role]['selling_price'] = $data[$role . '_selling_price'];
     }
     if (!empty($enable)) {
         update_post_meta($post_id, '_enable_role_based_price', 'true');
     } else {
         update_post_meta($post_id, '_enable_role_based_price', 'false');
     }
     update_post_meta($post_id, '_role_based_price', $prices);
 }
 public function wc_rbp_importer_function($post_id, $data, $import_options)
 {
     ///$product = get_product( $post_id);
     $allowed_currency = get_option(rbp_key . 'acs_allowed_currencies');
     $roles = array_keys(WC_RBP()->get_allowed_roles());
     $enable = $data['_enable_role_based_price'];
     $prices = array();
     $regular_price = WC_RBP()->get_allowed_price('regular');
     $selling_price = WC_RBP()->get_allowed_price('sale');
     foreach ($roles as $role) {
         foreach ($allowed_currency as $currency) {
             if ($regular_price) {
                 $prices[$role][$currency]['regular_price'] = $data['aelia_wcrbp_' . $currency . '_regular_price_' . $role . '_field'];
             }
             if ($selling_price) {
                 $prices[$role][$currency]['selling_price'] = $data['aelia_wcrbp_' . $currency . '_selling_price_' . $role . '_field'];
             }
         }
     }
     update_post_meta($post_id, '_acs_role_based_price', $prices);
 }
Beispiel #5
0
 /**
  * Adds Form In WC Product Edit Page
  * @since 0.1
  * @filter_use woocommerce_product_data_panels 
  */
 public function price_form()
 {
     global $post_id;
     $regular_price = WC_RBP()->get_allowed_price('regular');
     $selling_price = WC_RBP()->get_allowed_price('sale');
     WC_RBP()->sp_function()->get_db_price($post_id);
     $status = '';
     $display = 'hidden';
     if ($this->status == true) {
         $status = 'checked';
         $display = '';
     }
     echo '<div class="panel woocommerce_options_panel" id="role_based_simple_product_container" style="display: none;">';
     echo '<div class="options_group">
             <p class="form-field ">
                 <label class="enable_text">' . __('Enable Role Based Pricing', lang_dom) . '</label>
                 <label class="wc_rbp_switch wc_rbp_switch-green">
                     <input type="checkbox" class="switch-input" id="enable_simple_role_based_price" 
                         data-target="simple_role_based_price_field_container" 
                         name="enable_simple_role_based_price" data-type="simple" ' . $status . '>
                     <span class="switch-label" data-on="' . __('on', lang_dom) . '" data-off="' . __('off', lang_dom) . '"></span>
                     <span class="switch-handle"></span>
                 </label>
             </p>
          </div> 
         <div id="simple_role_based_price_field_container" class="' . $display . '">';
     foreach (WC_RBP()->get_allowed_roles() as $key => $val) {
         $name = WC_RBP()->get_mod_name($key);
         echo '<div class="options_group ' . $key . '_role_price" id="' . $key . '_role_price">';
         echo '<h3>' . __($name, lang_dom) . '</h3>';
         if ($regular_price) {
             woocommerce_wp_text_input(array('id' => 'simple_regular_price_' . $key, 'name' => 'simple_role_based_price[' . $key . '][regular_price]', 'label' => __('Regular Price', lang_dom), 'desc_tip' => 'false', 'value' => WC_RBP()->sp_function()->get_selprice($key, 'regular_price')));
         }
         if ($selling_price) {
             woocommerce_wp_text_input(array('id' => 'simple_selling_price_' . $key, 'name' => 'simple_role_based_price[' . $key . '][selling_price]', 'label' => __('Selling Price', lang_dom), 'desc_tip' => 'false', 'value' => WC_RBP()->sp_function()->get_selprice($key, 'selling_price')));
         }
         echo '</div>';
     }
     echo '</div></div>';
 }
 /**
  * Adds Form In WC Product Edit Page
  * @since 0.1
  * @filter_use woocommerce_product_data_panels 
  */
 public function price_form($loop, $vdata, $varition)
 {
     $regular_price = WC_RBP()->get_allowed_price('regular');
     $selling_price = WC_RBP()->get_allowed_price('sale');
     $this->status = WC_RBP()->sp_function()->get_status($varition->ID);
     WC_RBP()->sp_function()->get_db_price($varition->ID);
     $status = '';
     $display = 'hidden';
     if ($this->status == true) {
         $status = 'checked';
         $display = '';
     }
     echo '<div class="options_group">
             <p class="form-field ">
                 <label class="enable_text">' . __('Enable Role Based Pricing', lang_dom) . '</label>
                 <label class="wc_rbp_switch wc_rbp_switch-green">
                     <input type="checkbox" class="switch-input enable_variable_role_based_price" id="enable_variable_role_based_price_product_' . $varition->ID . '" 
                         data-target="variable_role_based_price_field_container_' . $varition->ID . '" 
                         name="enable_variable_role_based_price_product_' . $varition->ID . '" data-type="variable" ' . $status . '>
                     <span class="switch-label" data-on="' . __('On', lang_dom) . '" data-off="' . __('off', lang_dom) . '"></span>
                     <span class="switch-handle"></span>
                 </label>
             </p>
          </div> 
         <div id="variable_role_based_price_field_container_' . $varition->ID . '" class=" ' . $display . ' variable_roles">';
     foreach (WC_RBP()->get_allowed_roles() as $key => $val) {
         $name = WC_RBP()->get_mod_name($key);
         echo '<div class="variable_pricing ' . $key . '_role_price" id="' . $key . '_role_price">';
         echo '<h3>' . __($name, lang_dom) . '</h3>';
         if ($regular_price) {
             woocommerce_wp_text_input(array('id' => 'variable_regular_price_' . $key, 'name' => '   variable_role_based_price_product_' . $varition->ID . '[' . $key . '][regular_price]', 'label' => __('Regular Price', lang_dom), 'desc_tip' => 'false', 'value' => WC_RBP()->sp_function()->get_selprice($key, 'regular_price'), 'wrapper_class' => 'form-row-first form-row'));
         }
         if ($selling_price) {
             woocommerce_wp_text_input(array('id' => 'variable_selling_price_' . $key, 'name' => 'variable_role_based_price_product_' . $varition->ID . '[' . $key . '][selling_price]', 'label' => __('Selling Price', lang_dom), 'desc_tip' => 'false', 'value' => WC_RBP()->sp_function()->get_selprice($key, 'selling_price'), 'wrapper_class' => 'form-row-last form-row'));
         }
         echo '</div>';
     }
     echo '</div> ';
 }
<?php

$width = "width:50% !important;";
global $settings;
$settings[] = array('name' => __('Custom Name For User Roles', lang_dom), 'type' => 'title', 'desc' => '', 'id' => rbp_key . 'user_role_edit_start');
foreach (WC_RBP()->get_allowed_roles() as $role => $name) {
    $settings[] = array('name' => __($name['name'], lang_dom), 'desc' => '', 'id' => rbp_key . 'role_name[' . $role . ']', 'type' => 'text', 'class' => '', 'css' => 'width:25% !important;');
}
$settings[] = array('type' => 'sectionend', 'id' => rbp_key . 'user_role_edit_end');
<?php

$width = "width:50% !important;";
global $settings;
$WC_RBP_product_types = array('simple' => __('Simple Product', lang_dom), 'variable' => __('Variable Product', lang_dom));
$settings = array(array('name' => '', 'type' => 'title', 'desc' => '', 'id' => rbp_key . 'price_views_start'), array('name' => __('Hide Price For', lang_dom), 'desc' => __('Use to hide product price for selected roles', lang_dom), 'id' => rbp_key . 'hide_price_role', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => $width, 'options' => WC_RBP()->admin()->get_selectbox_user_role()), array('name' => __('Hide Add To Cart Button For', lang_dom), 'desc' => __('Use to hide product add to cart button link for selected roles', lang_dom), 'id' => rbp_key . 'hide_cart_button_role', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => $width, 'options' => WC_RBP()->admin()->get_selectbox_user_role()), array('name' => __('Message For Price', lang_dom), 'desc' => __('use <code>[curr]</code> to replace the currency symbol', lang_dom), 'id' => rbp_key . 'replace_currency_symbol', 'type' => 'textarea', 'class' => '', 'css' => $width, 'options' => WC_RBP()->admin()->get_selectbox_user_role()), array('type' => 'sectionend', 'id' => 'price_views_end'));
<?php

$width = "width:50% !important;";
global $settings;
$settings = array(array('name' => '', 'type' => 'title', 'desc' => '', 'id' => rbp_key . 'general_start'), array('name' => __('Allowed User Roles', lang_dom), 'desc' => __('User Roles To List In Product Edit Page', lang_dom), 'id' => rbp_key . 'list_roles', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => $width, 'options' => WC_RBP()->admin()->get_selectbox_user_role()), array('name' => __('Allowed Product Pricing', lang_dom), 'desc' => __('Price Fields To List In Product Edit Page', lang_dom), 'id' => rbp_key . 'allowed_price', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => $width, 'options' => array('regular' => __('Regular Price', lang_dom), 'sale' => __('Sale Price', lang_dom))), array('type' => 'sectionend', 'id' => 'general_start'));
 /**
  * Adds Form In WC Product Edit Page
  * @since 0.1
  * @filter_use woocommerce_product_data_panels 
  */
 public function simple_price_form($post_id, $type = "simple")
 {
     global $user_role_key, $name, $regular_price, $selling_price, $wc_rbp_thepostid, $wc_rbp_enable_status;
     $wc_rbp_thepostid = $post_id;
     $regular_price = WC_RBP()->get_allowed_price('regular');
     $selling_price = WC_RBP()->get_allowed_price('sale');
     WC_RBP()->sp_function()->get_db_price($post_id);
     $this->status = WC_RBP()->sp_function()->get_status($post_id);
     $wc_rbp_enable_status = '';
     $display = 'hidden';
     if ($this->status == true) {
         $wc_rbp_enable_status = 'checked';
         $display = '';
     }
     include WC_RBP_ADMIN_PATH . 'includes/views/popup_rbform_header.php';
     include WC_RBP_ADMIN_PATH . 'includes/views/popup_rbform_tab.php';
     foreach (WC_RBP()->get_allowed_roles() as $user_role_key => $val) {
         $name = WC_RBP()->get_mod_name($user_role_key);
         include WC_RBP_ADMIN_PATH . 'includes/views/popup_rbform_content.php';
     }
     if ($type == 'simple') {
         include WC_RBP_ADMIN_PATH . 'includes/views/popup_rbform_footer.php';
     }
 }
<?php

$width = "width:50% !important;";
global $settings;
$WC_RBP_product_types = array('simple' => __('Simple Product', WC_RBP_TXT), 'variable' => __('Variable Product', WC_RBP_TXT));
$settings = array(array('name' => '', 'type' => 'title', 'desc' => '', 'id' => rbp_key . 'price_views_start'), array('name' => __('Hide Price For', WC_RBP_TXT), 'desc' => __('Use to hide product price for selected roles', WC_RBP_TXT), 'id' => rbp_key . 'hide_price_role', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => $width, 'options' => WC_RBP()->admin()->get_selectbox_user_role()), array('name' => __('Hide Add To Cart Button For', WC_RBP_TXT), 'desc' => __('Use to hide product add to cart button link for selected roles', WC_RBP_TXT), 'id' => rbp_key . 'hide_cart_button_role', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => $width, 'options' => WC_RBP()->admin()->get_selectbox_user_role()), array('name' => __('Products To Hide', WC_RBP_TXT), 'desc' => __('For Which Products To Apply The Above Settings', WC_RBP_TXT), 'id' => rbp_key . 'products_hide_settings', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => $width, 'options' => array('simple' => __('Simple Product', WC_RBP_TXT), 'variable' => __('Variable Product', WC_RBP_TXT))), array('name' => __('Variable Product Settings', WC_RBP_TXT), 'desc' => __(' ', WC_RBP_TXT), 'id' => rbp_key . 'products_variable_settings', 'type' => 'select', 'class' => 'chosen_select', 'css' => $width, 'options' => array('show' => __('Show Variations', WC_RBP_TXT), 'hide' => __('Hide Variations', WC_RBP_TXT))), array('name' => __('Message For Price', WC_RBP_TXT), 'desc' => __('use <code>[curr]</code> to replace the currency symbol', WC_RBP_TXT), 'id' => rbp_key . 'replace_currency_symbol', 'type' => 'textarea', 'class' => '', 'css' => $width, 'options' => WC_RBP()->admin()->get_selectbox_user_role()), array('type' => 'sectionend', 'id' => 'price_views_end'));
 /**
  * Returns the price in html format.
  *
  * @access public
  * @param string $price (default: '')
  *                      @return string
  */
 public function get_price_html($price = '', $product)
 {
     $current_role = $this->get_current_role();
     $resticted_role = WC_RBP()->get_option(rbp_key . 'hide_price_role');
     if (!empty($resticted_role)) {
         if (in_array($current_role, $resticted_role)) {
             $price_notice = WC_RBP()->get_option(rbp_key . 'replace_currency_symbol');
             if (!empty($price_notice)) {
                 $symbol = get_woocommerce_currency_symbol();
                 $price_notice = str_replace('[curr]', $symbol, $price_notice);
                 return $price_notice;
             }
             return '';
         }
     }
     if ('WC_Product_Variable' == get_class($product)) {
         // Ensure variation prices are synced with variations
         if ($product->get_variation_regular_price('min') === false || $product->get_variation_price('min') === false || $product->get_variation_price('min') === '' || $product->get_price() === '') {
             $product->variable_product_sync($product->id);
         }
         // Get the price
         if ($product->get_price() === '') {
             $price = apply_filters('woocommerce_variable_empty_price_html', '', $product);
         } else {
             // Main price
             $prices = array($product->get_variation_price('min', true), $product->get_variation_price('max', true));
             $price = $prices[0] !== $prices[1] ? sprintf(_x('%1$s&ndash;%2$s', 'Price range: from-to', 'woocommerce'), wc_price($prices[0]), wc_price($prices[1])) : wc_price($prices[0]);
             // Sale
             $prices = array($product->get_variation_regular_price('min', true), $product->get_variation_regular_price('max', true));
             sort($prices);
             $saleprice = $prices[0] !== $prices[1] ? sprintf(_x('%1$s&ndash;%2$s', 'Price range: from-to', 'woocommerce'), wc_price($prices[0]), wc_price($prices[1])) : wc_price($prices[0]);
             if ($price !== $saleprice) {
                 $price = apply_filters('woocommerce_variable_sale_price_html', $product->get_price_html_from_to($saleprice, $price) . $product->get_price_suffix(), $product);
             } else {
             }
             if ($prices[0] == 0 && $prices[1] == 0) {
                 $price = __('Free!', 'woocommerce');
                 $price = apply_filters('woocommerce_variable_free_price_html', $price, $product);
             } else {
                 $price = apply_filters('woocommerce_variable_price_html', $price . $product->get_price_suffix(), $product);
             }
         }
     }
     return $price;
 }
Beispiel #13
0
 /**
  * Get sections
  * @return array
  */
 public function get_settings()
 {
     $width = "width:50% !important;";
     echo '<pre>';
     echo '</pre>';
     $settings = array(array('name' => __('WooCommerce Role Based Price Settings', lang_dom), 'type' => 'title', 'desc' => '', 'id' => rbp_key . 'general_start'), array('name' => __('Allowed User Roles', lang_dom), 'desc' => __('User Roles To List In Product Edit Page', lang_dom), 'id' => WC_DB_KEY . 'list_roles', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => $width, 'options' => $this->get_selectbox_user_role()), array('name' => __('Allowed Product Pricing', lang_dom), 'desc' => __('Price Fields To List In Product Edit Page', lang_dom), 'id' => WC_DB_KEY . 'allowed_price', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => $width, 'options' => array('regular' => __('Regular Price', lang_dom), 'sale' => __('Sale Price', lang_dom))), array('type' => 'sectionend', 'id' => 'general_start'));
     $settings[] = array('name' => __('User Role Custom Name', lang_dom), 'type' => 'title', 'desc' => '', 'id' => rbp_key . 'general_start_1');
     foreach (WC_RBP()->get_allowed_roles() as $role => $name) {
         $settings[] = array('name' => __($name['name'], lang_dom), 'desc' => '', 'id' => WC_DB_KEY . 'role_name[' . $role . ']', 'type' => 'text', 'class' => '', 'css' => 'width:25% !important;');
     }
     $settings[] = array('type' => 'sectionend', 'id' => rbp_key . 'general_start_1');
     return $settings;
 }
                if (isset($registered_roles[$role_name]['name'])) {
                    return $registered_roles[$role_name]['name'];
                }
            }
        } else {
            if (isset($registered_roles[$role_name]['name'])) {
                return $registered_roles[$role_name]['name'];
            }
        }
    }
}
/**
 * Check if WooCommerce is active 
 * if yes then call the class
 */
if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
    if (!function_exists('WC_RBP')) {
        function WC_RBP()
        {
            return WooCommerce_Role_Based_Price::get_instance();
        }
    }
    $GLOBALS['woocommerce'] = WC_RBP();
    do_action('wc_rbp_loaded');
} else {
    add_action('admin_notices', 'wc_rbp_activate_failed_notice');
}
function wc_rbp_activate_failed_notice()
{
    echo '<div class="error"><p> ' . __('<strong> <i> WooCommerce Role Based Pricing </i> </strong> Requires', lang_dom) . '<a href="' . admin_url('plugin-install.php?tab=plugin-information&plugin=woocommerce') . '"> <strong>' . __(' <u>Woocommerce</u>', lang_dom) . '</strong>  </a> ' . __(' To Be Installed And Activated', lang_dom) . ' </p></div>';
}
 /**
  * Replaces the product prices with custom ones.
  *
  * @param array product_prices An array of product prices.
  * @param int product_id The product ID.
  * @param int price_type The price types to be replaced (e.g. regular prices,
  * sale prices, etc).
  * @return array An array of currency => price entries
  *
  * @author Aelia <*****@*****.**>
  * @link http://aelia.co/about
  */
 public function my_custom_prices($product_prices, $product_id, $price_type)
 {
     /*
     $price_type can have one of the following values:
     - '_regular_currency_prices' -> Product's regular prices
     - '_sale_currency_prices' -> Product's sale prices
     - 'variable_regular_currency_prices' -> Variation's regular prices
     - 'variable_sale_currency_prices' -> Variation's simple prices
     
     Using $price_type, load the appropriate prices (regular or sale), and store
     them in an array, using the currency as the key. If you don't have one of the
     prices (e.g. GBP), don't add it to the array. Example:
     */
     $type = "selling_price";
     if ($price_type == 'variable_regular_currency_prices' || $price_type == '_regular_currency_prices') {
         $type = "regular_price";
     }
     $this->acs_get_db_price($product_id);
     $price = '';
     $allowed_currency = get_option(rbp_key . 'acs_allowed_currencies');
     $send_currency = array();
     foreach ($allowed_currency as $currency) {
         $price = $this->acs_crp($currency, WC_RBP()->current_role(), $type);
         if (!empty($price)) {
             $send_currency[$currency] = $price;
         }
     }
     //You can now merge the original prices with the ones you loaded.
     $product_prices = array_merge($product_prices, $send_currency);
     //Finally, return the overridden prices
     return $send_currency;
 }
<ul> 
    <?php 
foreach (WC_RBP()->get_allowed_roles() as $user_role_key => $val) {
    $name = WC_RBP()->get_mod_name($user_role_key);
    ?>
        <li> <a href="#<?php 
    echo $user_role_key;
    ?>
"><?php 
    echo $name;
    ?>
</a></li>
    <?php 
}
?>
</ul> 
 function process_bulk_action()
 {
     if ('activate_plugin' === $this->current_action()) {
         $activate_plugin = WC_RBP()->get_activated_plugin();
         if (!isset($activate_plugin[$_REQUEST['ps']])) {
             $activate_plugin[$_REQUEST['ps']] = $_REQUEST['plugin-key'];
         }
         update_option(rbp_key . 'activated_plugin', $activate_plugin);
     }
     if ('deactivate_plugin' === $this->current_action()) {
         $activate_plugin = WC_RBP()->get_activated_plugin();
         $i = 0;
         $count = count($activate_plugin);
         if (isset($activate_plugin[$_REQUEST['ps']])) {
             unset($activate_plugin[$_REQUEST['ps']]);
         }
         update_option(rbp_key . 'activated_plugin', $activate_plugin);
     }
     //Detect when a bulk action is being triggered...
     if ('delete' === $this->current_action()) {
         wp_die('Items deleted (or they would be if we had items to delete)!');
     }
 }
<div class="<?php 
echo $user_role_key;
?>
_role_price" id="<?php 
echo $user_role_key;
?>
"> 
    
    <div class="wc_rbp_plugin_field_container"> 
    <?php 
if ($regular_price) {
    echo '<p class="form-field regular_price_' . $user_role_key . '_field form-row-first">
                <label for="regular_price_' . $user_role_key . '">' . __('Regular Price', WC_RBP_TXT) . '</label>
                <input type="text" value="' . WC_RBP()->sp_function()->get_selprice($user_role_key, 'regular_price') . '" id="regular_price_' . $user_role_key . '" name="role_based_price[' . $user_role_key . '][regular_price]" class="short wc_input_price">
                </p>';
}
if ($selling_price) {
    echo '<p class="form-field selling_price_' . $user_role_key . '_field form-row-last">
                <label for="selling_price_' . $user_role_key . '">' . __('Selling Price', WC_RBP_TXT) . '</label>
                <input type="text" value="' . WC_RBP()->sp_function()->get_selprice($user_role_key, 'selling_price') . '" id="selling_price_' . $user_role_key . '" name="role_based_price[' . $user_role_key . '][selling_price]" class="short wc_input_price">
                </p>';
}
?>
    </div>

    <?php 
do_action('woocommerce_role_based_price_fields', $regular_price, $selling_price, $thepostid, $user_role_key, $name);
?>

</div> 
 function prepare_items()
 {
     $per_page = 5;
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     $this->process_bulk_action();
     $data = WC_RBP()->get_plugins_list();
     function usort_reorder($a, $b)
     {
         $orderby = !empty($_REQUEST['orderby']) ? $_REQUEST['orderby'] : 'title';
         //If no sort, default to title
         $order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'asc';
         //If no order, default to asc
         $result = strcmp($a[$orderby], $b[$orderby]);
         //Determine sort order
         return $order === 'asc' ? $result : -$result;
         //Send final sort direction to usort
     }
     usort($data, 'usort_reorder');
     $current_page = $this->get_pagenum();
     $total_items = count($data);
     $data = array_slice($data, ($current_page - 1) * $per_page, $per_page);
     $this->items = $data;
 }
 /**
  * Initializes variables
  */
 public function init()
 {
     $default_notices = array('update' => array(), 'error' => array());
     $this->notices = array_merge($default_notices, WC_RBP()->get_option(self::$db_key, array()));
     $this->notices_were_updated = false;
 }