Changeset 3291971
- Timestamp:
- 05/12/2025 02:53:31 PM (10 months ago)
- Location:
- roadcube
- Files:
-
- 6 edited
- 13 copied
-
tags/1.0.17 (copied) (copied from roadcube/trunk)
-
tags/1.0.17/assets/css/admin_style.css (copied) (copied from roadcube/trunk/assets/css/admin_style.css)
-
tags/1.0.17/assets/css/style.css (copied) (copied from roadcube/trunk/assets/css/style.css) (3 diffs)
-
tags/1.0.17/assets/js/coupon_manager.js (copied) (copied from roadcube/trunk/assets/js/coupon_manager.js) (1 diff)
-
tags/1.0.17/assets/js/script.js (copied) (copied from roadcube/trunk/assets/js/script.js)
-
tags/1.0.17/core/ajax_handle.php (copied) (copied from roadcube/trunk/core/ajax_handle.php)
-
tags/1.0.17/core/api.php (copied) (copied from roadcube/trunk/core/api.php)
-
tags/1.0.17/core/settings.php (copied) (copied from roadcube/trunk/core/settings.php) (2 diffs)
-
tags/1.0.17/core/user_meta_field.php (copied) (copied from roadcube/trunk/core/user_meta_field.php)
-
tags/1.0.17/core/woocommerce.php (copied) (copied from roadcube/trunk/core/woocommerce.php) (4 diffs)
-
tags/1.0.17/readme.txt (copied) (copied from roadcube/trunk/readme.txt) (2 diffs)
-
tags/1.0.17/roadcube.php (copied) (copied from roadcube/trunk/roadcube.php) (4 diffs)
-
tags/1.0.17/templates/get_user_points.php (copied) (copied from roadcube/trunk/templates/get_user_points.php)
-
trunk/assets/css/style.css (modified) (3 diffs)
-
trunk/assets/js/coupon_manager.js (modified) (1 diff)
-
trunk/core/settings.php (modified) (2 diffs)
-
trunk/core/woocommerce.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/roadcube.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
roadcube/tags/1.0.17/assets/css/style.css
r3285435 r3291971 227 227 align-items: center; 228 228 justify-content: space-evenly; 229 position: relative; 229 230 } 230 231 .points-num { … … 236 237 .points-name { 237 238 color: black; 239 text-align: center; 238 240 } 239 241 .btw-line { … … 334 336 margin-left: 8px; 335 337 } 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 193 193 }); 194 194 }); 195 $(document).on("click", ".rc-ref-loder", function (e) { 196 location.reload(); 197 }); 195 198 }); 196 199 -
roadcube/tags/1.0.17/core/settings.php
r3278755 r3291971 37 37 if (isset($_POST['roacube_points_display_label'])) { 38 38 $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'])); 39 43 } 40 44 … … 213 217 </tr> 214 218 <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> 215 225 <th><?php esc_html_e('Multiply point with price','roadcube'); ?></th> 216 226 <td> -
roadcube/tags/1.0.17/core/woocommerce.php
r3285435 r3291971 11 11 echo do_shortcode('[roadcube_loyalty_coupon_button]'); 12 12 roadcube_user_coupons_waiting_list(); 13 } 14 15 add_action( 'woocommerce_before_calculate_totals', 'roadcube_validate_applied_coupon' ); 16 17 function 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 } 13 40 } 14 41 … … 250 277 251 278 function 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 252 286 // Check if the coupon already exists 253 287 if ( !empty($discount_type)) { … … 332 366 $rc_active_flag = ""; 333 367 $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 334 376 if($claimed_coupons) { 335 377 $otpt = "<div class='rc_cpn-wtn-head'><p class='rc_cpn-wtn-p'>coupons waiting:</p><ul class='rc_ul-cpn-wtn'>"; … … 369 411 $user_id = get_current_user_id(); 370 412 if(!$user_id) 371 return; 413 return; 414 $won_points = ''; 372 415 $user_data = get_userdata( $user_id ); 373 416 $user_email = $user_data->user_email; -
roadcube/tags/1.0.17/readme.txt
r3289144 r3291971 3 3 Description: Provides loyalty benefits to the customers of RoadCube members 4 4 Tags: roadcube, woocommerce, loyalty, rewards 5 Version: 1.0.1 65 Version: 1.0.17 6 6 Requires at least: 5.2 7 7 Tested up to: 6.7.1 8 Stable tag: 1.0.1 68 Stable tag: 1.0.17 9 9 License: GPLv2 or later 10 10 Requires PHP: 7.2 … … 98 98 *Release Date - 07 May 2025* 99 99 * 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 5 5 * Description: Provides loyalty benefits to the customers of RoadCube members 6 6 * Tags: roadcube, woocommerce, loyalty, rewards 7 * Version: 1.0.1 67 * Version: 1.0.17 8 8 * Requires at least: 5.2 9 9 * Tested up to: 6.7.1 10 * Stable tag: 1.0.1 610 * Stable tag: 1.0.17 11 11 * License: GPLv2 or later 12 12 * Requires at least: 5.2 … … 74 74 $wrap_points_box = ''; 75 75 $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; 76 78 77 79 // Getting available gifts information … … 105 107 if($points_needed) { 106 108 $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>"; 107 113 } 108 114 else { … … 126 132 } ?> 127 133 <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> 128 135 <div class="points-only"> 129 136 <div class="points-num"><?php echo esc_html($point_user); ?></div> -
roadcube/trunk/assets/css/style.css
r3285435 r3291971 227 227 align-items: center; 228 228 justify-content: space-evenly; 229 position: relative; 229 230 } 230 231 .points-num { … … 236 237 .points-name { 237 238 color: black; 239 text-align: center; 238 240 } 239 241 .btw-line { … … 334 336 margin-left: 8px; 335 337 } 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 193 193 }); 194 194 }); 195 $(document).on("click", ".rc-ref-loder", function (e) { 196 location.reload(); 197 }); 195 198 }); 196 199 -
roadcube/trunk/core/settings.php
r3278755 r3291971 37 37 if (isset($_POST['roacube_points_display_label'])) { 38 38 $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'])); 39 43 } 40 44 … … 213 217 </tr> 214 218 <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> 215 225 <th><?php esc_html_e('Multiply point with price','roadcube'); ?></th> 216 226 <td> -
roadcube/trunk/core/woocommerce.php
r3285435 r3291971 11 11 echo do_shortcode('[roadcube_loyalty_coupon_button]'); 12 12 roadcube_user_coupons_waiting_list(); 13 } 14 15 add_action( 'woocommerce_before_calculate_totals', 'roadcube_validate_applied_coupon' ); 16 17 function 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 } 13 40 } 14 41 … … 250 277 251 278 function 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 252 286 // Check if the coupon already exists 253 287 if ( !empty($discount_type)) { … … 332 366 $rc_active_flag = ""; 333 367 $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 334 376 if($claimed_coupons) { 335 377 $otpt = "<div class='rc_cpn-wtn-head'><p class='rc_cpn-wtn-p'>coupons waiting:</p><ul class='rc_ul-cpn-wtn'>"; … … 369 411 $user_id = get_current_user_id(); 370 412 if(!$user_id) 371 return; 413 return; 414 $won_points = ''; 372 415 $user_data = get_userdata( $user_id ); 373 416 $user_email = $user_data->user_email; -
roadcube/trunk/readme.txt
r3289144 r3291971 3 3 Description: Provides loyalty benefits to the customers of RoadCube members 4 4 Tags: roadcube, woocommerce, loyalty, rewards 5 Version: 1.0.1 65 Version: 1.0.17 6 6 Requires at least: 5.2 7 7 Tested up to: 6.7.1 8 Stable tag: 1.0.1 68 Stable tag: 1.0.17 9 9 License: GPLv2 or later 10 10 Requires PHP: 7.2 … … 98 98 *Release Date - 07 May 2025* 99 99 * 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 5 5 * Description: Provides loyalty benefits to the customers of RoadCube members 6 6 * Tags: roadcube, woocommerce, loyalty, rewards 7 * Version: 1.0.1 67 * Version: 1.0.17 8 8 * Requires at least: 5.2 9 9 * Tested up to: 6.7.1 10 * Stable tag: 1.0.1 610 * Stable tag: 1.0.17 11 11 * License: GPLv2 or later 12 12 * Requires at least: 5.2 … … 74 74 $wrap_points_box = ''; 75 75 $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; 76 78 77 79 // Getting available gifts information … … 105 107 if($points_needed) { 106 108 $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>"; 107 113 } 108 114 else { … … 126 132 } ?> 127 133 <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> 128 135 <div class="points-only"> 129 136 <div class="points-num"><?php echo esc_html($point_user); ?></div>
Note: See TracChangeset
for help on using the changeset viewer.