Plugin Directory

Changeset 3440153


Ignore:
Timestamp:
01/15/2026 08:55:23 AM (8 weeks ago)
Author:
roadcubeapp
Message:

Released a new improved version with new message feature for non-logged-in users about earning points

Location:
roadcube
Files:
5 edited
16 copied

Legend:

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

    r3426984 r3440153  
    309309    color: black;
    310310    font-size: 18px;
     311  }
     312  .rc_pnts_prev .logout_pnts_msg {
     313    background-color: #80808017;
     314    padding: 10px;
     315    border-radius: 10px;
    311316  }
    312317  .rc_pro_points {
  • roadcube/tags/1.0.33/core/settings.php

    r3426984 r3440153  
    109109        if (isset($_POST['coupon_button_close_label'])) {
    110110            $sanitized_settings['coupon_button_close_label'] = sanitize_text_field($_POST['coupon_button_close_label']);
     111        }
     112
     113        if (isset($_POST['earn_points_msg_logout'])) {
     114            $sanitized_settings['earn_points_msg_logout'] = sanitize_text_field($_POST['earn_points_msg_logout']);
    111115        }
    112116
     
    358362                <input type="text" name="coupon_button_close_label" id="coupon_button_close_label" value="<?php echo esc_attr(Roadcube_Coupon_Claimer::roadcube_get_setting('coupon_button_close_label')); ?>">
    359363            </td>
    360         </tr> 
     364        </tr>
     365        <tr>
     366            <th><?php esc_html_e('Earn points message for non-logged-in customer','roadcube'); ?><p class="description">{POINTS} = reward points of an order</p></th>
     367            <td>
     368                <textarea rows="5" cols="20" name="earn_points_msg_logout" id="earn_points_msg_logout" placeholder="<?php esc_html_e('Ολοκλήρωσε την Παραγγελία σου και Κάνε Εγγραφή και Κέρδισε {POINTS} Πόντους για μελλοντική Έκπτωση','roadcube'); ?>"><?php echo esc_attr(Roadcube_Coupon_Claimer::roadcube_get_setting('earn_points_msg_logout')); ?></textarea>
     369            </td>
     370        </tr>
    361371        <tr>
    362372            <th><?php esc_html_e('Terms acceptance label','roadcube'); ?></th>
     
    398408        <tr>
    399409            <th><?php esc_html_e('Conversion API Token','roadcube'); ?></th>
    400             <td><input required placeholder="<?php esc_html_e('Conversion API Token','roadcube'); ?>" type="text" value="<?php echo esc_attr(Roadcube_Coupon_Claimer::roadcube_get_setting('conversion_api_token')); ?>" name="conversion_api_token"/></td>
     410            <td><input placeholder="<?php esc_html_e('Conversion API Token','roadcube'); ?>" type="text" value="<?php echo esc_attr(Roadcube_Coupon_Claimer::roadcube_get_setting('conversion_api_token')); ?>" name="conversion_api_token"/></td>
    401411        </tr>
    402412    </table>
  • roadcube/tags/1.0.33/core/woocommerce.php

    r3426984 r3440153  
    474474       'woocommerce/proceed-to-checkout-block',
    475475       'woocommerce/cart-accepted-payment-methods-block',
     476       'woocommerce/checkout-order-summary-block',
    476477    );
    477478    if ( in_array( $block['blockName'], $blocks ) ) {
     
    493494     // roadcube_user_coupons_waiting_list();
    494495 }
     496
     497 add_action('roadcube_before_woocommerce/checkout-order-summary-block', 'roadcube_cart_loyalty_button');
    495498
    496499 add_action('roadcube_after_woocommerce/cart-order-summary-coupon-form-block', 'roadcube_user_coupons_waiting_list');
     
    634637 }
    635638
     639function roadcube_logout_points_prev() {
     640    if(!is_user_logged_in()) {
     641        $won_points = 0;
     642        $trans_type = Roadcube_Coupon_Claimer::roadcube_get_setting('roadcube_create_transaction_settings') ?: 'amount';
     643        $subtotal = WC()->cart->get_subtotal() - WC()->cart->get_discount_total();
     644        $subtotal = floor($subtotal);
     645        if ($trans_type == 'amount') {
     646            $won_points += $subtotal;
     647        }
     648        else {
     649            foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
     650                $product_id = $cart_item['product_id'];
     651                $quantity = $cart_item['quantity'];
     652                $product = wc_get_product( $product_id );
     653                $product_data = get_post_meta($product_id, 'roadcube_product_created_data', true);
     654                if (isset($product_data['status']) && $product_data['status'] == 'success') {
     655                    $raw_price = floatval($product->get_price());
     656                    $price = floor(floatval($product->get_price()));
     657                    $points = intval($product_data['data']['product']['reward_points']);
     658                    $won_points += $price * $points;
     659                } else {
     660                    $points = 1;
     661                    $raw_price = floatval($product->get_price());
     662                    $price = floor(floatval($product->get_price()));
     663                    $won_points += $price * $points;
     664                }
     665            }
     666        }
     667
     668        if($won_points) {
     669            $pnts_msg_option = Roadcube_Coupon_Claimer::roadcube_get_setting('earn_points_msg_logout');
     670            if (empty($pnts_msg_option)) {
     671                $pnts_msg_option = 'Ολοκλήρωσε την Παραγγελία σου και Κάνε Εγγραφή και Κέρδισε {POINTS} Πόντους για μελλοντική Έκπτωση';
     672            }
     673
     674            $pnts_msg_option = str_replace('{POINTS}', $won_points, $pnts_msg_option);
     675            echo "<div class='rc_pnts_prev'><p class='logout_pnts_msg'>".esc_html__($pnts_msg_option)."</p></div>";
     676        }
     677    }
     678}
     679
    636680add_action( 'woocommerce_before_checkout_form', 'roadcube_add_param_to_session');
    637681
  • roadcube/tags/1.0.33/readme.txt

    r3430168 r3440153  
    33Description: Provides loyalty benefits to the customers of RoadCube members
    44Tags: roadcube, woocommerce, loyalty, rewards
    5 Version: 1.0.32
     5Version: 1.0.33
    66Requires at least: 5.2
    77Tested up to: 6.9
    8 Stable tag: 1.0.32
     8Stable tag: 1.0.33
    99License: GPLv2 or later
    1010Requires PHP: 7.2
     
    162162*Release Date - 31 December 2025*
    163163* Fixed applied coupon remove from waiting, DOB required, saved order points
     164
     165= 1.0.33 =
     166*Release Date - 15 January 2026*
     167* Added a message on cart and checkout about earning points in logout mode
  • roadcube/tags/1.0.33/roadcube.php

    r3430168 r3440153  
    55 * Description: Provides loyalty benefits to the customers of RoadCube members
    66 * Tags: roadcube, woocommerce, loyalty, rewards
    7  * Version: 1.0.32
     7 * Version: 1.0.33
    88 * Requires at least: 5.2
    99 * Tested up to: 6.9
    10  * Stable tag: 1.0.32
     10 * Stable tag: 1.0.33
    1111 * License: GPLv2 or later
    1212 * Requires at least: 5.2
     
    6666        }
    6767        function roadcube_loyalty_coupon_button_callback() {
     68            // To display points message if customer is not logged in
     69            roadcube_logout_points_prev();
    6870            if (!is_user_logged_in())
    6971                return ''; // Return nothing if the user is not logged in
  • roadcube/trunk/assets/css/style.css

    r3426984 r3440153  
    309309    color: black;
    310310    font-size: 18px;
     311  }
     312  .rc_pnts_prev .logout_pnts_msg {
     313    background-color: #80808017;
     314    padding: 10px;
     315    border-radius: 10px;
    311316  }
    312317  .rc_pro_points {
  • roadcube/trunk/core/settings.php

    r3426984 r3440153  
    109109        if (isset($_POST['coupon_button_close_label'])) {
    110110            $sanitized_settings['coupon_button_close_label'] = sanitize_text_field($_POST['coupon_button_close_label']);
     111        }
     112
     113        if (isset($_POST['earn_points_msg_logout'])) {
     114            $sanitized_settings['earn_points_msg_logout'] = sanitize_text_field($_POST['earn_points_msg_logout']);
    111115        }
    112116
     
    358362                <input type="text" name="coupon_button_close_label" id="coupon_button_close_label" value="<?php echo esc_attr(Roadcube_Coupon_Claimer::roadcube_get_setting('coupon_button_close_label')); ?>">
    359363            </td>
    360         </tr> 
     364        </tr>
     365        <tr>
     366            <th><?php esc_html_e('Earn points message for non-logged-in customer','roadcube'); ?><p class="description">{POINTS} = reward points of an order</p></th>
     367            <td>
     368                <textarea rows="5" cols="20" name="earn_points_msg_logout" id="earn_points_msg_logout" placeholder="<?php esc_html_e('Ολοκλήρωσε την Παραγγελία σου και Κάνε Εγγραφή και Κέρδισε {POINTS} Πόντους για μελλοντική Έκπτωση','roadcube'); ?>"><?php echo esc_attr(Roadcube_Coupon_Claimer::roadcube_get_setting('earn_points_msg_logout')); ?></textarea>
     369            </td>
     370        </tr>
    361371        <tr>
    362372            <th><?php esc_html_e('Terms acceptance label','roadcube'); ?></th>
     
    398408        <tr>
    399409            <th><?php esc_html_e('Conversion API Token','roadcube'); ?></th>
    400             <td><input required placeholder="<?php esc_html_e('Conversion API Token','roadcube'); ?>" type="text" value="<?php echo esc_attr(Roadcube_Coupon_Claimer::roadcube_get_setting('conversion_api_token')); ?>" name="conversion_api_token"/></td>
     410            <td><input placeholder="<?php esc_html_e('Conversion API Token','roadcube'); ?>" type="text" value="<?php echo esc_attr(Roadcube_Coupon_Claimer::roadcube_get_setting('conversion_api_token')); ?>" name="conversion_api_token"/></td>
    401411        </tr>
    402412    </table>
  • roadcube/trunk/core/woocommerce.php

    r3426984 r3440153  
    474474       'woocommerce/proceed-to-checkout-block',
    475475       'woocommerce/cart-accepted-payment-methods-block',
     476       'woocommerce/checkout-order-summary-block',
    476477    );
    477478    if ( in_array( $block['blockName'], $blocks ) ) {
     
    493494     // roadcube_user_coupons_waiting_list();
    494495 }
     496
     497 add_action('roadcube_before_woocommerce/checkout-order-summary-block', 'roadcube_cart_loyalty_button');
    495498
    496499 add_action('roadcube_after_woocommerce/cart-order-summary-coupon-form-block', 'roadcube_user_coupons_waiting_list');
     
    634637 }
    635638
     639function roadcube_logout_points_prev() {
     640    if(!is_user_logged_in()) {
     641        $won_points = 0;
     642        $trans_type = Roadcube_Coupon_Claimer::roadcube_get_setting('roadcube_create_transaction_settings') ?: 'amount';
     643        $subtotal = WC()->cart->get_subtotal() - WC()->cart->get_discount_total();
     644        $subtotal = floor($subtotal);
     645        if ($trans_type == 'amount') {
     646            $won_points += $subtotal;
     647        }
     648        else {
     649            foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
     650                $product_id = $cart_item['product_id'];
     651                $quantity = $cart_item['quantity'];
     652                $product = wc_get_product( $product_id );
     653                $product_data = get_post_meta($product_id, 'roadcube_product_created_data', true);
     654                if (isset($product_data['status']) && $product_data['status'] == 'success') {
     655                    $raw_price = floatval($product->get_price());
     656                    $price = floor(floatval($product->get_price()));
     657                    $points = intval($product_data['data']['product']['reward_points']);
     658                    $won_points += $price * $points;
     659                } else {
     660                    $points = 1;
     661                    $raw_price = floatval($product->get_price());
     662                    $price = floor(floatval($product->get_price()));
     663                    $won_points += $price * $points;
     664                }
     665            }
     666        }
     667
     668        if($won_points) {
     669            $pnts_msg_option = Roadcube_Coupon_Claimer::roadcube_get_setting('earn_points_msg_logout');
     670            if (empty($pnts_msg_option)) {
     671                $pnts_msg_option = 'Ολοκλήρωσε την Παραγγελία σου και Κάνε Εγγραφή και Κέρδισε {POINTS} Πόντους για μελλοντική Έκπτωση';
     672            }
     673
     674            $pnts_msg_option = str_replace('{POINTS}', $won_points, $pnts_msg_option);
     675            echo "<div class='rc_pnts_prev'><p class='logout_pnts_msg'>".esc_html__($pnts_msg_option)."</p></div>";
     676        }
     677    }
     678}
     679
    636680add_action( 'woocommerce_before_checkout_form', 'roadcube_add_param_to_session');
    637681
  • roadcube/trunk/readme.txt

    r3430168 r3440153  
    33Description: Provides loyalty benefits to the customers of RoadCube members
    44Tags: roadcube, woocommerce, loyalty, rewards
    5 Version: 1.0.32
     5Version: 1.0.33
    66Requires at least: 5.2
    77Tested up to: 6.9
    8 Stable tag: 1.0.32
     8Stable tag: 1.0.33
    99License: GPLv2 or later
    1010Requires PHP: 7.2
     
    162162*Release Date - 31 December 2025*
    163163* Fixed applied coupon remove from waiting, DOB required, saved order points
     164
     165= 1.0.33 =
     166*Release Date - 15 January 2026*
     167* Added a message on cart and checkout about earning points in logout mode
  • roadcube/trunk/roadcube.php

    r3430168 r3440153  
    55 * Description: Provides loyalty benefits to the customers of RoadCube members
    66 * Tags: roadcube, woocommerce, loyalty, rewards
    7  * Version: 1.0.32
     7 * Version: 1.0.33
    88 * Requires at least: 5.2
    99 * Tested up to: 6.9
    10  * Stable tag: 1.0.32
     10 * Stable tag: 1.0.33
    1111 * License: GPLv2 or later
    1212 * Requires at least: 5.2
     
    6666        }
    6767        function roadcube_loyalty_coupon_button_callback() {
     68            // To display points message if customer is not logged in
     69            roadcube_logout_points_prev();
    6870            if (!is_user_logged_in())
    6971                return ''; // Return nothing if the user is not logged in
Note: See TracChangeset for help on using the changeset viewer.