Plugin Directory

Changeset 3200744


Ignore:
Timestamp:
12/02/2024 09:25:37 AM (16 months ago)
Author:
SplitIt
Message:

release version 4.2.4

Location:
splitit-installment-payments
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • splitit-installment-payments/trunk/CHANGELOG.md

    r3196395 r3200744  
    33All notable changes to this project will be documented in this file
    44-
     5
     6### 4.2.4
     7* On-Site Messaging improvements for Shop page
     8* VIS support for On-Site Messaging
     9* Code improvements and bug fixes
     10* Tested compatibility with Woocommerce version 9.4.2
    511
    612### 4.2.3
  • splitit-installment-payments/trunk/assets/js/admin.js

    r3177834 r3200744  
    453453        );
    454454
     455        $( '#woocommerce_splitit_enabled_visa' ).change(
     456            function() {
     457                if (this.checked) {
     458                    $( '#main-section-enabled-visa-desc' ).html( "<span class='description-green'>Enabled</span>" );
     459                } else {
     460                    $( '#main-section-enabled-visa-desc' ).html( "<span>Disabled</span>" )
     461                }
     462            }
     463        );
     464
    455465        $( '#upstream_messaging_settings_section :checkbox' ).change(
    456466            function() {
     
    505515                        .removeClass( 'show' )
    506516                        .val( '' );
     517                    }
     518                }
     519            );
     520
     521        $( '.um-logo-position' )
     522            .change(
     523                function () {
     524                    let customFieldsWrap   = $( '#' + $( this ).data( 'page' ) + '_logo_custom_fields_wrap' );
     525                    let customFieldRegular = $( '#' + $( this ).data( 'page' ) + '_logo_regular' );
     526                    let customFieldSale    = $( '#' + $( this ).data( 'page' ) + '_logo_sale' );
     527
     528                    if ( $( this ).val() == 'custom' ) {
     529                        customFieldsWrap.addClass( 'show' )
     530                        .removeClass( 'hide' );
     531                    } else {
     532                        customFieldsWrap.addClass( 'hide' )
     533                        .removeClass( 'show' )
     534                        .val( '' );
     535                    }
     536                }
     537            );
     538
     539        $( '.um-one-liner-position' )
     540            .change(
     541                function () {
     542                    let customFieldsWrap   = $( '#' + $( this ).data( 'page' ) + '_one_liner_custom_fields_wrap' );
     543                    let customFieldRegular = $( '#' + $( this ).data( 'page' ) + '_one_liner_regular' );
     544                    let customFieldSale    = $( '#' + $( this ).data( 'page' ) + '_one_liner_sale' );
     545
     546                    if ( $( this ).val() == 'custom' ) {
     547                        customFieldsWrap.addClass( 'show' )
     548                            .removeClass( 'hide' );
     549                    } else {
     550                        customFieldsWrap.addClass( 'hide' )
     551                            .removeClass( 'show' )
     552                            .val( '' );
    507553                    }
    508554                }
     
    13821428        }
    13831429
     1430        const checkboxId = '#woocommerce_splitit_enabled_visa';
     1431        if ($(checkboxId).length > 0 && $(checkboxId).prop('checked')) {
     1432            customOptions += ' vis="true"';
     1433        }
     1434
    13841435        return `<${baseTag} ${customOptions}></${baseTag}>`;
    13851436    }
  • splitit-installment-payments/trunk/assets/js/splitit-blocks-um-cart.js

    r3196395 r3200744  
    1717                let umSelector = getUmSelector(umSettings);
    1818                let block = '<div id="on_site_message_block_cart"></div>';
     19                let isVisa = splititSettings.enabled_visa == 'yes';
    1920
    2021                let blockStyles = '';
     
    3031                    }
    3132
    32                     let stripUm = makeBlock(tagName, umSettings.strip);
     33                    let stripUm = makeBlock(isVisa, tagName, umSettings.strip);
    3334                    block = '<div id="on_site_message_block_cart" style="position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-bottom: 15px;">';
    3435                    block += stripUm;
     
    4243                    }
    4344
    44                     block = makeBlock(tagName, umSettings.banner);
     45                    block = makeBlock(isVisa, tagName, umSettings.banner);
    4546                    blockStyles = 'position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-top: 20px; margin-bottom: 20px';
    4647
     
    5556                    umSettings.logo.installments = installments;
    5657
    57                     block = makeBlock(tagName, umSettings.logo);
     58                    block = makeBlock(isVisa, tagName, umSettings.logo);
    5859
    5960                    blockStyles = 'position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-top: 20px; margin-bottom: 20px';
     
    6970                    umSettings.one_liner.installments = installments;
    7071
    71                     block = makeBlock(tagName, umSettings.one_liner);
     72                    block = makeBlock(isVisa, tagName, umSettings.one_liner);
    7273
    7374                    blockStyles = 'position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-top: 20px; margin-bottom: 20px';
     
    127128            }
    128129
    129             function makeBlock(tagName, pageConfig, hideUpstreamMessage = '') {
     130            function makeBlock(isVisa, tagName, pageConfig, hideUpstreamMessage = '') {
    130131                let $block = $('<' + tagName + ' ' + hideUpstreamMessage + '></' + tagName + '>');
    131132
     
    144145                if (tagName === 'spt-strip' && pageConfig.position === 'top') {
    145146                    $block.attr('is_solid', true);
     147                }
     148
     149                if (isVisa) {
     150                    $block.attr('vis', true);
    146151                }
    147152
  • splitit-installment-payments/trunk/assets/js/splitit-blocks-um-checkout.js

    r3196395 r3200744  
    1717                let umSelector = getUmSelector(umSettings);
    1818                let block = '<div id="on_site_message_block_checkout"></div>';
     19                let isVisa = splititSettings.enabled_visa == 'yes';
    1920
    2021                let blockStyles = '';
     
    3031                    }
    3132
    32                     let stripUm = makeBlock(tagName, umSettings.strip);
     33                    let stripUm = makeBlock(isVisa, tagName, umSettings.strip);
    3334                    block = '<div id="on_site_message_block_checkout" style="position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-bottom: 15px;">';
    3435                    block += stripUm;
     
    4243                    }
    4344
    44                     block = makeBlock(tagName, umSettings.banner);
     45                    block = makeBlock(isVisa, tagName, umSettings.banner);
    4546                    blockStyles = 'position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-top: 20px; margin-bottom: 20px';
    4647
     
    5556                    umSettings.logo.installments = installments;
    5657
    57                     block = makeBlock(tagName, umSettings.logo);
     58                    block = makeBlock(isVisa, tagName, umSettings.logo);
    5859
    5960                    blockStyles = 'position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-top: 20px; margin-bottom: 20px';
     
    6970                    umSettings.one_liner.installments = installments;
    7071
    71                     block = makeBlock(tagName, umSettings.one_liner);
     72                    block = makeBlock(isVisa, tagName, umSettings.one_liner);
    7273
    7374                    blockStyles = 'position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-top: 20px; margin-bottom: 20px';
     
    127128            }
    128129
    129             function makeBlock(tagName, pageConfig, hideUpstreamMessage = '') {
     130            function makeBlock(isVisa, tagName, pageConfig, hideUpstreamMessage = '') {
    130131                let $block = $('<' + tagName + ' ' + hideUpstreamMessage + '></' + tagName + '>');
    131132
     
    144145                if (tagName === 'spt-strip' && pageConfig.position === 'top') {
    145146                    $block.attr('is_solid', true);
     147                }
     148
     149                if (isVisa) {
     150                    $block.attr('vis', true);
    146151                }
    147152
  • splitit-installment-payments/trunk/classes/class-splitit-flexfields-payment-plugin-settings.php

    r3177834 r3200744  
    9090                ),
    9191                'splitit_refund_strategy'               => array(
    92                     'title'   => __( 'Refund Strategy', 'splitit_ff_payment' ),
    93                     'type'    => 'select',
    94                     'class'   => 'wc-enhanced-select',
    95                     'css'     => 'width: 420px; margin-bottom: 1px;',
    96                     'default' => '',
     92                    'title'    => __( 'Refund Strategy', 'splitit_ff_payment' ),
     93                    'type'     => 'select',
     94                    'class'    => 'wc-enhanced-select',
     95                    'css'      => 'width: 420px; margin-bottom: 1px;',
     96                    'default'  => '',
    9797                    'desc_tip' => false,
    98                     'options' => self::refund_strategy_selection(),
     98                    'options'  => self::refund_strategy_selection(),
    9999                ),
    100100                'splitit_inst_conf'                     => self::get_new_installment_fields( $settings ),
     
    133133                    ),
    134134                    'options'           => self::upstream_messaging_selection(),
     135                ),
     136                'enabled_visa'                         => array(
     137                    'title'   => __( 'Enable/Disable Visa Installment Supported', 'splitit_ff_payment' ),
     138                    'type'    => 'checkbox',
     139                    'label'   => __( 'Enable Visa', 'splitit_ff_payment' ),
     140                    'default' => 'no',
    135141                ),
    136142                'pages'                                => array(
  • splitit-installment-payments/trunk/classes/traits/splitit-flexfields-payment-plugin-upstream-messaging-trait.php

    r3196395 r3200744  
    8686    public function init_shop_page() {
    8787        if ( $this->is_enabled() ) {
    88             add_action( 'woocommerce_before_shop_loop', array( $this, 'shop_page' ) );
    89             add_filter( 'woocommerce_get_price_html', array( $this, 'add_splitit_banner_price_to_product_price_on_shop_page' ), 1000, 3 );
    90             add_filter( 'woocommerce_variable_price_html', array( $this, 'add_splitit_banner_price_to_product_price_on_shop_page_for_variable' ), 1000, 2 );
    91         }
    92     }
     88            if ( $this->is_upstream_messaging_selection( 'shop' ) ) {
     89                $page_config = $this->splitit_upstream_messaging_position_shop_page;
     90                $is_visa = $this->settings['enabled_visa'] ?? 'no';
     91                if ( is_array( $page_config ) ) {
     92                    if ( ( $page_config['one_liner'] && 1 == $page_config['one_liner']['enable_one_liner'] && $page_config['one_liner']['is_custom_selector'] && 'custom' == $page_config['one_liner']['is_custom_selector'] ) ||
     93                                      ( $page_config['logo'] && 1 == $page_config['logo']['enable_logo'] && $page_config['logo']['is_custom_selector'] && 'custom' == $page_config['logo']['is_custom_selector'] ) ) {
     94                        if ( $page_config['one_liner']['regular'] && '' !== $page_config['one_liner']['regular'] || $page_config['one_liner']['sale'] && '' !== $page_config['one_liner']['sale'] ||
     95                             $page_config['logo']['regular'] && '' !== $page_config['logo']['regular'] || $page_config['logo']['sale'] && '' !== $page_config['logo']['sale'] ) {
     96
     97                            $um_type = 1 == $page_config['one_liner']['enable_one_liner'] ? 'one_liner' : 'logo';
     98
     99                            add_action('template_redirect', function () use ( $page_config, $um_type, $is_visa ) {
     100                                $this->shop_page_with_custom_selectors( $page_config[$um_type], $um_type, $is_visa );
     101                            });
     102                        }
     103                    } else {
     104                        add_action( 'woocommerce_before_shop_loop', array( $this, 'shop_page' ) );
     105                        add_filter( 'woocommerce_get_price_html', array( $this, 'add_splitit_banner_price_to_product_price_on_shop_page' ), 1000, 3 );
     106                        add_filter( 'woocommerce_variable_price_html', array( $this, 'add_splitit_banner_price_to_product_price_on_shop_page_for_variable' ), 1000, 2 );
     107                    }
     108                }
     109            }
     110        }
     111    }
     112
     113    /**
     114     * Method for output banner on shop page with custom selectors
     115     */
     116    public function shop_page_with_custom_selectors( $page_config, $um_type, $is_visa ) {
     117        if ( is_shop() || is_product_category() || is_tax( 'product_brand' ) ) {
     118
     119            $installments_settings = $this->splitit_inst_conf ?? [
     120                'ic_from' => [],
     121                'ic_to' => [],
     122                'ic_installment' => []
     123            ];
     124
     125            ?>
     126            <script type="text/javascript">
     127                document.addEventListener("DOMContentLoaded", function () {
     128                    let umOptions = <?php echo json_encode($page_config ?? []); ?>;
     129                    let umType = '<?php echo $um_type; ?>';
     130                    let isVisa = '<?php echo $is_visa; ?>';
     131
     132                    console.log('UM - umOptions:', umOptions, umType);
     133                    console.log('UM - isVisa:', isVisa);
     134
     135                    if (umOptions && Object.keys(umOptions).length > 0) {
     136                        let customSelectorRegular = umOptions.regular;
     137
     138                        let priceElementsRegular = customSelectorRegular ? document.querySelectorAll(customSelectorRegular) : [];
     139
     140                        console.log('priceElementsRegular:', priceElementsRegular);
     141
     142                        if (priceElementsRegular.length > 0) {
     143                            priceElementsRegular.forEach((priceElement) => {
     144                                try {
     145                                    const fullText = priceElement.textContent.trim();
     146
     147                                    const regex = /^([^\d]*[\d.,\s]+)(?:\xa0|\s)*([\S]+)$/;
     148                                    const match = fullText.match(regex);
     149
     150                                    if (match) {
     151                                        const price = match[1].replace(/\s/g, '').replace(',', '.').replace(/^\D+/g, '');
     152                                        const currency = match[2];
     153
     154                                        let installment = getInstallmentByPrice(price);
     155                                        let um = generateUM(umType, umOptions, price, installment);
     156
     157                                        let umElement = document.createElement('div');
     158                                        umElement.innerHTML = um;
     159
     160                                        priceElement.appendChild(umElement);
     161
     162                                        console.log('UM added to regular price element:', priceElement);
     163                                    } else {
     164                                        console.log('Unable to extract data for UM from string:', fullText);
     165                                    }
     166                                } catch (error) {
     167                                    console.log('UM - Error processing element:', error);
     168                                }
     169                            });
     170                        } else {
     171                            console.log('UM - Price regular elements not found for selector:', customSelectorRegular);
     172                        }
     173
     174
     175                        let customSelectorSale = umOptions.sale;
     176                        let priceElementsSale = customSelectorSale ? document.querySelectorAll(customSelectorSale) : '';
     177
     178                        console.log('UM - priceElementsSale:', priceElementsSale);
     179
     180                        if (priceElementsSale.length > 0) {
     181                            priceElementsSale.forEach((priceElement) => {
     182                                try {
     183                                    const fullText = priceElement.textContent.trim();
     184
     185                                    const regex = /^([^\d]*[\d.,\s]+)(?:\xa0|\s)*([\S]+)$/;
     186                                    const match = fullText.match(regex);
     187
     188                                    if (match) {
     189                                        const price = match[1].replace(/\s/g, '').replace(',', '.').replace(/^\D+/g, '');
     190                                        const currency = match[2];
     191
     192                                        let installment = getInstallmentByPrice(price);
     193                                        let um = generateUM(umType, umOptions, price, installment);
     194
     195                                        let umElement = document.createElement('div');
     196                                        umElement.innerHTML = um;
     197
     198                                        priceElement.appendChild(umElement);
     199
     200                                        console.log('UM added to sale price element:', priceElement);
     201                                    } else {
     202                                        console.log('Unable to extract data for UM from string:', fullText);
     203                                    }
     204                                } catch (error) {
     205                                    console.log('UM - Error processing element:', error);
     206                                }
     207                            });
     208                        } else {
     209                            console.log('UM - Price sale elements not found for selector:', customSelectorSale);
     210                        }
     211                    } else {
     212                        console.log('UM - umOptions empty or undefined.');
     213                    }
     214
     215                    function getInstallmentByPrice(price) {
     216                        let installmentsSettings = <?php echo json_encode($installments_settings); ?>;
     217
     218                        price = parseFloat(price.replace(/[^\d.]/g, ''));
     219                        if (isNaN(price)) return false;
     220
     221                        for (let i = 0; i < installmentsSettings.ic_from.length; i++) {
     222                            const from = parseFloat(installmentsSettings.ic_from[i]);
     223                            const to = parseFloat(installmentsSettings.ic_to[i]);
     224
     225                            if (price >= from && price <= to) {
     226                                const installments = installmentsSettings.ic_installment[i]
     227                                    .split(',')
     228                                    .map(Number);
     229                                return Math.max(...installments);
     230                            }
     231                        }
     232                        return 3; // Default value
     233                    }
     234
     235                    function generateUM(type, options, price, installment) {
     236                        let baseTag = '';
     237                        let customOptions = '';
     238
     239                        switch (type) {
     240                            case 'logo':
     241                                baseTag = 'spt-floating-logo';
     242                                break;
     243                            case 'one_liner':
     244                                baseTag = 'spt-one-liner';
     245                                break;
     246                        }
     247
     248                        Object.entries(options).forEach(function ([key, val]) {
     249                            if (key !== '' && key !== 'regular' && key !== 'sale') {
     250                                if ((key === 'hide_learn_more' || key === 'hide_icon') && val == '1') {
     251                                    val = true;
     252                                }
     253                                customOptions += `${key}="${val}" `;
     254                            }
     255                        });
     256
     257                        customOptions += `amount="${price}" installments="${installment}"`;
     258
     259                        if (isVisa == 'yes') {
     260                            customOptions += ' vis="true"';
     261                        }
     262
     263                        return `<${baseTag} ${customOptions}></${baseTag}>`;
     264                    }
     265                });
     266            </script>
     267            <?php
     268        }
     269    }
    93270
    94271    /**
     
    162339     */
    163340    public function shop_page() {
    164         if ( $this->is_upstream_messaging_selection( 'shop' ) && is_shop() ) {
    165             if ( is_array( $this->splitit_upstream_messaging_position_shop_page ) ) {
    166                 if ( 1 != $this->splitit_upstream_messaging_position_shop_page['one_liner']['enable_one_liner'] && 1 != $this->splitit_upstream_messaging_position_shop_page['logo']['enable_logo'] ) {
     341        if ( $this->is_upstream_messaging_selection( 'shop' ) && ( is_shop() || is_product_category() || is_tax( 'product_brand' ) ) ) {
     342
     343            $page_config = $this->splitit_upstream_messaging_position_shop_page;
     344
     345            if ( is_array( $page_config ) ) {
     346
     347                if ( 1 != $page_config['one_liner']['enable_one_liner'] && 1 != $page_config['logo']['enable_logo'] ) {
    167348
    168349                    $custom_selector = false;
    169350
    170                     $page_config = $this->splitit_upstream_messaging_position_shop_page;
    171351                    if ( $page_config['banner'] && $page_config['banner']['enable_banner'] && $page_config['banner']['regular'] && $page_config['banner']['regular'] !== '' ) {
    172                         $this->display_um_with_custom_selector( 'spt-banner', $page_config['banner']['regular'], wp_json_encode( $this->generate_um_block( 'home_page', $this->splitit_upstream_messaging_position_shop_page ) ) );
     352                        $this->display_um_with_custom_selector( 'spt-banner', $page_config['banner']['regular'], wp_json_encode( $this->generate_um_block( 'home_page', $page_config ) ) );
    173353                        $custom_selector = true;
    174354                    }
    175355
    176356                    if ( $page_config['strip'] && $page_config['strip']['enable_strip'] ) {
    177                         $this->display_um_with_custom_selector( 'spt-strip', 'body', wp_json_encode( $this->generate_um_block( 'home_page', $this->splitit_upstream_messaging_position_shop_page ) ) );
     357                        $this->display_um_with_custom_selector( 'spt-strip', 'body', wp_json_encode( $this->generate_um_block( 'home_page', $page_config ) ) );
    178358                        $custom_selector = true;
    179359                    }
    180360
    181361                    if ( ! $custom_selector ) {
    182                         echo $this->generate_um_block( 'shop_page', $this->splitit_upstream_messaging_position_shop_page );
     362                        echo $this->generate_um_block( 'shop_page', $page_config );
    183363                    }
    184364                }
     
    254434     */
    255435    public function generate_um_block( $page, $page_config, $price = '', $installments = '', $hide_upstream_message = '', $product_id = '' ) {
     436
     437        $is_visa = $this->settings['enabled_visa'] ?? 'no';
     438
    256439        $block = '<div id="on_site_message_block_' . $page . '"></div>';
    257440
     
    263446            }
    264447
    265             $strip_um = self::make_block( $tag_name, $page_config['strip'], $hide_upstream_message );
     448            $strip_um = self::make_block( $tag_name, $page_config['strip'], $hide_upstream_message, $is_visa );
    266449            if ( 'checkout_page' === $page ) {
    267450                $block  = '<div id="on_site_message_block_' . $page . '" style="position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-bottom: 15px;">';
     
    286469            }
    287470
    288             $banner_um = self::make_block( $tag_name, $page_config['banner'], $hide_upstream_message );
     471            $banner_um = self::make_block( $tag_name, $page_config['banner'], $hide_upstream_message, $is_visa );
    289472
    290473            if ( $page === 'product_page' || $page === 'cart_page' || $page === 'checkout_page' ) {
     
    305488            $page_config['logo']['installments'] = $installments;
    306489
    307             $logo_um = self::make_block( $tag_name, $page_config['logo'], $hide_upstream_message );
     490            $logo_um = self::make_block( $tag_name, $page_config['logo'], $hide_upstream_message, $is_visa );
    308491            if ( $page === 'product_page' || $page === 'cart_page' || $page === 'checkout_page' ) {
    309492                $block  = '<div id="on_site_message_block_' . $page . '' . $product_id . '" style="position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-bottom: 15px">';
     
    314497            }
    315498        } elseif ( $page_config['one_liner'] && $page_config['one_liner']['enable_one_liner'] ) {
    316             $tag_name = 'spt-one-liner';
    317 
    318             if ( $page_config['one_liner']['text_option'] !== 'custom' ) {
    319                 $page_config['one_liner']['text_custom'] = '';
    320             }
    321 
    322             $page_config['one_liner']['amount']       = $price;
    323             $page_config['one_liner']['installments'] = $installments;
    324 
    325             $one_liner_um = self::make_block( $tag_name, $page_config['one_liner'], $hide_upstream_message );
    326             if ( $page === 'product_page' || $page === 'cart_page' || $page === 'checkout_page' ) {
    327                 $block  = '<div id="on_site_message_block_' . $page . '' . $product_id . '" style="position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px">';
    328                 $block .= $one_liner_um;
    329                 $block .= '</div>';
    330             } else {
    331                 $block = '<div id="on_site_message_block_' . $page . '' . $product_id . '">' . $one_liner_um . '</div>';
    332             }
     499            $tag_name = 'spt-one-liner';
     500
     501            if ( $page_config['one_liner']['text_option'] !== 'custom' ) {
     502                $page_config['one_liner']['text_custom'] = '';
     503            }
     504
     505            $page_config['one_liner']['amount']       = $price;
     506            $page_config['one_liner']['installments'] = $installments;
     507
     508            $one_liner_um = self::make_block( $tag_name, $page_config['one_liner'], $hide_upstream_message, $is_visa );
     509            if ( $page === 'product_page' || $page === 'cart_page' || $page === 'checkout_page' ) {
     510                $block  = '<div id="on_site_message_block_' . $page . '' . $product_id . '" style="position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px">';
     511                $block .= $one_liner_um;
     512                $block .= '</div>';
     513            } else {
     514                $block = '<div id="on_site_message_block_' . $page . '' . $product_id . '">' . $one_liner_um . '</div>';
     515            }
    333516        }
    334517
     
    339522     * Method for creation UM block
    340523     */
    341     private static function make_block( $tag_name, $page_config, $hide_upstream_message = '' ) {
     524    private static function make_block( $tag_name, $page_config, $hide_upstream_message = '', $is_visa ) {
    342525        $block = '<' . $tag_name . ' ' . $hide_upstream_message . ' ';
    343526        foreach ( $page_config as $key => $config ) {
     
    368551            }
    369552        }
     553
     554        if ( 'yes' == $is_visa ) {
     555            $block .= ' vis=true';
     556        }
    370557
    371558        $block .= '></' . $tag_name . '>';
  • splitit-installment-payments/trunk/readme.txt

    r3196395 r3200744  
    55Tested up to: 6.6.2
    66WC requires at least: 6.0
    7 WC tested up to: 9.3.3
    8 Stable tag: 4.2.3
     7WC tested up to: 9.4.2
     8Stable tag: 4.2.4
    99License: GPLv3
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    6262== Changelog ==
    6363
     64= 4.2.4 - 2024-12-02 =
     65On-Site Messaging improvements for Shop page
     66VIS support for On-Site Messaging
     67Code improvements and bug fixes
     68Tested compatibility with Woocommerce version 9.4.2
     69
    6470= 4.2.3 - 2024-11-05 =
    6571Added Cart and Checkout Blocks compatibility
  • splitit-installment-payments/trunk/splitIt-flexfields-payment-gateway.php

    r3196395 r3200744  
    1010 * Author: Splitit
    1111 * Author URI: https://www.splitit.com/
    12  * Version: 4.2.3
     12 * Version: 4.2.4
    1313 * WC requires at least: 6.0
    14  * WC tested up to: 9.3.3
     14 * WC tested up to: 9.4.2
    1515 */
    1616
     
    2626
    2727global $plugin_version;
    28 $plugin_version = '4.2.3';
     28$plugin_version = '4.2.4';
    2929
    3030global $required_splitit_php_version;
     
    601601                    return;
    602602                }
     603
     604                // add IPN in order transaction_id meta data
     605                $order->update_meta_data('_transaction_id', $flex_field_ipn);
     606                $order->save();
    603607
    604608                $data = array(
     
    30863090                <!--start section body-->
    30873091                <div id="upstream_messaging_settings_section" class="setting-content-block mt-3 hide">
     3092
     3093                    <div class="mb-3 d-flex">
     3094                        <div class="mr-3 main-section-enabled-title">
     3095                                <span class="setting-title">
     3096                                    <?php echo wp_kses_post( $data['enabled_visa']['title'] ); ?>
     3097                                </span>
     3098                        </div>
     3099                        <div>
     3100                            <legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['enabled_visa']['title'] ); ?></span></legend>
     3101
     3102                            <label class="main-section-switch">
     3103                                <input
     3104                                    <?php disabled( $data['disabled'], true ); ?>
     3105                                        class="<?php echo esc_attr( $data['class'] ); ?>"
     3106                                        type="checkbox" name="<?php echo esc_attr( $this->get_field_key( 'enabled_visa' ) ); ?>"
     3107                                        id="<?php echo esc_attr( $this->get_field_key( 'enabled_visa' ) ); ?>"
     3108                                        style="<?php echo esc_attr( $data['css'] ); ?>"
     3109                                        value="1"
     3110                                    <?php checked( $this->get_option( 'enabled_visa' ), 'yes' ); ?>
     3111                                    <?php echo $this->get_custom_attribute_html( $data['enabled_visa'] ); // WPCS: XSS ok. ?>
     3112                                />
     3113                                <span class="main-section-slider main-section-round"></span>
     3114                            </label>
     3115                        </div>
     3116                        <div id="main-section-enabled-visa-desc" class="ml-3 description main-section-enabled-description">
     3117                            <?php echo $this->get_option( 'enabled_visa' ) == 'yes' ? '<span class="description-green">Enabled</span>' : 'Disabled'; ?>
     3118                        </div>
     3119                    </div>
     3120
    30883121                    <?php foreach ( (array) $data['pages'] as $page_key => $page ) : ?>
    30893122                    <div class="main-section">
     
    37663799                                            </div>
    37673800
    3768                                             <?php if ( $page['name'] != 'shop' ) : ?>
    3769                                                 <div class="mt-3">
    3770                                                     <p class="description">СSS Selector ( can be left blank to display in place by default )</p>
    3771                                                     <input
    3772                                                             class="input-text regular-input"
    3773                                                             type="text"
    3774                                                             name="<?php echo esc_attr( $this->get_field_key( $page_key ) ); ?>[logo][regular]"
    3775                                                             id="<?php echo $page['name']; ?>_logo_regular"
    3776                                                             value="<?php echo ! is_array( $page_config ) || $page_config['logo']['regular'] == '' ? '' : $page_config['logo']['regular']; ?>"
    3777                                                             placeholder="Js selector. Example: '.yourClassName or #yourId'"
    3778                                                             data-name="regular"
    3779                                                     >
    3780                                                 </div>
    3781                                             <?php endif; ?>
     3801                                            <?php if ( $page['name'] == 'shop' ) : ?>
     3802                                                <div class="mt-3">
     3803                                                    <p class="description">Logo Position:</p>
     3804                                                    <select
     3805                                                            class="select um-select <?php echo esc_attr( $data['class'] ); ?> um-logo-position"
     3806                                                            name="<?php echo esc_attr( $this->get_field_key( $page_key ) ); ?>[logo][is_custom_selector]"
     3807                                                            id="<?php echo $page['checkbox']; ?>_logo_is_custom_selector"
     3808                                                            data-page="<?php echo $page['name']; ?>"
     3809                                                            data-type="logo"
     3810                                                            data-name=""
     3811                                                    >
     3812                                                        <option value="">Default</option>
     3813                                                        <option value="custom" <?php echo is_array( $page_config ) && $page_config['logo']['is_custom_selector'] == 'custom' ? 'selected' : ''; ?>>Custom</option>
     3814                                                    </select>
     3815                                                </div>
     3816
     3817                                                <div
     3818                                                        id="<?php echo $page['name']; ?>_logo_custom_fields_wrap"
     3819                                                        class="<?php echo is_array( $page_config ) && $page_config['logo']['is_custom_selector'] == 'custom' ? '' : 'hide'; ?>"
     3820                                                >
     3821                                                    <div class="mt-3">
     3822                                                        <p class="description">Regular СSS Selector</p>
     3823                                                        <p class="description"><span style="font-size: 14px;">Specify a selector with a price to calculate the amount and payments according to your settings</span></p>
     3824                                                        <input
     3825                                                                class="input-text regular-input"
     3826                                                                type="text"
     3827                                                                name="<?php echo esc_attr( $this->get_field_key( $page_key ) ); ?>[logo][regular]"
     3828                                                                id="<?php echo $page['name']; ?>_logo_regular"
     3829                                                                value="<?php echo ! is_array( $page_config ) || $page_config['logo']['regular'] == '' ? '' : $page_config['logo']['regular']; ?>"
     3830                                                                placeholder="Js selector. Example: '.yourClassName or #yourId'"
     3831                                                                data-name="regular"
     3832                                                        >
     3833                                                    </div>
     3834
     3835                                                    <div class="mt-3">
     3836                                                        <p class="description">Sale СSS Selector</p>
     3837                                                        <p class="description"><span style="font-size: 14px;">Specify a selector with a price to calculate the amount and payments according to your settings</span></p>
     3838                                                        <input
     3839                                                                class="input-text regular-input"
     3840                                                                type="text"
     3841                                                                name="<?php echo esc_attr( $this->get_field_key( $page_key ) ); ?>[logo][sale]"
     3842                                                                id="<?php echo $page['name']; ?>_logo_sale"
     3843                                                                value="<?php echo ! is_array( $page_config ) || $page_config['logo']['sale'] == '' ? '' : $page_config['logo']['sale']; ?>"
     3844                                                                placeholder="Js selector. Example: '.yourClassName or #yourId'"
     3845                                                                data-name="sale"
     3846                                                        >
     3847                                                    </div>
     3848                                                </div>
     3849
     3850                                            <?php else : ?>
     3851                                                <div class="mt-3">
     3852                                                    <p class="description">СSS Selector ( can be left blank to display in place by default )</p>
     3853                                                    <input
     3854                                                        class="input-text regular-input"
     3855                                                        type="text"
     3856                                                        name="<?php echo esc_attr( $this->get_field_key( $page_key ) ); ?>[logo][regular]"
     3857                                                        id="<?php echo $page['name']; ?>_logo_regular"
     3858                                                        value="<?php echo ! is_array( $page_config ) || $page_config['logo']['regular'] == '' ? '' : $page_config['logo']['regular']; ?>"
     3859                                                        placeholder="Js selector. Example: '.yourClassName or #yourId'"
     3860                                                        data-name="regular"
     3861                                                    >
     3862                                                </div>
     3863                                            <?php endif; ?>
    37823864
    37833865                                            <div class="mt-3">
     
    40194101                                            </div>
    40204102
    4021                                             <?php if ( $page['name'] != 'shop' ) : ?>
    4022                                                 <div class="mt-3">
    4023                                                     <p class="description">СSS Selector ( can be left blank to display in place by default )</p>
    4024                                                     <input
    4025                                                             class="input-text regular-input"
    4026                                                             type="text"
    4027                                                             name="<?php echo esc_attr( $this->get_field_key( $page_key ) ); ?>[one_liner][regular]"
    4028                                                             id="<?php echo $page['name']; ?>_one_liner_regular"
    4029                                                             value="<?php echo ! is_array( $page_config ) || $page_config['one_liner']['regular'] == '' ? '' : $page_config['one_liner']['regular']; ?>"
    4030                                                             placeholder="Js selector. Example: '.yourClassName or #yourId'"
    4031                                                             data-name="regular"
    4032                                                     >
    4033                                                 </div>
     4103                                            <?php if ( $page['name'] == 'shop' ) : ?>
     4104                                                <div class="mt-3">
     4105                                                    <p class="description">One-Liner Position:</p>
     4106                                                    <select
     4107                                                            class="select um-select <?php echo esc_attr( $data['class'] ); ?> um-one-liner-position"
     4108                                                            name="<?php echo esc_attr( $this->get_field_key( $page_key ) ); ?>[one_liner][is_custom_selector]"
     4109                                                            id="<?php echo $page['checkbox']; ?>_one_liner_is_custom_selector"
     4110                                                            data-page="<?php echo $page['name']; ?>"
     4111                                                            data-type="one_liner"
     4112                                                            data-name=""
     4113                                                    >
     4114                                                        <option value="">Default</option>
     4115                                                        <option value="custom" <?php echo is_array( $page_config ) && $page_config['one_liner']['is_custom_selector'] == 'custom' ? 'selected' : ''; ?>>Custom</option>
     4116                                                    </select>
     4117                                                </div>
     4118
     4119                                                <div
     4120                                                        id="<?php echo $page['name']; ?>_one_liner_custom_fields_wrap"
     4121                                                        class="<?php echo is_array( $page_config ) && $page_config['one_liner']['is_custom_selector'] == 'custom' ? '' : 'hide'; ?>"
     4122                                                >
     4123                                                    <div class="mt-3">
     4124                                                        <p class="description">СSS Selector</p>
     4125                                                        <p class="description"><span style="font-size: 14px;">Specify a selector with a price to calculate the amount and payments according to your settings ( can be left blank to display in place by default )</span></p>
     4126                                                        <input
     4127                                                                class="input-text regular-input"
     4128                                                                type="text"
     4129                                                                name="<?php echo esc_attr( $this->get_field_key( $page_key ) ); ?>[one_liner][regular]"
     4130                                                                id="<?php echo $page['name']; ?>_one_liner_regular"
     4131                                                                value="<?php echo ! is_array( $page_config ) || $page_config['one_liner']['regular'] == '' ? '' : $page_config['one_liner']['regular']; ?>"
     4132                                                                placeholder="Js selector. Example: '.yourClassName or #yourId'"
     4133                                                                data-name="regular"
     4134                                                        >
     4135                                                    </div>
     4136
     4137                                                    <div class="mt-3">
     4138                                                        <p class="description">Sale СSS Selector</p>
     4139                                                        <p class="description"><span style="font-size: 14px;">Specify a selector with a price to calculate the amount and payments according to your settings</span></p>
     4140                                                        <input
     4141                                                                class="input-text regular-input"
     4142                                                                type="text"
     4143                                                                name="<?php echo esc_attr( $this->get_field_key( $page_key ) ); ?>[one_liner][sale]"
     4144                                                                id="<?php echo $page['name']; ?>_one_liner_sale"
     4145                                                                value="<?php echo ! is_array( $page_config ) || $page_config['one_liner']['sale'] == '' ? '' : $page_config['one_liner']['sale']; ?>"
     4146                                                                placeholder="Js selector. Example: '.yourClassName or #yourId'"
     4147                                                                data-name="one_liner"
     4148                                                        >
     4149                                                    </div>
     4150                                                </div>
     4151                                            <?php else : ?>
     4152                                                <div class="mt-3">
     4153                                                    <p class="description">СSS Selector ( can be left blank to display in place by default )</p>
     4154                                                    <input
     4155                                                        class="input-text regular-input"
     4156                                                        type="text"
     4157                                                        name="<?php echo esc_attr( $this->get_field_key( $page_key ) ); ?>[one_liner][regular]"
     4158                                                        id="<?php echo $page['name']; ?>_one_liner_regular"
     4159                                                        value="<?php echo ! is_array( $page_config ) || $page_config['one_liner']['regular'] == '' ? '' : $page_config['one_liner']['regular']; ?>"
     4160                                                        placeholder="Js selector. Example: '.yourClassName or #yourId'"
     4161                                                        data-name="regular"
     4162                                                    >
     4163                                                </div>
    40344164                                            <?php endif; ?>
    40354165
     
    48895019                        } elseif ( 'New_Upstream_Messaging_Settings_section' === $key ) {
    48905020                            $this->settings['splitit_upstream_messaging_selection'] = $this->get_field_value( 'splitit_upstream_messaging_selection', $field['splitit_upstream_messaging_selection'], $post_data );
     5021                            $this->settings['enabled_visa']                         = $this->get_field_value( 'enabled_visa', $field['enabled_visa'], $post_data );
    48915022
    48925023                            foreach ( $field['pages'] as $page_key => $page ) {
Note: See TracChangeset for help on using the changeset viewer.