Plugin Directory

Changeset 3291971


Ignore:
Timestamp:
05/12/2025 02:53:31 PM (10 months ago)
Author:
roadcubeapp
Message:

Releasing new improved version 1.0.17 of roadcube plugin

Location:
roadcube
Files:
6 edited
13 copied

Legend:

Unmodified
Added
Removed
  • roadcube/tags/1.0.17/assets/css/style.css

    r3285435 r3291971  
    227227    align-items: center;
    228228    justify-content: space-evenly;
     229    position: relative;
    229230  }
    230231  .points-num {
     
    236237  .points-name {
    237238    color: black;
     239    text-align: center;
    238240  }
    239241  .btw-line {
     
    334336    margin-left: 8px;
    335337  }
     338  .rc-ref-loder {
     339    background-color: rgb(39 145 12);
     340    width: 30px;
     341    height: 30px;
     342    border-radius: 50%;
     343    display: flex;
     344    cursor: pointer;
     345    flex-direction: row;
     346    flex-wrap: nowrap;
     347    align-content: center;
     348    justify-content: center;
     349    align-items: center;
     350    position: absolute;
     351    top: -8px;
     352    left: -14px;
     353    transition: all 0.3s ease;
     354  }
     355  .refresh-loader {
     356    color: white;
     357    font-size: 16px;
     358  }
     359  .rc-ref-loder:hover {
     360    background-color: rgb(0, 150, 0);
     361    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
     362    transform: scale(1.05);
     363  }
  • roadcube/tags/1.0.17/assets/js/coupon_manager.js

    r3285435 r3291971  
    193193      });
    194194    });
     195    $(document).on("click", ".rc-ref-loder", function (e) {
     196      location.reload();
     197    });
    195198  });
    196199 
  • roadcube/tags/1.0.17/core/settings.php

    r3278755 r3291971  
    3737        if (isset($_POST['roacube_points_display_label'])) {
    3838            $sanitized_settings['roacube_points_display_label'] = sanitize_text_field($_POST['roacube_points_display_label']);
     39        }
     40
     41        if (isset($_POST['roacube_min_total_req'])) {
     42            $sanitized_settings['roacube_min_total_req'] = floatval(sanitize_text_field($_POST['roacube_min_total_req']));
    3943        }
    4044
     
    213217        </tr>
    214218        <tr>
     219            <th><?php esc_html_e('Min total to enable loyalty redemption','roadcube'); ?></th>
     220            <td>
     221                <input type="number" step="1" min="0" name="roacube_min_total_req" id="roacube_min_total_req" value="<?php echo esc_attr(Roadcube_Coupon_Claimer::roadcube_get_setting('roacube_min_total_req')); ?>">
     222            </td>
     223        </tr>
     224        <tr>
    215225            <th><?php esc_html_e('Multiply point with price','roadcube'); ?></th>
    216226            <td>
  • roadcube/tags/1.0.17/core/woocommerce.php

    r3285435 r3291971  
    1111    echo do_shortcode('[roadcube_loyalty_coupon_button]');
    1212    roadcube_user_coupons_waiting_list();
     13}
     14
     15add_action( 'woocommerce_before_calculate_totals', 'roadcube_validate_applied_coupon' );
     16
     17function roadcube_validate_applied_coupon( $cart ) {
     18    $min_total_req = Roadcube_Coupon_Claimer::roadcube_get_setting('roacube_min_total_req');
     19    $min_total_req = ($min_total_req) ? $min_total_req : 0;
     20    $claimed_coupon = '';
     21    $subtotal_excl_tax = 0;
     22    if ( WC()->session->get( 'rc_active_voucher' ) ) {
     23        $claimed_coupon = WC()->session->get( 'rc_active_voucher' );
     24    }
     25
     26    $subtotal_excl_tax = 0;
     27    foreach ( $cart->get_cart() as $cart_item_key => $cart_item ) {
     28        $product = $cart_item['data'];
     29        $prc = $product->get_price();
     30        $subtotal = ( $prc * $cart_item['quantity'] );
     31        $subtotal_excl_tax += $subtotal;
     32    }
     33    if ( $subtotal_excl_tax < $min_total_req && !empty( $claimed_coupon ) ) {
     34        if ( $cart->has_discount( $claimed_coupon['voucher'] ) ) {
     35            $cart->remove_coupon( $claimed_coupon['voucher'] );
     36            $cart->calculate_totals();
     37            WC()->session->__unset( 'rc_active_voucher' );
     38        }
     39    }
    1340}
    1441
     
    250277
    251278function roadcube_create_woocommerce_coupon($coupon_code, $discount_type, $coupon_data) {
     279    // Check min total requirement
     280    $min_total_req = Roadcube_Coupon_Claimer::roadcube_get_setting('roacube_min_total_req');
     281    $min_total_req = ($min_total_req) ? $min_total_req : 0;
     282    if(WC()->cart->subtotal_ex_tax < $min_total_req) {
     283        return false;
     284    }
     285
    252286    // Check if the coupon already exists
    253287    if ( !empty($discount_type)) {
     
    332366     $rc_active_flag = "";
    333367     $disp_cost_type = "";
     368
     369     // Check min total requirement
     370     $min_total_req = Roadcube_Coupon_Claimer::roadcube_get_setting('roacube_min_total_req');
     371     $min_total_req = ($min_total_req) ? $min_total_req : 0;
     372     if(WC()->cart->subtotal_ex_tax < $min_total_req) {
     373        return;
     374     }
     375 
    334376     if($claimed_coupons) {
    335377         $otpt = "<div class='rc_cpn-wtn-head'><p class='rc_cpn-wtn-p'>coupons waiting:</p><ul class='rc_ul-cpn-wtn'>";
     
    369411     $user_id = get_current_user_id();
    370412     if(!$user_id)
    371          return;
     413        return;
     414     $won_points = '';
    372415     $user_data = get_userdata( $user_id );
    373416     $user_email = $user_data->user_email;
  • roadcube/tags/1.0.17/readme.txt

    r3289144 r3291971  
    33Description: Provides loyalty benefits to the customers of RoadCube members
    44Tags: roadcube, woocommerce, loyalty, rewards
    5 Version: 1.0.16
     5Version: 1.0.17
    66Requires at least: 5.2
    77Tested up to: 6.7.1
    8 Stable tag: 1.0.16
     8Stable tag: 1.0.17
    99License: GPLv2 or later
    1010Requires PHP: 7.2
     
    9898*Release Date - 07 May 2025*
    9999* message to show first earning points fixed
     100
     101= 1.0.17 =
     102*Release Date - 12 May 2025*
     103* introduced new settings for minimum order total to be eligible for loyalty coupons redemption, on cart update applied coupon eligibility check bug fixed
  • roadcube/tags/1.0.17/roadcube.php

    r3289144 r3291971  
    55 * Description: Provides loyalty benefits to the customers of RoadCube members
    66 * Tags: roadcube, woocommerce, loyalty, rewards
    7  * Version: 1.0.16
     7 * Version: 1.0.17
    88 * Requires at least: 5.2
    99 * Tested up to: 6.7.1
    10  * Stable tag: 1.0.16
     10 * Stable tag: 1.0.17
    1111 * License: GPLv2 or later
    1212 * Requires at least: 5.2
     
    7474            $wrap_points_box = '';
    7575            $points_needed = '';
     76            $min_total_req = Roadcube_Coupon_Claimer::roadcube_get_setting('roacube_min_total_req');
     77            $min_total_req = ($min_total_req) ? $min_total_req : 0;
    7678
    7779            // Getting available gifts information
     
    105107                if($points_needed) {
    106108                    $wrap_points_box = "<div class='parentDiv-txt'>".esc_attr__('You need to +'.$points_needed.' points to get your first gift', 'roadcube')."</div>";
     109                }
     110                elseif(WC()->cart->subtotal_ex_tax < $min_total_req) {
     111                    $cur_symb = get_woocommerce_currency_symbol();
     112                    $wrap_points_box = "<div class='parentDiv-txt'>".esc_attr__($cur_symb.$min_total_req.' total to unlock loyalty benefits', 'roadcube')."</div>";
    107113                }
    108114                else {
     
    126132            } ?>
    127133            <div class="ro-points">
     134            <div class="rc-ref-loder" title="<?php esc_attr_e('Refresh loyalty contents','roadcube'); ?>"><i class="fas fa-sync-alt refresh-loader"></i></div>
    128135                <div class="points-only">
    129136                    <div class="points-num"><?php echo esc_html($point_user); ?></div>
  • roadcube/trunk/assets/css/style.css

    r3285435 r3291971  
    227227    align-items: center;
    228228    justify-content: space-evenly;
     229    position: relative;
    229230  }
    230231  .points-num {
     
    236237  .points-name {
    237238    color: black;
     239    text-align: center;
    238240  }
    239241  .btw-line {
     
    334336    margin-left: 8px;
    335337  }
     338  .rc-ref-loder {
     339    background-color: rgb(39 145 12);
     340    width: 30px;
     341    height: 30px;
     342    border-radius: 50%;
     343    display: flex;
     344    cursor: pointer;
     345    flex-direction: row;
     346    flex-wrap: nowrap;
     347    align-content: center;
     348    justify-content: center;
     349    align-items: center;
     350    position: absolute;
     351    top: -8px;
     352    left: -14px;
     353    transition: all 0.3s ease;
     354  }
     355  .refresh-loader {
     356    color: white;
     357    font-size: 16px;
     358  }
     359  .rc-ref-loder:hover {
     360    background-color: rgb(0, 150, 0);
     361    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
     362    transform: scale(1.05);
     363  }
  • roadcube/trunk/assets/js/coupon_manager.js

    r3285435 r3291971  
    193193      });
    194194    });
     195    $(document).on("click", ".rc-ref-loder", function (e) {
     196      location.reload();
     197    });
    195198  });
    196199 
  • roadcube/trunk/core/settings.php

    r3278755 r3291971  
    3737        if (isset($_POST['roacube_points_display_label'])) {
    3838            $sanitized_settings['roacube_points_display_label'] = sanitize_text_field($_POST['roacube_points_display_label']);
     39        }
     40
     41        if (isset($_POST['roacube_min_total_req'])) {
     42            $sanitized_settings['roacube_min_total_req'] = floatval(sanitize_text_field($_POST['roacube_min_total_req']));
    3943        }
    4044
     
    213217        </tr>
    214218        <tr>
     219            <th><?php esc_html_e('Min total to enable loyalty redemption','roadcube'); ?></th>
     220            <td>
     221                <input type="number" step="1" min="0" name="roacube_min_total_req" id="roacube_min_total_req" value="<?php echo esc_attr(Roadcube_Coupon_Claimer::roadcube_get_setting('roacube_min_total_req')); ?>">
     222            </td>
     223        </tr>
     224        <tr>
    215225            <th><?php esc_html_e('Multiply point with price','roadcube'); ?></th>
    216226            <td>
  • roadcube/trunk/core/woocommerce.php

    r3285435 r3291971  
    1111    echo do_shortcode('[roadcube_loyalty_coupon_button]');
    1212    roadcube_user_coupons_waiting_list();
     13}
     14
     15add_action( 'woocommerce_before_calculate_totals', 'roadcube_validate_applied_coupon' );
     16
     17function roadcube_validate_applied_coupon( $cart ) {
     18    $min_total_req = Roadcube_Coupon_Claimer::roadcube_get_setting('roacube_min_total_req');
     19    $min_total_req = ($min_total_req) ? $min_total_req : 0;
     20    $claimed_coupon = '';
     21    $subtotal_excl_tax = 0;
     22    if ( WC()->session->get( 'rc_active_voucher' ) ) {
     23        $claimed_coupon = WC()->session->get( 'rc_active_voucher' );
     24    }
     25
     26    $subtotal_excl_tax = 0;
     27    foreach ( $cart->get_cart() as $cart_item_key => $cart_item ) {
     28        $product = $cart_item['data'];
     29        $prc = $product->get_price();
     30        $subtotal = ( $prc * $cart_item['quantity'] );
     31        $subtotal_excl_tax += $subtotal;
     32    }
     33    if ( $subtotal_excl_tax < $min_total_req && !empty( $claimed_coupon ) ) {
     34        if ( $cart->has_discount( $claimed_coupon['voucher'] ) ) {
     35            $cart->remove_coupon( $claimed_coupon['voucher'] );
     36            $cart->calculate_totals();
     37            WC()->session->__unset( 'rc_active_voucher' );
     38        }
     39    }
    1340}
    1441
     
    250277
    251278function roadcube_create_woocommerce_coupon($coupon_code, $discount_type, $coupon_data) {
     279    // Check min total requirement
     280    $min_total_req = Roadcube_Coupon_Claimer::roadcube_get_setting('roacube_min_total_req');
     281    $min_total_req = ($min_total_req) ? $min_total_req : 0;
     282    if(WC()->cart->subtotal_ex_tax < $min_total_req) {
     283        return false;
     284    }
     285
    252286    // Check if the coupon already exists
    253287    if ( !empty($discount_type)) {
     
    332366     $rc_active_flag = "";
    333367     $disp_cost_type = "";
     368
     369     // Check min total requirement
     370     $min_total_req = Roadcube_Coupon_Claimer::roadcube_get_setting('roacube_min_total_req');
     371     $min_total_req = ($min_total_req) ? $min_total_req : 0;
     372     if(WC()->cart->subtotal_ex_tax < $min_total_req) {
     373        return;
     374     }
     375 
    334376     if($claimed_coupons) {
    335377         $otpt = "<div class='rc_cpn-wtn-head'><p class='rc_cpn-wtn-p'>coupons waiting:</p><ul class='rc_ul-cpn-wtn'>";
     
    369411     $user_id = get_current_user_id();
    370412     if(!$user_id)
    371          return;
     413        return;
     414     $won_points = '';
    372415     $user_data = get_userdata( $user_id );
    373416     $user_email = $user_data->user_email;
  • roadcube/trunk/readme.txt

    r3289144 r3291971  
    33Description: Provides loyalty benefits to the customers of RoadCube members
    44Tags: roadcube, woocommerce, loyalty, rewards
    5 Version: 1.0.16
     5Version: 1.0.17
    66Requires at least: 5.2
    77Tested up to: 6.7.1
    8 Stable tag: 1.0.16
     8Stable tag: 1.0.17
    99License: GPLv2 or later
    1010Requires PHP: 7.2
     
    9898*Release Date - 07 May 2025*
    9999* message to show first earning points fixed
     100
     101= 1.0.17 =
     102*Release Date - 12 May 2025*
     103* introduced new settings for minimum order total to be eligible for loyalty coupons redemption, on cart update applied coupon eligibility check bug fixed
  • roadcube/trunk/roadcube.php

    r3289144 r3291971  
    55 * Description: Provides loyalty benefits to the customers of RoadCube members
    66 * Tags: roadcube, woocommerce, loyalty, rewards
    7  * Version: 1.0.16
     7 * Version: 1.0.17
    88 * Requires at least: 5.2
    99 * Tested up to: 6.7.1
    10  * Stable tag: 1.0.16
     10 * Stable tag: 1.0.17
    1111 * License: GPLv2 or later
    1212 * Requires at least: 5.2
     
    7474            $wrap_points_box = '';
    7575            $points_needed = '';
     76            $min_total_req = Roadcube_Coupon_Claimer::roadcube_get_setting('roacube_min_total_req');
     77            $min_total_req = ($min_total_req) ? $min_total_req : 0;
    7678
    7779            // Getting available gifts information
     
    105107                if($points_needed) {
    106108                    $wrap_points_box = "<div class='parentDiv-txt'>".esc_attr__('You need to +'.$points_needed.' points to get your first gift', 'roadcube')."</div>";
     109                }
     110                elseif(WC()->cart->subtotal_ex_tax < $min_total_req) {
     111                    $cur_symb = get_woocommerce_currency_symbol();
     112                    $wrap_points_box = "<div class='parentDiv-txt'>".esc_attr__($cur_symb.$min_total_req.' total to unlock loyalty benefits', 'roadcube')."</div>";
    107113                }
    108114                else {
     
    126132            } ?>
    127133            <div class="ro-points">
     134            <div class="rc-ref-loder" title="<?php esc_attr_e('Refresh loyalty contents','roadcube'); ?>"><i class="fas fa-sync-alt refresh-loader"></i></div>
    128135                <div class="points-only">
    129136                    <div class="points-num"><?php echo esc_html($point_user); ?></div>
Note: See TracChangeset for help on using the changeset viewer.