Plugin Directory

Changeset 2926190


Ignore:
Timestamp:
06/14/2023 09:37:01 PM (21 months ago)
Author:
kevinamorim
Message:

Update version files.

Location:
role-based-bulk-quantity-pricing/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • role-based-bulk-quantity-pricing/trunk/Readme.txt

    r2926096 r2926190  
    11=== Role Based Bulk Quantity Pricing ===
    2 Contributors: kevinamorim
     2Contributors: kevinamorim, freemius
    33Tags: pricing, csv, roles, woocommerce, bulk
    44Requires at least: 5.5
  • role-based-bulk-quantity-pricing/trunk/assets/js/scripts.js

    r2926092 r2926190  
    5353    let taxesMessage = '';
    5454
    55     /* <fs_premium_only> */
    56     if ( display_tax_info ) {
    57         taxesMessage = taxes_included == true ?
    58             rbbqp_localized_strings.including_vat_message :
    59             rbbqp_localized_strings.excluding_vat_message;
    60     }
    61     /* </fs_premium_only> */
     55   
    6256
    6357    if ( productType === 'variable' ) {
  • role-based-bulk-quantity-pricing/trunk/inc/admin/class-rbbqp-settings.php

    r2926092 r2926190  
    33namespace Role_Based_Bulk_Quantity_Pricing\Inc\Admin;
    44
    5 defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
    6 
    7 use Role_Based_Bulk_Quantity_Pricing\Inc;
    8 use Role_Based_Bulk_Quantity_Pricing\Inc\Data\Repositories;
    9 
    10 class Rbbqp_Settings {
    11 
    12     private $data_accessor;
    13     private $options_manager;
    14 
    15     private $page_slug;
    16 
    17     private $pricing_lines;
    18 
    19     public function __construct() {
    20        
     5defined( 'ABSPATH' ) || exit;
     6// Exit if accessed directly.
     7use  Role_Based_Bulk_Quantity_Pricing\Inc ;
     8use  Role_Based_Bulk_Quantity_Pricing\Inc\Data\Repositories ;
     9class Rbbqp_Settings
     10{
     11    private  $data_accessor ;
     12    private  $options_manager ;
     13    private  $page_slug ;
     14    private  $pricing_lines ;
     15    public function __construct()
     16    {
    2117        $this->page_slug = 'role-based-bulk-quantity-pricing-settings';
    22 
    2318        $this->data_accessor = new Inc\Rbbqp_Data_Accessor();
    2419        $this->options_manager = Inc\Rbbqp_Options_Manager::get_instance();
    25 
    2620        add_action( 'admin_menu', array( $this, 'create_menu_page' ) );
    2721        add_action( 'admin_init', array( $this, 'render_fields' ) );
    2822        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
    2923    }
    30    
    31     public function enqueue_admin_scripts() {
    32         wp_enqueue_script( 'rbbqp_admin_scripts', plugin_dir_url( __FILE__ ) . '../../assets/js/admin-scripts.js', array( 'jquery' ), '1.0.5' );
    33         wp_enqueue_style( 'bootstrap', plugin_dir_url( __FILE__ ) .  '../../assets/libs/bootstrap.min.css' );
    34         wp_localize_script( 'rbbqp_admin_scripts', 'rbbqp_localized_strings', array(
    35                 'ajax_url' => admin_url( 'admin-ajax.php' ),
    36                 'processing_message' => __( 'Processing... Please wait!', 'role-based-bulk-quantity-pricing' ),
    37                 'upload_success_message' => __( 'A total of: %s lines were uploaded with success!', 'role-based-bulk-quantity-pricing' )
    38             )
    39         );
     24   
     25    public function enqueue_admin_scripts()
     26    {
     27        wp_enqueue_script(
     28            'rbbqp_admin_scripts',
     29            plugin_dir_url( __FILE__ ) . '../../assets/js/admin-scripts.js',
     30            array( 'jquery' ),
     31            '1.0.5'
     32        );
     33        wp_enqueue_style( 'bootstrap', plugin_dir_url( __FILE__ ) . '../../assets/libs/bootstrap.min.css' );
     34        wp_localize_script( 'rbbqp_admin_scripts', 'rbbqp_localized_strings', array(
     35            'ajax_url'               => admin_url( 'admin-ajax.php' ),
     36            'processing_message'     => __( 'Processing... Please wait!', 'role-based-bulk-quantity-pricing' ),
     37            'upload_success_message' => __( 'A total of: %s lines were uploaded with success!', 'role-based-bulk-quantity-pricing' ),
     38        ) );
    4039        wp_set_script_translations( 'rbbqp_admin_scripts', 'role-based-bulk-quantity-pricing' );
    41         wp_enqueue_style( 'rbbqp_admin_styles', plugin_dir_url( __FILE__ ) . '../../assets/css/admin-styles.css', array( 'bootstrap' ), '1.0.5' );
    42     }
    43 
    44     public function create_menu_page() {
     40        wp_enqueue_style(
     41            'rbbqp_admin_styles',
     42            plugin_dir_url( __FILE__ ) . '../../assets/css/admin-styles.css',
     43            array( 'bootstrap' ),
     44            '1.0.5'
     45        );
     46    }
     47   
     48    public function create_menu_page()
     49    {
    4550        add_menu_page(
    46             __( 'Role Based Bulk Quantity Pricing', 'role-based-bulk-quantity-pricing'),
    47             __( 'Role Based Bulk Quantity Pricing', 'role-based-bulk-quantity-pricing' ), 
     51            __( 'Role Based Bulk Quantity Pricing', 'role-based-bulk-quantity-pricing' ),
     52            __( 'Role Based Bulk Quantity Pricing', 'role-based-bulk-quantity-pricing' ),
    4853            'read',
    4954            $this->page_slug,
    5055            array( $this, 'display_settings_page' )
    5156        );
    52 
    5357        add_submenu_page(
    5458            $this->page_slug,
    55             __( 'Dashboard', 'role-based-bulk-quantity-pricing' ), 
    56             __( 'Dashboard', 'role-based-bulk-quantity-pricing' ), 
     59            __( 'Dashboard', 'role-based-bulk-quantity-pricing' ),
     60            __( 'Dashboard', 'role-based-bulk-quantity-pricing' ),
    5761            'read',
    5862            $this->page_slug
    5963        );
    60 
    6164        add_submenu_page(
    6265            $this->page_slug,
    63             __( 'Configurations', 'role-based-bulk-quantity-pricing' ), 
    64             __( 'Configurations', 'role-based-bulk-quantity-pricing' ), 
     66            __( 'Configurations', 'role-based-bulk-quantity-pricing' ),
     67            __( 'Configurations', 'role-based-bulk-quantity-pricing' ),
    6568            'read',
    6669            'role-based-bulk-quantity-pricing-configurations',
     
    6871        );
    6972    }
    70 
    71     public function render_fields() {
     73   
     74    public function render_fields()
     75    {
    7276        add_settings_section(
    7377            'configurations_section',
    7478            __( 'Configurations', 'role-based-bulk-quantity-pricing' ),
    7579            array( $this, 'options_section' ),
    76             $this->page_slug   
    77         );
    78     }
    79 
    80     public function configurations_submenu() {
    81 
     80            $this->page_slug
     81        );
     82    }
     83   
     84    public function configurations_submenu()
     85    {
    8286        $configurations_saved = false;
    83         if ( isset( $_POST ) &&
    84             isset( $_POST['submit'] ) ) {
     87       
     88        if ( isset( $_POST ) && isset( $_POST['submit'] ) ) {
    8589            $this->submit_configurations( $_POST );
    8690            $configurations_saved = true;
    8791        }
    88 
     92       
    8993        ?>
    9094
    9195        <div class="wrap">
    9296            <h2 class="nav-tab-wrapper" id="settings">
    93                 <a href="<?php echo esc_url( get_site_url() . '/wp-admin/admin.php?page=role-based-bulk-quantity-pricing-configurations' );?>" class="nav-tab nav-tab-active home">Settings</a>
     97                <a href="<?php
     98        echo  esc_url( get_site_url() . '/wp-admin/admin.php?page=role-based-bulk-quantity-pricing-configurations' ) ;
     99        ?>" class="nav-tab nav-tab-active home">Settings</a>
    94100            </h2>
    95101
    96102            <form method="post" name="rbbqpSettingsForm">
    97103
    98                 <?php if( $configurations_saved ): ?>
     104                <?php
     105       
     106        if ( $configurations_saved ) {
     107            ?>
    99108                    <div id="savedSuccessAlert" class="alert alert-success mt-5" role="alert">
    100                         <?php _e('Configurations saved!', 'role-based-bulk-quantity-pricing' ); ?>
     109                        <?php
     110            _e( 'Configurations saved!', 'role-based-bulk-quantity-pricing' );
     111            ?>
    101112                    </div>
    102                 <?php endif; ?>
    103 
    104 
    105                 <?php do_settings_sections( $this->page_slug ); ?>
     113                <?php
     114        }
     115       
     116        ?>
     117
     118
     119                <?php
     120        do_settings_sections( $this->page_slug );
     121        ?>
    106122                <hr>
    107123                <button class="btn btn-success rbbqp_custom_submit_button" type="submit" class="button" name="submit" value="Submit">
    108                     <img width="17" src="<?php echo esc_url( plugin_dir_url( __FILE__ ) . '../../assets/img/save.svg' ) ?>" /> <?php _e( 'Save', 'role-based-bulk-quantity-pricing' ) ?>
     124                    <img width="17" src="<?php
     125        echo  esc_url( plugin_dir_url( __FILE__ ) . '../../assets/img/save.svg' ) ;
     126        ?>" /> <?php
     127        _e( 'Save', 'role-based-bulk-quantity-pricing' );
     128        ?>
    109129                </button>
    110130            </form>
    111131
    112132            <div class="rbbqp-brand-logo-container">
    113                 <img class="rbbqp-brand-logo" src="<?php echo esc_url( plugin_dir_url( __FILE__ ) . '../../assets/img/logo.png' ) ?>" />
    114             </div>
    115 
    116         </div>
    117 
    118         <?php
    119     }
    120 
    121     public function options_section() {
    122 
     133                <img class="rbbqp-brand-logo" src="<?php
     134        echo  esc_url( plugin_dir_url( __FILE__ ) . '../../assets/img/logo.png' ) ;
     135        ?>" />
     136            </div>
     137
     138        </div>
     139
     140        <?php
     141    }
     142   
     143    public function options_section()
     144    {
    123145        $use_roles = $this->options_manager->get_use_roles_option();
    124146        $use_total_cart_qty = $this->options_manager->get_use_total_cart_qty_option();
    125147        $allow_for_guest = $this->options_manager->get_allow_for_guest_option();
    126148        $debug_mode = $this->options_manager->get_debug_mode_option();
    127 
    128         if ( rbbqp_fs()->is__premium_only() ) {
    129             $hide_taxes_on_product_page_for_wp_option_name = $this->options_manager->get_hide_taxes_on_product_page_for_option__premium_only();
    130             $display_tax_information = $this->options_manager->get_display_tax_information_option__premium_only();
    131         }
    132 
    133149        $display_product_total = $this->options_manager->get_display_product_total_option();
    134 
    135150        ?>
    136151        <div class="row mt-5">
    137152            <div class="col-2">
    138                 <label class="rbbqp_custom_label" for="useRoles"><?php _e( 'Use Roles', 'role-based-bulk-quantity-pricing' ) ?>:</label>
     153                <label class="rbbqp_custom_label" for="useRoles"><?php
     154        _e( 'Use Roles', 'role-based-bulk-quantity-pricing' );
     155        ?>:</label>
    139156            </div>
    140157            <div class="col-10">
    141                 <input class="form-control rbbqp_custom_checkbox_input" type="checkbox" name="useRoles" value="Yes" <?php echo isset( $use_roles ) && $use_roles == "1" ? "checked" : ""; ?> />
     158                <input class="form-control rbbqp_custom_checkbox_input" type="checkbox" name="useRoles" value="Yes" <?php
     159        echo  ( isset( $use_roles ) && $use_roles == "1" ? "checked" : "" ) ;
     160        ?> />
    142161            </div>
    143162        </div>
     
    145164        <div class="row mt-2">
    146165            <div class="col-2">
    147                 <label class="rbbqp_custom_label" for="useTotalCartQty"><?php _e( 'Use Total Cart Quantity', 'role-based-bulk-quantity-pricing' ) ?>:</label>
     166                <label class="rbbqp_custom_label" for="useTotalCartQty"><?php
     167        _e( 'Use Total Cart Quantity', 'role-based-bulk-quantity-pricing' );
     168        ?>:</label>
    148169            </div>
    149170            <div class="col-10">
    150                 <input class="form-control rbbqp_custom_checkbox_input" type="checkbox" name="useTotalCartQty" value="Yes" <?php echo esc_attr( isset( $use_total_cart_qty ) && $use_total_cart_qty == "1" ? "checked" : "" ); ?> />
     171                <input class="form-control rbbqp_custom_checkbox_input" type="checkbox" name="useTotalCartQty" value="Yes" <?php
     172        echo  esc_attr( ( isset( $use_total_cart_qty ) && $use_total_cart_qty == "1" ? "checked" : "" ) ) ;
     173        ?> />
    151174            </div>
    152175        </div>
     
    154177        <div class="row mt-2">
    155178            <div class="col-2">
    156                 <label class="rbbqp_custom_label" for="allowForGuest"><?php _e( 'Allow For Guest', 'role-based-bulk-quantity-pricing' ) ?>:</label>
     179                <label class="rbbqp_custom_label" for="allowForGuest"><?php
     180        _e( 'Allow For Guest', 'role-based-bulk-quantity-pricing' );
     181        ?>:</label>
    157182            </div>
    158183            <div class="col-10">
    159                 <input class="form-control rbbqp_custom_checkbox_input" type="checkbox" name="allowForGuest" value="Yes" <?php echo esc_attr( isset( $allow_for_guest ) && $allow_for_guest == "1" ? "checked" : "" ); ?> />
     184                <input class="form-control rbbqp_custom_checkbox_input" type="checkbox" name="allowForGuest" value="Yes" <?php
     185        echo  esc_attr( ( isset( $allow_for_guest ) && $allow_for_guest == "1" ? "checked" : "" ) ) ;
     186        ?> />
    160187            </div>
    161188        </div>
     
    163190        <div class="row mt-2">
    164191            <div class="col-2">
    165                 <label class="rbbqp_custom_label" for="displayProductTotal"><?php _e( 'Display Product Total', 'role-based-bulk-quantity-pricing' ) ?>:</label>
     192                <label class="rbbqp_custom_label" for="displayProductTotal"><?php
     193        _e( 'Display Product Total', 'role-based-bulk-quantity-pricing' );
     194        ?>:</label>
    166195            </div>
    167196            <div class="col-10">
    168                 <input class="form-control rbbqp_custom_checkbox_input" type="checkbox" name="displayProductTotal" value="Yes" <?php echo esc_attr( isset( $display_product_total ) && $display_product_total == "1" ? "checked" : "" ); ?> />
     197                <input class="form-control rbbqp_custom_checkbox_input" type="checkbox" name="displayProductTotal" value="Yes" <?php
     198        echo  esc_attr( ( isset( $display_product_total ) && $display_product_total == "1" ? "checked" : "" ) ) ;
     199        ?> />
    169200            </div>
    170201        </div>
     
    172203        <hr />
    173204
    174         <?php
    175 
    176         if ( rbbqp_fs()->is__premium_only() ) {
    177 
    178             ?>
    179             <h5><?php _e( 'Taxes', 'role-based-bulk-quantity-pricing' ); ?></h5>
    180 
    181             <div class="row mt-2">
    182                 <div class="col-2">
    183                     <label class="rbbqp_custom_label" for="displayTaxInformation"><?php _e( 'Display Tax Information', 'role-based-bulk-quantity-pricing' ) ?>:</label>
    184                 </div>
    185                 <div class="col-10">
    186                     <input class="form-control rbbqp_custom_checkbox_input" type="checkbox" name="displayTaxInformation" value="Yes" <?php echo esc_attr( isset( $display_tax_information ) && $display_tax_information == "1" ? "checked" : "" ); ?> />
    187                     <small class="rbbqp_label_info"><?php _e( 'A message saying whether the price includes or not taxes will be displayed next to the product price.', 'role-based-bulk-quantity-pricing' ); ?></small>
    188                 </div>
    189             </div>
    190    
    191             <div class="row mt-2">
    192                 <div class="col-2">
    193                     <label class="rbbqp_custom_label" for="excludedRolesFromTaxesDisplay"><?php _e( 'Hide taxes on product page for roles', 'role-based-bulk-quantity-pricing' ) ?>:</label>
    194                 </div>
    195                 <div class="col-10">
    196                     <input class="form-control" type="text" name="excludedRolesFromTaxesDisplay" value="<?php echo esc_attr( $hide_taxes_on_product_page_for_wp_option_name ); ?>" />
    197                     <small class="rbbqp_label_info"><?php _e( 'Comma-separated list, without spaces, all lower case (equal to the CSV file).', 'role-based-bulk-quantity-pricing' ); ?></small>
    198                     <small class="rbbqp_label_info"><?php _e( 'Taxes will not be displayed on the product page for the selected roles.', 'role-based-bulk-quantity-pricing' ); ?></small>
    199                 </div>
    200             </div>
    201             <hr />
    202 
    203         <?php } ?>
    204 
    205         <h5><?php _e( 'Advanced', 'role-based-bulk-quantity-pricing' ); ?></h5>
     205        <?php
     206        ?>
     207
     208        <h5><?php
     209        _e( 'Advanced', 'role-based-bulk-quantity-pricing' );
     210        ?></h5>
    206211
    207212        <div class="row mt-2">
    208213            <div class="col-2">
    209                 <label class="rbbqp_custom_label" for="debugMode"><?php _e( 'Debug Mode', 'role-based-bulk-quantity-pricing' ) ?>:</label>
     214                <label class="rbbqp_custom_label" for="debugMode"><?php
     215        _e( 'Debug Mode', 'role-based-bulk-quantity-pricing' );
     216        ?>:</label>
    210217            </div>
    211218            <div class="col-10">
    212                 <input class="form-control rbbqp_custom_checkbox_input" type="checkbox" name="debugMode" value="Yes" <?php echo esc_attr( isset( $debug_mode ) && $debug_mode == "1" ? "checked" : "" ); ?> />
    213             </div>
    214         </div>
    215         <?php
    216     }
    217 
    218     public function submit_configurations( $data ) {
    219  
     219                <input class="form-control rbbqp_custom_checkbox_input" type="checkbox" name="debugMode" value="Yes" <?php
     220        echo  esc_attr( ( isset( $debug_mode ) && $debug_mode == "1" ? "checked" : "" ) ) ;
     221        ?> />
     222            </div>
     223        </div>
     224        <?php
     225    }
     226   
     227    public function submit_configurations( $data )
     228    {
     229       
    220230        if ( isset( $data["useRoles"] ) && $data["useRoles"] == "Yes" ) {
    221             $this->options_manager->set_use_roles_option( true ); 
     231            $this->options_manager->set_use_roles_option( true );
    222232        } else {
    223233            $this->options_manager->set_use_roles_option( false );
    224         }     
    225 
     234        }
     235       
     236       
    226237        if ( isset( $data["useTotalCartQty"] ) && $data["useTotalCartQty"] == "Yes" ) {
    227238            $this->options_manager->set_use_total_cart_qty_option( true );
     
    230241        }
    231242       
    232         if ( isset( $data["allowForGuest"] ) && $data["allowForGuest"] == "Yes"  ) {
     243       
     244        if ( isset( $data["allowForGuest"] ) && $data["allowForGuest"] == "Yes" ) {
    233245            $this->options_manager->set_allow_for_guest_option( true );
    234246        } else {
    235247            $this->options_manager->set_allow_for_guest_option( false );
    236248        }
    237 
    238         if ( isset( $data["displayProductTotal"] ) && $data["displayProductTotal"] == "Yes"  ) {
     249       
     250       
     251        if ( isset( $data["displayProductTotal"] ) && $data["displayProductTotal"] == "Yes" ) {
    239252            $this->options_manager->set_display_product_total_option( true );
    240253        } else {
    241254            $this->options_manager->set_display_product_total_option( false );
    242255        }
    243 
    244         /**
    245          * Premium only!
    246          */
    247         if ( rbbqp_fs()->is__premium_only() ) {
    248 
    249             if ( isset( $data["displayTaxInformation"] ) && $data["displayTaxInformation"] == "Yes" ) {
    250                 $this->options_manager->set_display_tax_information_option__premium_only( true );
    251             } else {
    252                 $this->options_manager->set_display_tax_information_option__premium_only( false );
    253             }
    254    
    255             if ( isset( $data["excludedRolesFromTaxesDisplay"] ) ) {
    256                 $data_excludedRolesFromTaxesDisplay = sanitize_text_field( $data["excludedRolesFromTaxesDisplay"] );
    257                
    258                 $fixed_str = str_replace( ' ', '', $data_excludedRolesFromTaxesDisplay );
    259                 $fixed_str = strtolower( $fixed_str );
    260                 $this->options_manager->set_hide_taxes_on_product_page_for_option__premium_only( $fixed_str );
    261             }
    262         }
    263 
    264         if ( isset( $data["debugMode"] ) && $data["debugMode"] == "Yes"  ) {
     256       
     257       
     258        if ( isset( $data["debugMode"] ) && $data["debugMode"] == "Yes" ) {
    265259            $this->options_manager->set_debug_mode_option( true );
    266260        } else {
    267261            $this->options_manager->set_debug_mode_option( false );
    268262        }
    269        
    270     }
    271 
    272     public function display_settings_page() {
     263   
     264    }
     265   
     266    public function display_settings_page()
     267    {
    273268        $page = 1;
    274269        $count = Repositories\Rbbqp_Pricing_Repository::get_count();
    275         $totalPages =  ceil( $count / 10 );
     270        $totalPages = ceil( $count / 10 );
    276271        ?>
    277272
    278273        <div class="row">
    279274            <div class="col-12">
    280                 <h2><?php _e( 'Dashboard', 'role-based-bulk-quantity-pricing' ); ?></h2>
     275                <h2><?php
     276        _e( 'Dashboard', 'role-based-bulk-quantity-pricing' );
     277        ?></h2>
    281278            </div>
    282279        </div>
     
    284281        <div class="row">
    285282            <div class="col-md-4">
    286                 <button type="button" id="exportCsvBtn" class="btn btn-primary"><?php _e('Export CSV', 'role-based-bulk-quantity-pricing' ) ?></button><br>
     283                <button type="button" id="exportCsvBtn" class="btn btn-primary"><?php
     284        _e( 'Export CSV', 'role-based-bulk-quantity-pricing' );
     285        ?></button><br>
    287286            </div>
    288287            <div class="col-md-4">
    289                 <button type="button" id="exportProductsListBtn" class="btn btn-primary"><?php _e('Export Products List', 'role-based-bulk-quantity-pricing' ) ?></button><br>
    290                 <span id="exportProductsListDownloadMsg" style="display:none;"><?php _e( 'Processing... Please wait!', 'role-based-bulk-quantity-pricing' ); ?></span>
     288                <button type="button" id="exportProductsListBtn" class="btn btn-primary"><?php
     289        _e( 'Export Products List', 'role-based-bulk-quantity-pricing' );
     290        ?></button><br>
     291                <span id="exportProductsListDownloadMsg" style="display:none;"><?php
     292        _e( 'Processing... Please wait!', 'role-based-bulk-quantity-pricing' );
     293        ?></span>
    291294            </div>
    292295            <div class="col-md-4">
    293                 <button type="button" id="exportRolesBtn" class="btn btn-primary"><?php _e('Export Roles List', 'role-based-bulk-quantity-pricing' ) ?></button><br>
    294                 <span id="exportRolesDownloadMsg" style="display:none;"><?php _e( 'Processing... Please wait!', 'role-based-bulk-quantity-pricing' ); ?></span>
     296                <button type="button" id="exportRolesBtn" class="btn btn-primary"><?php
     297        _e( 'Export Roles List', 'role-based-bulk-quantity-pricing' );
     298        ?></button><br>
     299                <span id="exportRolesDownloadMsg" style="display:none;"><?php
     300        _e( 'Processing... Please wait!', 'role-based-bulk-quantity-pricing' );
     301        ?></span>
    295302            </div>
    296303        </div>
     
    302309            <div class="row mt-5">
    303310                <div class="col-md-12">
    304                     <table id="pricingLinesTable" class="table" data-current-page="<?php echo esc_attr( $page ); ?>" data-total-pages="<?php echo esc_attr( $totalPages ); ?>">
     311                    <table id="pricingLinesTable" class="table" data-current-page="<?php
     312        echo  esc_attr( $page ) ;
     313        ?>" data-total-pages="<?php
     314        echo  esc_attr( $totalPages ) ;
     315        ?>">
    305316
    306317                        <thead>
    307318                            <tr>
    308                                 <th scope="col"><?php _e( 'ID', 'role-based-bulk-quantity-pricing' ); ?></th>
    309                                 <th scope="col"><?php _e( 'Role', 'role-based-bulk-quantity-pricing' ); ?></th>
    310                                 <th scope="col"><?php _e( 'Base Unit Price', 'role-based-bulk-quantity-pricing' ); ?></th>
    311                                 <th scope="col"><?php _e( 'Threshold Unit Price', 'role-based-bulk-quantity-pricing' ); ?></th>
    312                                 <th scope="col"><?php _e( 'Threshold Quantity', 'role-based-bulk-quantity-pricing' ); ?></th>
     319                                <th scope="col"><?php
     320        _e( 'ID', 'role-based-bulk-quantity-pricing' );
     321        ?></th>
     322                                <th scope="col"><?php
     323        _e( 'Role', 'role-based-bulk-quantity-pricing' );
     324        ?></th>
     325                                <th scope="col"><?php
     326        _e( 'Base Unit Price', 'role-based-bulk-quantity-pricing' );
     327        ?></th>
     328                                <th scope="col"><?php
     329        _e( 'Threshold Unit Price', 'role-based-bulk-quantity-pricing' );
     330        ?></th>
     331                                <th scope="col"><?php
     332        _e( 'Threshold Quantity', 'role-based-bulk-quantity-pricing' );
     333        ?></th>
    313334                            </tr>
    314335                        </thead>
     
    323344                            <li class="page-item">
    324345                                <a class="page-link"
    325                                     href="#" onclick="rbbqp_previousPage(); return false;"><?php _e( 'Previous', 'role-based-bulk-quantity-pricing' ); ?></a>
     346                                    href="#" onclick="rbbqp_previousPage(); return false;"><?php
     347        _e( 'Previous', 'role-based-bulk-quantity-pricing' );
     348        ?></a>
    326349                            </li>
    327                             <?php for($i = 1; $i <= $totalPages; $i++ ): ?>
    328                             <li class="page-item" data-id="<?php echo $i; ?>">
    329                                 <a class="page-link" href="#" onclick="rbbqp_fetchPage(<?php echo esc_js( $i ); ?>); return false;"> <?php echo esc_html( $i ); ?> </a>
     350                            <?php
     351        for ( $i = 1 ;  $i <= $totalPages ;  $i++ ) {
     352            ?>
     353                            <li class="page-item" data-id="<?php
     354            echo  $i ;
     355            ?>">
     356                                <a class="page-link" href="#" onclick="rbbqp_fetchPage(<?php
     357            echo  esc_js( $i ) ;
     358            ?>); return false;"> <?php
     359            echo  esc_html( $i ) ;
     360            ?> </a>
    330361                            </li>
    331                             <?php endfor; ?>
     362                            <?php
     363        }
     364        ?>
    332365                            <li class="page-item">
    333366                                <a class="page-link"
    334                                     href="#" onclick="rbbqp_nextPage(); return false;"><?php _e( 'Next', 'role-based-bulk-quantity-pricing' ); ?></a>
     367                                    href="#" onclick="rbbqp_nextPage(); return false;"><?php
     368        _e( 'Next', 'role-based-bulk-quantity-pricing' );
     369        ?></a>
    335370                            </li>
    336371                        </ul>
     
    345380            <input type='file' name='file' id="csvFileToUploadInput">
    346381            <button class="btn btn-success rbbqp_custom_submit_button" type="submit" class="button" name="btn_submit" disabled>
    347                 <img width="17" src="<?php echo esc_url( plugin_dir_url( __FILE__ ) . '../../assets/img/save.svg' ); ?>" /> <?php _e( 'Import CSV', 'role-based-bulk-quantity-pricing' ) ?>
     382                <img width="17" src="<?php
     383        echo  esc_url( plugin_dir_url( __FILE__ ) . '../../assets/img/save.svg' ) ;
     384        ?>" /> <?php
     385        _e( 'Import CSV', 'role-based-bulk-quantity-pricing' );
     386        ?>
    348387            </button>
    349388            <div class="row mt-5">
    350389                <div class="col-md-12">
    351390                    <span id="uploadingCsvMsg" style="display: none;">
    352                         <?php _e('The uploaded file is processing... Please, do not leave or refresh this page.', 'role-based-bulk-quantity-pricing' ); ?>
     391                        <?php
     392        _e( 'The uploaded file is processing... Please, do not leave or refresh this page.', 'role-based-bulk-quantity-pricing' );
     393        ?>
    353394                    </span>
    354395                </div>
     
    358399
    359400        <div class="rbbqp-brand-logo-container">
    360             <img class="rbbqp-brand-logo" src="<?php echo esc_url( plugin_dir_url( __FILE__ ) . '../../assets/img/logo.png' ); ?>" />
    361         </div>
    362 
    363         <?php
    364     }
     401            <img class="rbbqp-brand-logo" src="<?php
     402        echo  esc_url( plugin_dir_url( __FILE__ ) . '../../assets/img/logo.png' ) ;
     403        ?>" />
     404        </div>
     405
     406        <?php
     407    }
     408
    365409}
  • role-based-bulk-quantity-pricing/trunk/inc/class-rbbqp-options-manager.php

    r2926092 r2926190  
    33namespace Role_Based_Bulk_Quantity_Pricing\Inc;
    44
    5 defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
    6 
    7 class Rbbqp_Options_Manager {
    8 
    9     private static $instance;
    10 
    11     public static function get_instance() {
     5defined( 'ABSPATH' ) || exit;
     6// Exit if accessed directly.
     7class Rbbqp_Options_Manager
     8{
     9    private static  $instance ;
     10    public static function get_instance()
     11    {
    1212        if ( null === self::$instance ) {
    1313            self::$instance = new self();
    1414        }
    15 
    1615        return self::$instance;
    1716    }
    18 
    19     private $prefix;
    20 
    21     private $options;
    22 
    23     private $use_roles_wp_option_name;
    24     private $use_total_cart_qty_wp_option_name;
    25     private $allow_for_guest_wp_option_name;
    26     private $debug_mode_wp_option_name;
    27 
    28     private $hide_taxes_on_product_page_for_wp_option_name;
    29     private $display_tax_information_wp_option_name;
    3017   
    31     public function __construct() {
    32 
     18    private  $prefix ;
     19    private  $options ;
     20    private  $use_roles_wp_option_name ;
     21    private  $use_total_cart_qty_wp_option_name ;
     22    private  $allow_for_guest_wp_option_name ;
     23    private  $debug_mode_wp_option_name ;
     24    private  $hide_taxes_on_product_page_for_wp_option_name ;
     25    private  $display_tax_information_wp_option_name ;
     26    public function __construct()
     27    {
    3328        $this->prefix = 'rbbqp_';
    34 
    3529        $this->options = get_option( $this->prefix . 'options' );
    36         if ( !$this->options )
     30        if ( !$this->options ) {
    3731            $this->options = array();
    38 
     32        }
    3933        $this->use_roles_wp_option_name = 'use_roles';
    4034        $this->use_total_cart_qty_wp_option_name = 'use_total_cart_qty';
    4135        $this->allow_for_guest_wp_option_name = 'allow_for_guest';
    4236        $this->debug_mode_wp_option_name = 'debug_mode';
    43 
    4437        /** Premium only configurations. */
    4538        $this->hide_taxes_on_product_page_for_wp_option_name = 'hide_taxes_on_product_page_for';
    4639        $this->display_tax_information_wp_option_name = 'display_tax_information';
    47        
    4840        $this->display_product_total = "display_product_total";
    4941    }
    50 
    51     private function get_value_or_default( $key, $default = false ) {
     42   
     43    private function get_value_or_default( $key, $default = false )
     44    {
    5245        if ( array_key_exists( $key, $this->options ) ) {
    5346            return $this->options[$key];
     
    5548        return $default;
    5649    }
    57 
    58     private function set_value( $key, $value ) {
     50   
     51    private function set_value( $key, $value )
     52    {
    5953        $this->options[$key] = $value;
    60         update_option( $this->prefix . 'options', $this->options );       
     54        update_option( $this->prefix . 'options', $this->options );
    6155    }
    62 
    63     public function get_use_roles_option() {
     56   
     57    public function get_use_roles_option()
     58    {
    6459        return $this->get_value_or_default( $this->use_roles_wp_option_name );
    6560    }
    66 
    67     public function set_use_roles_option( $new_value ) {
     61   
     62    public function set_use_roles_option( $new_value )
     63    {
    6864        $this->set_value( $this->use_roles_wp_option_name, $new_value );
    6965    }
    70 
    71     public function get_use_total_cart_qty_option() {
     66   
     67    public function get_use_total_cart_qty_option()
     68    {
    7269        return $this->get_value_or_default( $this->use_total_cart_qty_wp_option_name );
    7370    }
    74 
    75     public function set_use_total_cart_qty_option( $new_value ) {
     71   
     72    public function set_use_total_cart_qty_option( $new_value )
     73    {
    7674        $this->set_value( $this->use_total_cart_qty_wp_option_name, $new_value );
    7775    }
    78 
    79     public function get_allow_for_guest_option() {
     76   
     77    public function get_allow_for_guest_option()
     78    {
    8079        return $this->get_value_or_default( $this->allow_for_guest_wp_option_name );
    8180    }
    82 
    83     public function set_allow_for_guest_option( $new_value ) {
     81   
     82    public function set_allow_for_guest_option( $new_value )
     83    {
    8484        $this->set_value( $this->allow_for_guest_wp_option_name, $new_value );
    8585    }
    86 
    87     public function get_debug_mode_option() {
     86   
     87    public function get_debug_mode_option()
     88    {
    8889        return $this->get_value_or_default( $this->debug_mode_wp_option_name );
    8990    }
    90 
    91     public function set_debug_mode_option( $new_value ) {
     91   
     92    public function set_debug_mode_option( $new_value )
     93    {
    9294        $this->set_value( $this->debug_mode_wp_option_name, $new_value );
    9395    }
    94 
    95     public function get_display_product_total_option() {
     96   
     97    public function get_display_product_total_option()
     98    {
    9699        return $this->get_value_or_default( $this->display_product_total );
    97100    }
    98 
    99     public function set_display_product_total_option( $new_value ) {
     101   
     102    public function set_display_product_total_option( $new_value )
     103    {
    100104        $this->set_value( $this->display_product_total, $new_value );
    101105    }
    102106
    103     /**
    104      * Premium only.
    105      */
    106     public function get_hide_taxes_on_product_page_for_option__premium_only() {
    107         return $this->get_value_or_default( $this->hide_taxes_on_product_page_for_wp_option_name );
    108     }
    109 
    110     public function set_hide_taxes_on_product_page_for_option__premium_only( $new_value ) {
    111         $this->set_value( $this->hide_taxes_on_product_page_for_wp_option_name, $new_value );
    112     }
    113 
    114     public function get_display_tax_information_option__premium_only() {
    115         return $this->get_value_or_default( $this->display_tax_information_wp_option_name );
    116     }
    117 
    118     public function set_display_tax_information_option__premium_only( $new_value ) {
    119         $this->set_value( $this->display_tax_information_wp_option_name, $new_value );
    120     }
    121107}
  • role-based-bulk-quantity-pricing/trunk/inc/class-rbbqp-product-helper.php

    r2926092 r2926190  
    33namespace Role_Based_Bulk_Quantity_Pricing\Inc;
    44
    5 defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
    6 
    7 use Role_Based_Bulk_Quantity_Pricing\Inc;
    8 use Role_Based_Bulk_Quantity_Pricing\Inc\Helpers;
    9 use Role_Based_Bulk_Quantity_Pricing\Inc\Helpers\Models;
    10 
    11 class Rbbqp_Product_Helper {
    12 
    13     private $options_manager;
    14     private $rbbqp_cart_helper;
    15     private $rbbqp_tax_helper;
    16     private $user_helpers;
    17     private $price_helpers;
    18 
    19     private $display_taxes;
    20    
    21     private $roles;
    22 
     5defined( 'ABSPATH' ) || exit;
     6// Exit if accessed directly.
     7use  Role_Based_Bulk_Quantity_Pricing\Inc ;
     8use  Role_Based_Bulk_Quantity_Pricing\Inc\Helpers ;
     9use  Role_Based_Bulk_Quantity_Pricing\Inc\Helpers\Models ;
     10class Rbbqp_Product_Helper
     11{
     12    private  $options_manager ;
     13    private  $rbbqp_cart_helper ;
     14    private  $rbbqp_tax_helper ;
     15    private  $user_helpers ;
     16    private  $price_helpers ;
     17    private  $display_taxes ;
     18    private  $roles ;
    2319    /**
    2420     * Options
    2521     */
    26     private $debug_mode;
    27     private $handle_taxes;
    28     private $display_tax_information;
    29     private $use_total_cart_qty;
    30     private $display_product_total;
    31 
    32     public function __construct() {
    33 
     22    private  $debug_mode ;
     23    private  $handle_taxes ;
     24    private  $display_tax_information ;
     25    private  $use_total_cart_qty ;
     26    private  $display_product_total ;
     27    public function __construct()
     28    {
    3429        add_action( 'woocommerce_single_product_summary', array( $this, 'total_product_price' ), 31 );
    35         add_action( 'woocommerce_get_price_html', array( $this, 'total_product_price_html' ), 99, 2 );
    36 
    37         add_filter('woocommerce_product_get_price', array( $this, 'product_get_price' ), 9999, 2 );
    38         add_filter('woocommerce_get_price_excluding_tax', array( $this, 'product_get_price_excl_taxes' ), 9999, 3 );
    39         add_filter('woocommerce_product_get_regular_price', array( $this, 'product_get_price' ), 9999, 2 );
    40         add_filter('safe_style_css', array( $this, 'add_display_as_safe_style_css' ), 9999, 1 );
    41 
     30        add_action(
     31            'woocommerce_get_price_html',
     32            array( $this, 'total_product_price_html' ),
     33            99,
     34            2
     35        );
     36        add_filter(
     37            'woocommerce_product_get_price',
     38            array( $this, 'product_get_price' ),
     39            9999,
     40            2
     41        );
     42        add_filter(
     43            'woocommerce_get_price_excluding_tax',
     44            array( $this, 'product_get_price_excl_taxes' ),
     45            9999,
     46            3
     47        );
     48        add_filter(
     49            'woocommerce_product_get_regular_price',
     50            array( $this, 'product_get_price' ),
     51            9999,
     52            2
     53        );
     54        add_filter(
     55            'safe_style_css',
     56            array( $this, 'add_display_as_safe_style_css' ),
     57            9999,
     58            1
     59        );
    4260        $this->rbbqp_cart_helper = new Rbbqp_Cart_Helper();
    4361        $this->rbbqp_tax_helper = new Rbbqp_Tax_Helper();
     
    4563        $this->user_helpers = new Helpers\Rbbqp_User_Helpers();
    4664        $this->price_helpers = new Inc\Rbbqp_Price_Helper();
    47 
    4865        $this->roles = $this->user_helpers->get_user_roles();
    49 
    5066        $this->debug_mode = $this->options_manager->get_debug_mode_option();
    51 
    52         if ( rbbqp_fs()->is__premium_only() ) {
    53             $this->display_tax_information = $this->options_manager->get_display_tax_information_option__premium_only() == "1" ? true : false;
    54         } else {
    55             $this->display_tax_information = false;
    56         }
    57        
     67        $this->display_tax_information = false;
    5868        $this->use_total_cart_qty = $this->options_manager->get_use_total_cart_qty_option();
    5969        $this->display_product_total = $this->options_manager->get_display_product_total_option();
    60 
    6170        $this->display_taxes = $this->rbbqp_tax_helper->should_display_taxes();
    6271    }
    63 
    64     public function add_display_as_safe_style_css( $styles ) {
     72   
     73    public function add_display_as_safe_style_css( $styles )
     74    {
    6575        $styles[] = 'display';
    6676        return $styles;
    6777    }
    68 
    69     public function product_get_price( $price, $product ) {
    70 
    71         if ( is_admin() || defined('REST_REQUEST') )
     78   
     79    public function product_get_price( $price, $product )
     80    {
     81        if ( is_admin() || defined( 'REST_REQUEST' ) ) {
    7282            return;
    73 
     83        }
    7484        $cart_quantity = $this->rbbqp_cart_helper->get_item_quantity( $product->get_id(), 0 );
    75 
    76         return $this->price_helpers->get_item_price( $product, $price, $cart_quantity, false, true );   
    77     }
    78 
    79     public function product_get_price_excl_taxes( $price, $qty, $product ) {
    80         return $this->price_helpers->get_item_price( $product, $price, $qty, false, true );   
    81     }
    82 
     85        return $this->price_helpers->get_item_price(
     86            $product,
     87            $price,
     88            $cart_quantity,
     89            false,
     90            true
     91        );
     92    }
     93   
     94    public function product_get_price_excl_taxes( $price, $qty, $product )
     95    {
     96        return $this->price_helpers->get_item_price(
     97            $product,
     98            $price,
     99            $qty,
     100            false,
     101            true
     102        );
     103    }
     104   
    83105    /**
    84106     * Prices displayed on product page.
    85107     */
    86     public function total_product_price() {
    87 
    88         if ( is_admin() || defined('REST_REQUEST') )
     108    public function total_product_price()
     109    {
     110        if ( is_admin() || defined( 'REST_REQUEST' ) ) {
    89111            return;
    90 
    91         global $woocommerce, $product;
     112        }
     113        global  $woocommerce, $product ;
    92114        $product_type = $product->get_type();
    93 
    94115        $json_ob = array();
    95 
     116       
    96117        if ( $product->is_type( 'variable' ) ) {
    97 
    98118            $variations = $product->get_available_variations();
    99 
    100119            foreach ( $variations as $key => $value ) {
    101120                $pricing_lines = $this->price_helpers->get_all_pricings_for_item( $value['variation_id'], $product );
    102                 $json_ob = $this->add_pricing_to_json_obj( $json_ob, $pricing_lines, $value['variation_id'], $value );
     121                $json_ob = $this->add_pricing_to_json_obj(
     122                    $json_ob,
     123                    $pricing_lines,
     124                    $value['variation_id'],
     125                    $value
     126                );
    103127            }
    104            
    105128            ?>
    106129            <script>
    107                 rbbqp_updateCurrentPrice( '<?php echo esc_js( $product_type ); ?>', '<?php echo esc_js( $this->display_tax_information ); ?>', '<?php echo esc_js( $this->display_taxes ); ?>', -1 );           
     130                rbbqp_updateCurrentPrice( '<?php
     131            echo  esc_js( $product_type ) ;
     132            ?>', '<?php
     133            echo  esc_js( $this->display_tax_information ) ;
     134            ?>', '<?php
     135            echo  esc_js( $this->display_taxes ) ;
     136            ?>', -1 );           
    108137            </script>
    109             <?php
     138            <?php 
    110139        } else {
    111 
    112140            $pricing_lines = $this->price_helpers->get_all_pricings_for_item( $product->get_id(), $product );
    113             $json_ob = $this->add_pricing_to_json_obj( $json_ob, $pricing_lines, $product->get_id(), $product );
    114 
     141            $json_ob = $this->add_pricing_to_json_obj(
     142                $json_ob,
     143                $pricing_lines,
     144                $product->get_id(),
     145                $product
     146            );
    115147            ?>
    116148            <script>       
    117                 rbbqp_updateCurrentPrice( '<?php echo esc_js( $product_type ); ?>', '<?php echo esc_js( $this->display_tax_information ); ?>', '<?php echo esc_js( $this->display_taxes ); ?>', '<?php echo esc_js( $product->get_id() ); ?>' );   
     149                rbbqp_updateCurrentPrice( '<?php
     150            echo  esc_js( $product_type ) ;
     151            ?>', '<?php
     152            echo  esc_js( $this->display_tax_information ) ;
     153            ?>', '<?php
     154            echo  esc_js( $this->display_taxes ) ;
     155            ?>', '<?php
     156            echo  esc_js( $product->get_id() ) ;
     157            ?>' );   
    118158            </script>
    119             <?php
    120 
    121         }
    122 
     159            <?php
     160        }
     161       
    123162        $customPricingTable_html = sprintf( '<div style="display:none;" id="customPricingTable" data-json="' . htmlspecialchars( json_encode( $json_ob ), ENT_QUOTES, 'UTF-8' ) . '"></div>' );
    124         echo wp_kses(
    125             $customPricingTable_html,
    126             array(
    127                 'div' => array(
    128                     'id' => array(),
    129                     'data-json' => array(),
    130                     'style' => array(),
    131                 ) ) );
    132 
     163        echo  wp_kses( $customPricingTable_html, array(
     164            'div' => array(
     165            'id'        => array(),
     166            'data-json' => array(),
     167            'style'     => array(),
     168        ),
     169        ) ) ;
     170       
    133171        if ( $this->display_product_total ) {
    134             echo wp_kses(
    135                 sprintf( '<div id="product_total_price" style="margin:5px auto;">%s %s</div>',__( 'Product Total:', 'role-based-bulk-quantity-pricing' ),'<span class="price"></span>' ),
    136                 array(
    137                     'div' => array(
    138                         'id' => array(),
    139                         'style' => array(),
    140                     ),
    141                     'span' => array(
    142                         'class' => array()
    143                     )
    144                 ) );
    145             echo wp_kses(
    146                 sprintf( '<div id="product_unit_price" style="margin:5px auto;">%s %s</div>',__( 'Unit Price:', 'role-based-bulk-quantity-pricing' ),'<span class="price"></span>' ),
    147                 array(
    148                     'div' => array(
    149                         'id' => array(),
    150                         'style' => array(),
    151                     ),
    152                     'span' => array(
    153                         'class' => array()
    154                     )
    155                 ) );
     172            echo  wp_kses( sprintf( '<div id="product_total_price" style="margin:5px auto;">%s %s</div>', __( 'Product Total:', 'role-based-bulk-quantity-pricing' ), '<span class="price"></span>' ), array(
     173                'div'  => array(
     174                'id'    => array(),
     175                'style' => array(),
     176            ),
     177                'span' => array(
     178                'class' => array(),
     179            ),
     180            ) ) ;
     181            echo  wp_kses( sprintf( '<div id="product_unit_price" style="margin:5px auto;">%s %s</div>', __( 'Unit Price:', 'role-based-bulk-quantity-pricing' ), '<span class="price"></span>' ), array(
     182                'div'  => array(
     183                'id'    => array(),
     184                'style' => array(),
     185            ),
     186                'span' => array(
     187                'class' => array(),
     188            ),
     189            ) ) ;
    156190        }
    157191       
    158192        $this->maybe_print_debug_data();
    159193    }
    160 
     194   
    161195    /**
    162196     * If debug mode is set to TRUE then some useful information will be displayed on the product page.
    163197     */
    164     private function maybe_print_debug_data() {
    165 
    166         if ( $this->debug_mode != '1' )
     198    private function maybe_print_debug_data()
     199    {
     200        if ( $this->debug_mode != '1' ) {
    167201            return;
    168            
    169         echo wp_kses(
    170             sprintf('<div id="user_assigned_roles_debug" class="rbbqp_debug-message">%s %s %s</div>', __('Assigned Roles','role-based-bulk-quantity-pricing'), ':', print_r( $this->roles, true ) ),
    171             array(
    172                 'div' => array(
    173                     'id' => array(),
    174                     'class' => array(),
    175                     'data-json' => array(),
    176                     'style' => array(),
    177                 ) )
    178         );
    179     }
    180 
     202        }
     203        echo  wp_kses( sprintf(
     204            '<div id="user_assigned_roles_debug" class="rbbqp_debug-message">%s %s %s</div>',
     205            __( 'Assigned Roles', 'role-based-bulk-quantity-pricing' ),
     206            ':',
     207            print_r( $this->roles, true )
     208        ), array(
     209            'div' => array(
     210            'id'        => array(),
     211            'class'     => array(),
     212            'data-json' => array(),
     213            'style'     => array(),
     214        ),
     215        ) ) ;
     216    }
     217   
    181218    /**
    182219     * JUST FOR THE DISPLAY FOR VARIABLE PRODUCTS
    183220     * TODO: REFACTOR
    184221     */
    185 
    186     public function total_product_price_html( $price, $product_obj ) {
    187 
    188         if ( is_admin() || defined('REST_REQUEST') )
     222    public function total_product_price_html( $price, $product_obj )
     223    {
     224        if ( is_admin() || defined( 'REST_REQUEST' ) ) {
    189225            return $price;
    190 
    191         global $product;
    192 
     226        }
     227        global  $product ;
    193228        $product_type = $product->get_type();
    194 
    195         if ( 'variable' !== $product->get_type() ||
    196             'product_variation' === $product_obj->post_type ) {
    197 
    198             if ( rbbqp_fs()->is__premium_only() ) {
    199 
    200                 $calculated_price = $this->price_helpers->get_item_price( $product, $product->get_price(), 1, false, !$this->display_taxes );
    201 
    202                 if ( $this->display_tax_information ) {
    203                     $price = wc_price( $calculated_price ) . ( $this->display_taxes ? ' (with VAT)' : ' (without VAT)' );
    204                 } else {
    205                     $price = wc_price( $calculated_price );
    206                 }
    207 
    208                 return $price;
    209 
    210             } else {
    211                 return $price;
    212             }
    213         }
    214 
     229        if ( 'variable' !== $product->get_type() || 'product_variation' === $product_obj->post_type ) {
     230            return $price;
     231        }
    215232        $variations = $product->get_available_variations();
    216 
    217233        $min_price = 99999;
    218234        $max_price = 0;
    219 
    220235        foreach ( $variations as $key => $value ) {
    221236            $pricing_lines = $this->price_helpers->get_all_pricings_for_item( $value['variation_id'], $product );
    222 
    223             if ( is_array( $pricing_lines) && count ( $pricing_lines ) > 0 ) {
    224 
    225                 for ( $x = 0; $x < count( $pricing_lines ); $x++ ) {
    226 
     237           
     238            if ( is_array( $pricing_lines ) && count( $pricing_lines ) > 0 ) {
     239                for ( $x = 0 ;  $x < count( $pricing_lines ) ;  $x++ ) {
     240                   
    227241                    if ( $pricing_lines[$x]->base_unit_price > $max_price ) {
    228242                        $max_price = $pricing_lines[$x]->base_unit_price;
    229                     } else if ( $pricing_lines[$x]->base_unit_price < $min_price ) {
    230                         $min_price = $pricing_lines[$x]->base_unit_price;
     243                    } else {
     244                        if ( $pricing_lines[$x]->base_unit_price < $min_price ) {
     245                            $min_price = $pricing_lines[$x]->base_unit_price;
     246                        }
    231247                    }
    232 
     248                   
     249                   
    233250                    if ( $pricing_lines[$x]->threshold_unit_price > $max_price ) {
    234251                        $max_price = $pricing_lines[$x]->threshold_unit_price;
    235                     } else if ( $pricing_lines[$x]->threshold_unit_price < $min_price ) {
    236                         $min_price = $pricing_lines[$x]->threshold_unit_price;
     252                    } else {
     253                        if ( $pricing_lines[$x]->threshold_unit_price < $min_price ) {
     254                            $min_price = $pricing_lines[$x]->threshold_unit_price;
     255                        }
    237256                    }
     257               
    238258                }
    239259            } else {
    240                 if ( $value['display_price'] < $min_price )
    241                     $min_price =  $value['display_price'];
     260                if ( $value['display_price'] < $min_price ) {
     261                    $min_price = $value['display_price'];
     262                }
    242263            }
    243         }
    244 
     264       
     265        }
    245266        $prices = array( $min_price, $max_price );
    246 
    247         if ( rbbqp_fs()->is__premium_only() ) {
    248 
    249             if ( $this->display_tax_information ) {
    250                 $price = $prices[0] !== $prices[1] ?
    251                     sprintf( __( 'From: %s %s', 'role-based-bulk-quantity-pricing' ), wc_price( $prices[0] ), ( $this->display_taxes ? ' (with VAT)' : ' (without VAT)' ) ) :
    252                     wc_price( $prices[0] ) . ( $this->display_taxes ? ' (with VAT)' : ' (without VAT)' );
    253                 return $price;
    254             }
    255 
    256         }
    257 
    258         $price = $prices[0] !== $prices[1] ?
    259         sprintf( __( 'From: %s', 'role-based-bulk-quantity-pricing' ), wc_price( $prices[0] ) ) :
    260         wc_price( $prices[0] );
    261 
     267        $price = ( $prices[0] !== $prices[1] ? sprintf( __( 'From: %s', 'role-based-bulk-quantity-pricing' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ) );
    262268        return $price;
    263269    }
    264 
    265     private function add_pricing_to_json_obj( $json_ob, $pricing_lines, $item_id, $item ) {
    266 
     270   
     271    private function add_pricing_to_json_obj(
     272        $json_ob,
     273        $pricing_lines,
     274        $item_id,
     275        $item
     276    )
     277    {
     278       
    267279        if ( is_array( $item ) ) {
    268280            $price = $item['display_price'];
     
    270282            $price = $item->get_price();
    271283        }
    272 
     284       
    273285        $initial_quantity = $this->rbbqp_cart_helper->get_item_quantity( $item_id, 0 );
    274 
    275         if ( is_null( $pricing_lines ) || empty( $pricing_lines ) ) {
    276             $json_ob[$item_id] = array( array( 
    277                 'threshold_min_qty' => 0,
    278                 'base_unit_price' => $price,
     286       
     287        if ( is_null( $pricing_lines ) || empty($pricing_lines) ) {
     288            $json_ob[$item_id] = array( array(
     289                'threshold_min_qty'    => 0,
     290                'base_unit_price'      => $price,
    279291                'threshold_unit_price' => $price,
    280                 'initial_quantity' => $initial_quantity ) );
     292                'initial_quantity'     => $initial_quantity,
     293            ) );
    281294        } else {
    282            
    283295            foreach ( $pricing_lines as $key => $pricing_line ) {
    284296                $pricing_line->initial_quantity = $initial_quantity;
    285297            }
     298            $json_ob[$item_id] = $pricing_lines;
     299        }
     300       
     301        return $json_ob;
     302    }
    286303
    287             $json_ob[$item_id] = $pricing_lines;
    288         }
    289 
    290         return $json_ob;
    291     }
    292304}
  • role-based-bulk-quantity-pricing/trunk/inc/class-rbbqp-tax-helper.php

    r2926092 r2926190  
    33namespace Role_Based_Bulk_Quantity_Pricing\Inc;
    44
    5 defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
    6 
    7 use Role_Based_Bulk_Quantity_Pricing\Inc;
    8 use Role_Based_Bulk_Quantity_Pricing\Inc\Helpers;
    9 use Role_Based_Bulk_Quantity_Pricing\Inc\Helpers\Models;
    10 
     5defined( 'ABSPATH' ) || exit;
     6// Exit if accessed directly.
     7use  Role_Based_Bulk_Quantity_Pricing\Inc ;
     8use  Role_Based_Bulk_Quantity_Pricing\Inc\Helpers ;
     9use  Role_Based_Bulk_Quantity_Pricing\Inc\Helpers\Models ;
    1110/**
    1211 * Helper class for taxes operations.
    1312 *
    1413 */
    15 class Rbbqp_Tax_Helper {
    16 
    17     private $wc_tax;
    18     private $options_manager;
    19     private $user_helpers;
    20    
     14class Rbbqp_Tax_Helper
     15{
     16    private  $wc_tax ;
     17    private  $options_manager ;
     18    private  $user_helpers ;
    2119    /**
    2220     * Options
    2321     */
    24     private $debug_mode;
    25     private $tax_display_shop;
    26     private $hide_taxes_on_product_page_for;
    27 
    28     public function __construct() {
    29 
     22    private  $debug_mode ;
     23    private  $tax_display_shop ;
     24    private  $hide_taxes_on_product_page_for ;
     25    public function __construct()
     26    {
    3027        $this->wc_tax = new \WC_Tax();
    3128        $this->options_manager = Inc\Rbbqp_Options_Manager::get_instance();
    3229        $this->user_helpers = new Helpers\Rbbqp_User_Helpers();
    33 
    3430        $this->debug_mode = $this->options_manager->get_debug_mode_option();
    35 
    36         if ( rbbqp_fs()->is__premium_only() ) {
    37             $this->hide_taxes_on_product_page_for = $this->options_manager->get_hide_taxes_on_product_page_for_option__premium_only();
    38         } else {
    39             $this->hide_taxes_on_product_page_for = '';
    40         }
    41 
     31        $this->hide_taxes_on_product_page_for = '';
    4232        $this->tax_display_shop = get_option( 'woocommerce_tax_display_shop' );
    4333    }
    44 
     34   
    4535    /**
    4636     * Gets the tax rate for a given tax class and customer location (optional).
     
    5141     * @return array Object containing: error message (if any), success, rate, multiplier, customer location.
    5242     */
    53     public function get_tax_rate( $tax_class, $ignore_customer_location = false ) : Models\Rbbqp_Item_Tax_Model {
    54    
    55 
    56 
     43    public function get_tax_rate( $tax_class, $ignore_customer_location = false ) : Models\Rbbqp_Item_Tax_Model
     44    {
     45       
    5746        if ( !$ignore_customer_location ) {
    58 
    5947            $location = $this->get_customer_location();
    60             $taxes = $this->wc_tax->find_rates( array_merge(
    61                 $location,
    62                 array( 'tax_class' => $tax_class )
    63             ) );
    64 
     48            $taxes = $this->wc_tax->find_rates( array_merge( $location, array(
     49                'tax_class' => $tax_class,
     50            ) ) );
    6551        } else {
    66 
    6752            $taxes = $this->wc_tax->get_rates_for_tax_class( '' );
    6853            $location = __( 'Ignored', 'role-based-bulk-quantity-pricing' );
    6954        }
    70 
    7155       
    72         if ( is_array( $taxes ) && count ( $taxes ) > 0 ) {
    73 
     56       
     57        if ( is_array( $taxes ) && count( $taxes ) > 0 ) {
    7458            // Take the first item.
    7559            $rates = array_shift( $taxes );
    7660            $item_rate = round( $rates->tax_rate );
    77             $rate_multiplier = 1 + ( $item_rate / 100 );
    78 
     61            $rate_multiplier = 1 + $item_rate / 100;
    7962            $this->maybe_print_debug_data( $item_rate, $location, '-' );
    80            
    81             return new Models\Rbbqp_Item_Tax_Model(
    82                 $item_rate,
    83                 $rate_multiplier,
    84                 $ignore_customer_location ? $location : $location['country'] );
    85    
     63            return new Models\Rbbqp_Item_Tax_Model( $item_rate, $rate_multiplier, ( $ignore_customer_location ? $location : $location['country'] ) );
    8664        }
    87 
     65       
    8866        $this->maybe_print_debug_data( 0, $location, __( 'No tax rate found for product.', 'role-based-bulk-quantity-pricing' ) );
    89 
    90         return new Models\Rbbqp_Item_Tax_Model(
    91             0,
    92             1,
    93             $ignore_customer_location ? $location  : $location['country'],
     67        return new Models\Rbbqp_Item_Tax_Model(
     68            0,
     69            1,
     70            ( $ignore_customer_location ? $location : $location['country'] ),
    9471            __( 'No tax rate found for product.', 'role-based-bulk-quantity-pricing' ),
    9572            false
    96          );
    97     }
    98 
    99     private function get_customer_location() {
    100         return array(
    101             'country'   => WC()->customer->get_shipping_country() ? WC()->customer->get_shipping_country() : WC()->customer->get_billing_country(),
    102             'state'     => WC()->customer->get_shipping_state() ? WC()->customer->get_shipping_state() : WC()->customer->get_billing_state(),
    103             'city'      => WC()->customer->get_shipping_city() ? WC()->customer->get_shipping_city() : WC()->customer->get_billing_city(),
    104             'postcode'  => WC()->customer->get_shipping_postcode() ? WC()->customer->get_shipping_postcode() : WC()->customer->get_billing_postcode(),
    10573        );
    10674    }
    107 
     75   
     76    private function get_customer_location()
     77    {
     78        return array(
     79            'country'  => ( WC()->customer->get_shipping_country() ? WC()->customer->get_shipping_country() : WC()->customer->get_billing_country() ),
     80            'state'    => ( WC()->customer->get_shipping_state() ? WC()->customer->get_shipping_state() : WC()->customer->get_billing_state() ),
     81            'city'     => ( WC()->customer->get_shipping_city() ? WC()->customer->get_shipping_city() : WC()->customer->get_billing_city() ),
     82            'postcode' => ( WC()->customer->get_shipping_postcode() ? WC()->customer->get_shipping_postcode() : WC()->customer->get_billing_postcode() ),
     83        );
     84    }
     85   
    10886    /**
    10987     * Checks if taxes should be displayed according to user role and
     
    11290     * @return Boolean
    11391     */
    114     public function should_display_taxes() {
    115 
    116         if ( rbbqp_fs()->is__premium_only() ) {
    117             $roles = $this->user_helpers->get_user_roles();
    118 
    119             $excluded_roles = explode( ',', $this->hide_taxes_on_product_page_for );
    120 
    121             $current_role_is_excluded = false;
    122             for ( $x = 0; $x < count ( $roles ); $x++ ) {
    123                 if ( in_array( $roles[$x], $excluded_roles ) ) {
    124                     $current_role_is_excluded = true;
    125                     break;
    126                 }
    127             }
    128 
    129             return !$current_role_is_excluded;
    130         }
    131 
     92    public function should_display_taxes()
     93    {
    13294        /* Always display for free version. */
    13395        return true;
    13496    }
    135 
    136     public function maybe_add_tax_to_pricing_line( $pricing_line, $rate_multiplier ) {
    137 
     97   
     98    public function maybe_add_tax_to_pricing_line( $pricing_line, $rate_multiplier )
     99    {
    138100        if ( wc_prices_include_tax() ) {
    139101            // Prices already include taxes.
    140 
     102           
    141103            if ( $this->tax_display_shop == 'excl' ) {
    142104                // Remove taxes
     
    144106                $pricing_line->threshold_unit_price /= $rate_multiplier;
    145107            }
     108       
    146109        }
    147110       
     
    150113            $pricing_line->threshold_unit_price *= $rate_multiplier;
    151114        }
    152 
     115       
    153116        return $pricing_line;
    154 
    155117    }
    156 
    157     public function apply_taxes_rules( $price, $rate_multiplier, $force_ignore_taxes = false ) {
    158 
     118   
     119    public function apply_taxes_rules( $price, $rate_multiplier, $force_ignore_taxes = false )
     120    {
     121       
    159122        if ( wc_prices_include_tax() ) {
    160123            // Prices already include taxes.
    161 
    162124            if ( $this->tax_display_shop == 'excl' || $force_ignore_taxes ) {
    163125                // Remove taxes
    164                 return $price/= $rate_multiplier;
     126                return $price /= $rate_multiplier;
    165127            }
    166 
    167128        } else {
    168 
    169129            if ( $this->tax_display_shop == 'incl' && !$force_ignore_taxes ) {
    170130                return $price *= $rate_multiplier;
    171131            }
    172 
    173132        }
    174 
     133       
    175134        return $price;
    176135    }
    177 
    178         /**
     136   
     137    /**
    179138     * If debug mode is set to TRUE then some useful information will be displayed on the product page.
    180139     */
    181     private function maybe_print_debug_data( $item_rate, $tax_location, $taxes_error ) {
    182 
    183         if ( $this->debug_mode != '1' )
     140    private function maybe_print_debug_data( $item_rate, $tax_location, $taxes_error )
     141    {
     142        if ( $this->debug_mode != '1' ) {
    184143            return;
    185            
    186         echo wp_kses(
    187             sprintf('<div id="tax_rate_debug" class="rbbqp_debug-message">%s %s %s %s</div>', __('Tax Rate','role-based-bulk-quantity-pricing'), ':', $item_rate, '%'),
    188             array(
    189                 'div' => array(
    190                     'id' => array(),
    191                     'class' => array()
    192                 )
    193             )
    194         );
    195         echo wp_kses(
    196             sprintf('<div id="handle_tax_rate_location" class="rbbqp_debug-message">%s %s %s</div>', __('Country','role-based-bulk-quantity-pricing'), ':', $tax_location),
    197             array(
    198                 'div' => array(
    199                     'id' => array(),
    200                     'class' => array()
    201                 )
    202             )
    203         );
    204 
    205         echo wp_kses(
    206             sprintf('<div id="handle_tax_rate_error" class="rbbqp_debug-message">%s %s %s</div>', __('Tax error','role-based-bulk-quantity-pricing'), ':', ''),
    207             array(
    208                 'div' => array(
    209                     'id' => array(),
    210                     'class' => array()
    211                 )
    212             )
    213         );
     144        }
     145        echo  wp_kses( sprintf(
     146            '<div id="tax_rate_debug" class="rbbqp_debug-message">%s %s %s %s</div>',
     147            __( 'Tax Rate', 'role-based-bulk-quantity-pricing' ),
     148            ':',
     149            $item_rate,
     150            '%'
     151        ), array(
     152            'div' => array(
     153            'id'    => array(),
     154            'class' => array(),
     155        ),
     156        ) ) ;
     157        echo  wp_kses( sprintf(
     158            '<div id="handle_tax_rate_location" class="rbbqp_debug-message">%s %s %s</div>',
     159            __( 'Country', 'role-based-bulk-quantity-pricing' ),
     160            ':',
     161            $tax_location
     162        ), array(
     163            'div' => array(
     164            'id'    => array(),
     165            'class' => array(),
     166        ),
     167        ) ) ;
     168        echo  wp_kses( sprintf(
     169            '<div id="handle_tax_rate_error" class="rbbqp_debug-message">%s %s %s</div>',
     170            __( 'Tax error', 'role-based-bulk-quantity-pricing' ),
     171            ':',
     172            ''
     173        ), array(
     174            'div' => array(
     175            'id'    => array(),
     176            'class' => array(),
     177        ),
     178        ) ) ;
    214179    }
    215180
  • role-based-bulk-quantity-pricing/trunk/role-based-bulk-quantity-pricing.php

    r2926092 r2926190  
    11<?php
     2
    23/*
    34  Plugin Name: Role Based Bulk Quantity Pricing
     
    910  Domain Path: /languages
    1011*/
    11 
    1212// If this file is called directly, abort.
    1313if ( !defined( 'WPINC' ) ) {
    1414    die;
    1515}
    16 
    1716/**
    1817 * Freemius
    1918 */
    20 if ( ! function_exists( 'rbbqp_fs' ) ) {
     19
     20if ( !function_exists( 'rbbqp_fs' ) ) {
    2121    // Create a helper function for easy SDK access.
    22     function rbbqp_fs() {
    23         global $rbbqp_fs;
    24 
    25         if ( ! isset( $rbbqp_fs ) ) {
     22    function rbbqp_fs()
     23    {
     24        global  $rbbqp_fs ;
     25       
     26        if ( !isset( $rbbqp_fs ) ) {
    2627            // Include Freemius SDK.
    27             require_once dirname(__FILE__) . '/freemius/start.php';
    28 
     28            require_once dirname( __FILE__ ) . '/freemius/start.php';
    2929            $rbbqp_fs = fs_dynamic_init( array(
    30                 'id'                  => '12373',
    31                 'slug'                => 'role-based-bulk-quantity-pricing',
    32                 'type'                => 'plugin',
    33                 'public_key'          => 'pk_e70ad977c9c6dfbb71a49a8daeb95',
    34                 'navigation'          => 'tabs',
    35                 'is_premium'          => true,
    36                 'is_premium_only'     => false,
    37                 'has_addons'          => false,
    38                 'has_paid_plans'      => true,
    39                 'menu'                => array(
    40                     'slug'           => 'role-based-bulk-quantity-pricing-configurations',
    41                     'contact'        => true,
    42                     'support'        => false,
    43                     'parent'         => array(
    44                         'slug' => 'role-based-bulk-quantity-pricing-settings',
    45                     ),
    46                 ),
    47                 // Set the SDK to work in a sandbox mode (for development & testing).
    48                 // IMPORTANT: MAKE SURE TO REMOVE SECRET KEY BEFORE DEPLOYMENT.
    49                 'secret_key'          => 'sk_Y&c$b)e7kHGqD0uT0zfd3+d[[midI',
     30                'id'              => '12373',
     31                'slug'            => 'role-based-bulk-quantity-pricing',
     32                'type'            => 'plugin',
     33                'public_key'      => 'pk_e70ad977c9c6dfbb71a49a8daeb95',
     34                'navigation'      => 'tabs',
     35                'is_premium'      => false,
     36                'is_premium_only' => false,
     37                'has_addons'      => false,
     38                'has_paid_plans'  => true,
     39                'menu'            => array(
     40                'slug'    => 'role-based-bulk-quantity-pricing-configurations',
     41                'contact' => true,
     42                'support' => false,
     43                'parent'  => array(
     44                'slug' => 'role-based-bulk-quantity-pricing-settings',
     45            ),
     46            ),
     47                'is_live'         => true,
    5048            ) );
    5149        }
    52 
     50       
    5351        return $rbbqp_fs;
    5452    }
    55 
     53   
    5654    // Init Freemius.
    5755    rbbqp_fs();
     
    6058}
    6159
    62 use Role_Based_Bulk_Quantity_Pricing\Inc\Admin;
    63 use Role_Based_Bulk_Quantity_Pricing\Inc\Data;
    64 use Role_Based_Bulk_Quantity_Pricing\Inc;
    65 
    66 require_once( trailingslashit( dirname( __FILE__ ) ) . 'inc/autoloader.php' );
    67 
     60use  Role_Based_Bulk_Quantity_Pricing\Inc\Admin ;
     61use  Role_Based_Bulk_Quantity_Pricing\Inc\Data ;
     62use  Role_Based_Bulk_Quantity_Pricing\Inc ;
     63require_once trailingslashit( dirname( __FILE__ ) ) . 'inc/autoloader.php';
    6864if ( !function_exists( 'rbbqp_log_entry' ) ) {
    69     function rbbqp_log_entry( $entry, $mode = 'a', $file = 'rbbqp_logs' ) {
    70 
     65    function rbbqp_log_entry( $entry, $mode = 'a', $file = 'rbbqp_logs' )
     66    {
    7167        $upload_dir = wp_upload_dir();
    7268        $upload_dir = $upload_dir['basedir'];
    73 
    7469        if ( is_array( $entry ) ) {
    7570            $entry = json_encode( $entry );
    7671        }
    77 
    7872        $file = $upload_dir . '/' . $file . '.log';
    7973        $file = fopen( $file, $mode );
     
    8276        return $bytes;
    8377    }
     78
     79}
     80function rbbqpload_plugin_textdomain()
     81{
     82    load_plugin_textdomain( 'role-based-bulk-quantity-pricing', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
    8483}
    8584
    86 function rbbqpload_plugin_textdomain() {
    87     load_plugin_textdomain( 'role-based-bulk-quantity-pricing', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
    88 }
    8985add_action( 'plugins_loaded', 'rbbqpload_plugin_textdomain' );
    90 
    91 function rbbqp_enqueue_script() {
    92 
     86function rbbqp_enqueue_script()
     87{
     88   
    9389    if ( !is_admin() ) {
    94 
    9590        wp_enqueue_script( 'rbbqp-front-script', plugin_dir_url( __FILE__ ) . 'assets/js/scripts.js', array( 'jquery' ) );
    96 
    9791        $translation_array = array(
    9892            "currency_symbol" => get_woocommerce_currency_symbol(),
    9993        );
    100 
    101         if ( rbbqp_fs()->is__premium_only() ) {
    102 
    103             $premium_translation_array = array(
    104                 "including_vat_message" => "(includes VAT)",
    105                 "excluding_vat_message" => "(without VAT)"
    106             );
    107            
    108             $translation_array = array_merge( $translation_array, $premium_translation_array );
    109         }
    110 
    111         wp_localize_script( 'rbbqp-front-script', 'rbbqp_localized_strings', $translation_array ); 
    112 
    113         wp_enqueue_style( 'rbbqp_admin_styles', plugin_dir_url( __FILE__ ) . 'assets/css/styles.css', array(), '1.0.0' );
     94        wp_localize_script( 'rbbqp-front-script', 'rbbqp_localized_strings', $translation_array );
     95        wp_enqueue_style(
     96            'rbbqp_admin_styles',
     97            plugin_dir_url( __FILE__ ) . 'assets/css/styles.css',
     98            array(),
     99            '1.0.0'
     100        );
    114101    }
    115102
    116103}
     104
    117105add_action( 'wp_enqueue_scripts', 'rbbqp_enqueue_script' );
    118 
    119106/**
    120107 * Activate the plugin.
    121108 */
    122 function rbbqp_activate() {
     109function rbbqp_activate()
     110{
    123111    $db_initializer = new Data\Rbbqp_Db_Initializer();
    124112    $db_initializer->addPricingTable();
    125113}
     114
    126115register_activation_hook( __FILE__, 'rbbqp_activate' );
    127 
    128116add_action( 'init', 'wp_pctc_admin_init' );
    129 function wp_pctc_admin_init() {
    130 
     117function wp_pctc_admin_init()
     118{
     119   
    131120    if ( is_admin() ) {
    132121        new Admin\Rbbqp_Admin_Ajax();
    133122        new Admin\Rbbqp_Settings();
    134123    }
    135 
     124   
    136125    new Inc\Rbbqp_Product_Helper();
    137 
    138126    if ( is_cart() ) {
    139127        new Inc\Rbbqp_Cart_Helper();
Note: See TracChangeset for help on using the changeset viewer.