Plugin Directory

Changeset 3217602


Ignore:
Timestamp:
01/06/2025 10:54:58 AM (15 months ago)
Author:
connectordev
Message:

3.1.611.54

*Release Date - 6 Jan 2025*

Fixed the issue in which cart page was breaking when backend configuration.
Fixed the issue in which functionality was breaking oncart page due to "new line item".

Location:
bloyal/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • bloyal/trunk/bloyal.php

    r3188477 r3217602  
    44 * Plugin URI:
    55 * Description: bLoyal provides real-time customer loyalty and omni-channel order processing to your WooCommerce web store.
    6  * Version: 3.1.611.51
     6 * Version: 3.1.611.54
    77 * Author:  bLoyal
    88 */
     
    19311931function bloyal_custom_shipping_checkout_fields( $fields ) {
    19321932    try {
    1933         global $current_user;
    1934         $otherAddrs                       = array();
    1935         $objectMultipleShippingController = new BLOYAL_MultipleShippingAddressController();
    1936         $current_user                     = wp_get_current_user();
    1937         if ( ! empty( $current_user ) ) {
    1938             $loggedin_customer_id    = isset( $current_user->ID ) && ( $current_user->ID ) ? $current_user->ID : '';
    1939             $loggedin_customer_email = isset( $current_user->user_email ) && ( $current_user->user_email ) ? $current_user->user_email : '';
    1940         }
    1941         $addrs_count                    = 0;
    1942         $formatted_cust_bill_birth_date = ''; // define this variable to avoid the warnings (03-04-2024)
    1943         $isDisplayPhone                 = get_option( 'bloyal_display_Phone' );
    1944         $isRequiredPhone                = get_option( 'bloyal_required_Phone' );
    1945         $isDisplayEmail                 = get_option( 'bloyal_display_Email' );
    1946         $isRequiredEmail                = get_option( 'bloyal_required_Email' );
    1947         $isDisplayOrderComments         = get_option( 'bloyal_display_order_comments' );
    1948         $isDisplayAddressBook           = get_option( 'bloyal_display_address_Book' );
    1949         // resolved warnings for undefined varriable
    1950         $customer_Fname        = '';
    1951         $customer_Lname        = '';
    1952         $customer_Address1     = '';
    1953         $customer_Address2     = '';
    1954         $customer_City         = '';
    1955         $customer_StateName    = '';
    1956         $customer_EmailAddress = '';
    1957         $customer_MobilePhone  = '';
    1958         $customer_PostalCode   = '';
    1959         $customer_Comp_name    = '';
    1960         $customer_CountryName  = '';
    1961         if ( 'true' == $isDisplayAddressBook ) {
    1962             $cart_data             = WC()->session->get( 'bloyal_cart_data' );
    1963             $customer_uid          = '';
    1964             $customer_code         = '';
     1933        if ( is_checkout() || ( is_cart() ) ) {
     1934            global $current_user;
     1935            $otherAddrs                       = array();
     1936            $objectMultipleShippingController = new BLOYAL_MultipleShippingAddressController();
     1937            $current_user                     = wp_get_current_user();
     1938            if ( ! empty( $current_user ) ) {
     1939                $loggedin_customer_id    = isset( $current_user->ID ) && ( $current_user->ID ) ? $current_user->ID : '';
     1940                $loggedin_customer_email = isset( $current_user->user_email ) && ( $current_user->user_email ) ? $current_user->user_email : '';
     1941            }
     1942            $addrs_count                    = 0;
     1943            $formatted_cust_bill_birth_date = ''; // define this variable to avoid the warnings (03-04-2024)
     1944            $isDisplayPhone                 = get_option( 'bloyal_display_Phone' );
     1945            $isRequiredPhone                = get_option( 'bloyal_required_Phone' );
     1946            $isDisplayEmail                 = get_option( 'bloyal_display_Email' );
     1947            $isRequiredEmail                = get_option( 'bloyal_required_Email' );
     1948            $isDisplayOrderComments         = get_option( 'bloyal_display_order_comments' );
     1949            $isDisplayAddressBook           = get_option( 'bloyal_display_address_Book' );
     1950            // resolved warnings for undefined varriable
    19651951            $customer_Fname        = '';
    19661952            $customer_Lname        = '';
    1967             $customer_Comp_name    = '';
    19681953            $customer_Address1     = '';
    19691954            $customer_Address2     = '';
    19701955            $customer_City         = '';
    1971             $customer_State        = '';
     1956            $customer_StateName    = '';
     1957            $customer_EmailAddress = '';
     1958            $customer_MobilePhone  = '';
    19721959            $customer_PostalCode   = '';
    1973             $customer_Country      = '';
    1974             $customer_StateCode    = '';
    1975             $customer_StateName    = '';
    1976             $customer_CountryCode  = '';
     1960            $customer_Comp_name    = '';
    19771961            $customer_CountryName  = '';
    1978             $customer_MobilePhone  = '';
    1979             $customer_EmailAddress = '';
    1980             $customer_BirthDate    = '';
    1981             if ( ! empty( $cart_data ) ) {
    1982                 $customer_uid  = $cart_data->Cart->Customer->Uid;
    1983                 $customer_code = $cart_data->Cart->Customer->Code;
    1984                 // code to get calculatecart customer information (Start)
    1985                 $customer_Fname        = $cart_data->Cart->Customer->FirstName;
    1986                 $customer_Lname        = $cart_data->Cart->Customer->LastName;
    1987                 $customer_Comp_name    = $cart_data->Cart->Customer->CompanyName;
    1988                 $customer_Address1     = $cart_data->Cart->Customer->Address->Address1;
    1989                 $customer_Address2     = $cart_data->Cart->Customer->Address->Address2;
    1990                 $customer_City         = $cart_data->Cart->Customer->Address->City;
    1991                 $customer_State        = $cart_data->Cart->Customer->Address->State;
    1992                 $customer_PostalCode   = $cart_data->Cart->Customer->Address->PostalCode;
    1993                 $customer_Country      = $cart_data->Cart->Customer->Address->Country;
    1994                 $customer_StateCode    = $cart_data->Cart->Customer->Address->StateCode;
    1995                 $customer_StateName    = $cart_data->Cart->Customer->Address->StateName;
    1996                 $customer_CountryCode  = $cart_data->Cart->Customer->Address->CountryCode;
    1997                 $customer_CountryName  = $cart_data->Cart->Customer->Address->CountryName;
    1998                 $customer_MobilePhone  = $cart_data->Cart->Customer->MobilePhone;
    1999                 $customer_EmailAddress = $cart_data->Cart->Customer->EmailAddress;
    2000                 $customer_BirthDate    = $cart_data->Cart->Customer->BirthDate;
    2001             }
    2002 
    2003             if ( null != $customer_BirthDate && '' != $customer_BirthDate ) {
    2004                 $dateTime                       = new DateTime( $customer_BirthDate );
    2005                 $formatted_cust_bill_birth_date = $dateTime->format( 'Y-m-d' );
    2006             }
    2007             // code to get calculatecart customer information (end)
    2008 
    2009             $saved_addrs       = $objectMultipleShippingController->get_multiple_shipping_addresses( $customer_uid, $customer_code );
    2010             $saved_addresses   = wp_json_encode( $saved_addrs );
    2011             $saved_addresses   = json_decode( $saved_addresses, true );
    2012             $total_saved_addrs = 0; // define variable to avoid warnings
    2013             if ( $saved_addresses['status'] == 'success' ) {
    2014                 $total_saved_addrs = count( $saved_addresses['data'] );
    2015             }
    2016             $addresses    = array();
    2017             $addresses[0] = __( 'Please Configure shipping address..', 'woocommerce' );
    2018             if ( ! empty( $saved_addrs ) ) {
    2019                 $addresses[0] = __( 'Select an address...', 'woocommerce' );
    2020                 for ( $addrs_count = 0; $addrs_count < $total_saved_addrs; $addrs_count++ ) {
    2021                     $addresses[ $addrs_count + 1 ] = $saved_addresses['data'][ $addrs_count ]['Title'];
    2022                 }
    2023             }
    2024             $alt_field          = array(
    2025                 'label'    => __( 'Saved addresses', 'woocommerce' ),
    2026                 'required' => false,
    2027                 'class'    => array( 'form-row' ),
    2028                 'clear'    => true,
    2029                 'type'     => 'select',
    2030                 'priority' => 1,
    2031                 'options'  => $addresses,
    2032             );
    2033             $alt_save_address   = array(
    2034                 'label'    => __( 'Save this Address', 'woocommerce' ),
    2035                 'id'       => 'save_address_checkbox',
    2036                 'name'     => 'save_address_checkbox',
    2037                 'type'     => 'checkbox',
    2038                 'priority' => 2,
    2039                 'class'    => array( 'form-row' ),
    2040             );
    2041             $fields['shipping'] = bloyal_array_unshift_assoc( $fields['shipping'], 'alt_save_address', $alt_save_address );
    2042             $fields['shipping'] = bloyal_array_unshift_assoc( $fields['shipping'], 'shipping_alt', $alt_field );
    2043         }
    2044         if ( 'true' == $isDisplayPhone ) {
    2045             $fields['shipping']['shipping_phone'] = array(
    2046                 'type'     => 'text',
    2047                 'label'    => __( 'Phone', 'woocommerce' ),
    2048                 'clear'    => false,
    2049                 'validate' => array( 'phone' ),
    2050                 'required' => 'true' == $isRequiredPhone ? true : false,
    2051                 'priority' => 110,
    2052             );
    2053         }
    2054         if ( 'true' == $isDisplayEmail ) {
    2055             $fields['shipping']['shipping_email'] = array(
    2056                 'type'     => 'email',
    2057                 'label'    => __( 'Email address', 'woocommerce' ),
    2058                 'clear'    => false,
    2059                 'validate' => array( 'email' ),
    2060                 'required' => 'true' == $isRequiredEmail ? true : false,
    2061                 'priority' => 120,
    2062             );
    2063         }
    2064         if ( 'true' == $isDisplayOrderComments ) {
    2065             $fields['billing']['order_comments2'] = array(
    2066                 'type'     => 'text',
    2067                 'label'    => __( 'Order Instructions', 'woocommerce' ),
    2068                 'clear'    => false,
    2069                 'required' => false,
    2070                 'priority' => 130,
    2071             );
    2072             add_filter( 'woocommerce_enable_order_notes_field', '__return_false' );
    2073         }
    2074         // code to set bLoyal calculatecart customer information on checkout page (start)
    2075         $fields['billing']['billing_first_name']['default'] = $customer_Fname;
    2076         $fields['billing']['billing_last_name']['default']  = $customer_Lname;
    2077         $fields['billing']['billing_address_1']['default']  = $customer_Address1;
    2078         $fields['billing']['billing_address_2']['default']  = $customer_Address2;
    2079         $fields['billing']['billing_city']['default']       = $customer_City;
    2080         $fields['billing']['billing_state']['default']      = $customer_StateName;
    2081         $fields['billing']['billing_email']['default']      = $customer_EmailAddress;
    2082         $fields['billing']['billing_phone']['default']      = $customer_MobilePhone;
    2083         $fields['billing']['billing_postcode']['default']   = $customer_PostalCode;
    2084         $fields['billing']['billing_company']['default']    = $customer_Comp_name;
    2085         $fields['billing']['billing_country']['default']    = $customer_CountryName;
    2086         $fields['billing']['billing_birth_date']['default'] = $formatted_cust_bill_birth_date;
    2087         // code to set bLoyal calculatecart customer information on checkout page (end)
    2088         return $fields;
     1962            if ( 'true' == $isDisplayAddressBook ) {
     1963                $cart_data             = WC()->session->get( 'bloyal_cart_data' );
     1964                $customer_uid          = '';
     1965                $customer_code         = '';
     1966                $customer_Fname        = '';
     1967                $customer_Lname        = '';
     1968                $customer_Comp_name    = '';
     1969                $customer_Address1     = '';
     1970                $customer_Address2     = '';
     1971                $customer_City         = '';
     1972                $customer_State        = '';
     1973                $customer_PostalCode   = '';
     1974                $customer_Country      = '';
     1975                $customer_StateCode    = '';
     1976                $customer_StateName    = '';
     1977                $customer_CountryCode  = '';
     1978                $customer_CountryName  = '';
     1979                $customer_MobilePhone  = '';
     1980                $customer_EmailAddress = '';
     1981                $customer_BirthDate    = '';
     1982                if ( ! empty( $cart_data ) ) {
     1983                    $customer_uid  = $cart_data->Cart->Customer->Uid;
     1984                    $customer_code = $cart_data->Cart->Customer->Code;
     1985                    // code to get calculatecart customer information (Start)
     1986                    $customer_Fname        = $cart_data->Cart->Customer->FirstName;
     1987                    $customer_Lname        = $cart_data->Cart->Customer->LastName;
     1988                    $customer_Comp_name    = $cart_data->Cart->Customer->CompanyName;
     1989                    $customer_Address1     = $cart_data->Cart->Customer->Address->Address1;
     1990                    $customer_Address2     = $cart_data->Cart->Customer->Address->Address2;
     1991                    $customer_City         = $cart_data->Cart->Customer->Address->City;
     1992                    $customer_State        = $cart_data->Cart->Customer->Address->State;
     1993                    $customer_PostalCode   = $cart_data->Cart->Customer->Address->PostalCode;
     1994                    $customer_Country      = $cart_data->Cart->Customer->Address->Country;
     1995                    $customer_StateCode    = $cart_data->Cart->Customer->Address->StateCode;
     1996                    $customer_StateName    = $cart_data->Cart->Customer->Address->StateName;
     1997                    $customer_CountryCode  = $cart_data->Cart->Customer->Address->CountryCode;
     1998                    $customer_CountryName  = $cart_data->Cart->Customer->Address->CountryName;
     1999                    $customer_MobilePhone  = $cart_data->Cart->Customer->MobilePhone;
     2000                    $customer_EmailAddress = $cart_data->Cart->Customer->EmailAddress;
     2001                    $customer_BirthDate    = $cart_data->Cart->Customer->BirthDate;
     2002                }
     2003
     2004                if ( null != $customer_BirthDate && '' != $customer_BirthDate ) {
     2005                    $dateTime                       = new DateTime( $customer_BirthDate );
     2006                    $formatted_cust_bill_birth_date = $dateTime->format( 'Y-m-d' );
     2007                }
     2008                // code to get calculatecart customer information (end)
     2009
     2010                $saved_addrs       = $objectMultipleShippingController->get_multiple_shipping_addresses( $customer_uid, $customer_code );
     2011                $saved_addresses   = wp_json_encode( $saved_addrs );
     2012                $saved_addresses   = json_decode( $saved_addresses, true );
     2013                $total_saved_addrs = 0; // define variable to avoid warnings
     2014                if ( $saved_addresses['status'] == 'success' ) {
     2015                    $total_saved_addrs = count( $saved_addresses['data'] );
     2016                }
     2017                $addresses    = array();
     2018                $addresses[0] = __( 'Please Configure shipping address..', 'woocommerce' );
     2019                if ( ! empty( $saved_addrs ) ) {
     2020                    $addresses[0] = __( 'Select an address...', 'woocommerce' );
     2021                    for ( $addrs_count = 0; $addrs_count < $total_saved_addrs; $addrs_count++ ) {
     2022                        $addresses[ $addrs_count + 1 ] = $saved_addresses['data'][ $addrs_count ]['Title'];
     2023                    }
     2024                }
     2025                $alt_field          = array(
     2026                    'label'    => __( 'Saved addresses', 'woocommerce' ),
     2027                    'required' => false,
     2028                    'class'    => array( 'form-row' ),
     2029                    'clear'    => true,
     2030                    'type'     => 'select',
     2031                    'priority' => 1,
     2032                    'options'  => $addresses,
     2033                );
     2034                $alt_save_address   = array(
     2035                    'label'    => __( 'Save this Address', 'woocommerce' ),
     2036                    'id'       => 'save_address_checkbox',
     2037                    'name'     => 'save_address_checkbox',
     2038                    'type'     => 'checkbox',
     2039                    'priority' => 2,
     2040                    'class'    => array( 'form-row' ),
     2041                );
     2042                $fields['shipping'] = bloyal_array_unshift_assoc( $fields['shipping'], 'alt_save_address', $alt_save_address );
     2043                $fields['shipping'] = bloyal_array_unshift_assoc( $fields['shipping'], 'shipping_alt', $alt_field );
     2044            }
     2045            if ( 'true' == $isDisplayPhone ) {
     2046                $fields['shipping']['shipping_phone'] = array(
     2047                    'type'     => 'text',
     2048                    'label'    => __( 'Phone', 'woocommerce' ),
     2049                    'clear'    => false,
     2050                    'validate' => array( 'phone' ),
     2051                    'required' => 'true' == $isRequiredPhone ? true : false,
     2052                    'priority' => 110,
     2053                );
     2054            }
     2055            if ( 'true' == $isDisplayEmail ) {
     2056                $fields['shipping']['shipping_email'] = array(
     2057                    'type'     => 'email',
     2058                    'label'    => __( 'Email address', 'woocommerce' ),
     2059                    'clear'    => false,
     2060                    'validate' => array( 'email' ),
     2061                    'required' => 'true' == $isRequiredEmail ? true : false,
     2062                    'priority' => 120,
     2063                );
     2064            }
     2065            if ( 'true' == $isDisplayOrderComments ) {
     2066                $fields['billing']['order_comments2'] = array(
     2067                    'type'     => 'text',
     2068                    'label'    => __( 'Order Instructions', 'woocommerce' ),
     2069                    'clear'    => false,
     2070                    'required' => false,
     2071                    'priority' => 130,
     2072                );
     2073                add_filter( 'woocommerce_enable_order_notes_field', '__return_false' );
     2074            }
     2075            // code to set bLoyal calculatecart customer information on checkout page (start)
     2076            $fields['billing']['billing_first_name']['default'] = $customer_Fname;
     2077            $fields['billing']['billing_last_name']['default']  = $customer_Lname;
     2078            $fields['billing']['billing_address_1']['default']  = $customer_Address1;
     2079            $fields['billing']['billing_address_2']['default']  = $customer_Address2;
     2080            $fields['billing']['billing_city']['default']       = $customer_City;
     2081            $fields['billing']['billing_state']['default']      = $customer_StateName;
     2082            $fields['billing']['billing_email']['default']      = $customer_EmailAddress;
     2083            $fields['billing']['billing_phone']['default']      = $customer_MobilePhone;
     2084            $fields['billing']['billing_postcode']['default']   = $customer_PostalCode;
     2085            $fields['billing']['billing_company']['default']    = $customer_Comp_name;
     2086            $fields['billing']['billing_country']['default']    = $customer_CountryName;
     2087            $fields['billing']['billing_birth_date']['default'] = $formatted_cust_bill_birth_date;
     2088            // code to set bLoyal calculatecart customer information on checkout page (end)
     2089            return $fields;
     2090        }
    20892091    } catch ( Exception $e ) {
    20902092            bLoyalLoggerService::write_custom_log( $e->getMessage(), 3 );
     
    35633565        foreach ( $line_data as $index => $line ) {
    35643566           
    3565             if ( isset( $line->ProductCode )) {
     3567            if ( isset( $line->ProductCode ) && $line->ExternalId == null) {
    35663568                // code to update price of egiftcard web snippet as per the getCart API response start
    35673569
  • bloyal/trunk/readme.txt

    r3188653 r3217602  
    77Requires at least: 5.6
    88
    9 Tested up to: 6.6.2
    10 
    11 WC tested up to: 9.4.1
     9Tested up to: 6.7.1
     10
     11WC tested up to: 9.5.1
    1212
    1313Requires PHP: 5.6
    1414
    15 Stable tag: 3.1.611.51
     15Stable tag: 3.1.611.54
    1616
    1717License: GPLv2 or later
     
    274274Implemented the functionality to add new line item to the woocommerce cart.
    275275
     276= 3.1.611.54 =
     277
     278*Release Date - 6 Jan 2025*
     279
     280Fixed the issue in which cart page was breaking when backend configuration.
     281Fixed the issue in which functionality was breaking oncart page due to "new line item".
     282
    276283== Changes ==
    277284
     
    302309
    303310
    304 = 3.1.611.51 =
    305 
    306 
    307 
    308 * [Compatibility] - WP 6.6.2
    309 
    310 * [Compatibility] - WC 9.4.1
    311 
     311= 3.1.611.54 =
     312
     313
     314
     315* [Compatibility] - WP 6.7.1
     316
     317* [Compatibility] - WC 9.5.1
     318
Note: See TracChangeset for help on using the changeset viewer.