Changeset 3200744
- Timestamp:
- 12/02/2024 09:25:37 AM (16 months ago)
- Location:
- splitit-installment-payments
- Files:
-
- 1 added
- 8 edited
-
tags/4.2.4 (added)
-
trunk/CHANGELOG.md (modified) (1 diff)
-
trunk/assets/js/admin.js (modified) (3 diffs)
-
trunk/assets/js/splitit-blocks-um-cart.js (modified) (7 diffs)
-
trunk/assets/js/splitit-blocks-um-checkout.js (modified) (7 diffs)
-
trunk/classes/class-splitit-flexfields-payment-plugin-settings.php (modified) (2 diffs)
-
trunk/classes/traits/splitit-flexfields-payment-plugin-upstream-messaging-trait.php (modified) (9 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/splitIt-flexfields-payment-gateway.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
splitit-installment-payments/trunk/CHANGELOG.md
r3196395 r3200744 3 3 All notable changes to this project will be documented in this file 4 4 - 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 5 11 6 12 ### 4.2.3 -
splitit-installment-payments/trunk/assets/js/admin.js
r3177834 r3200744 453 453 ); 454 454 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 455 465 $( '#upstream_messaging_settings_section :checkbox' ).change( 456 466 function() { … … 505 515 .removeClass( 'show' ) 506 516 .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( '' ); 507 553 } 508 554 } … … 1382 1428 } 1383 1429 1430 const checkboxId = '#woocommerce_splitit_enabled_visa'; 1431 if ($(checkboxId).length > 0 && $(checkboxId).prop('checked')) { 1432 customOptions += ' vis="true"'; 1433 } 1434 1384 1435 return `<${baseTag} ${customOptions}></${baseTag}>`; 1385 1436 } -
splitit-installment-payments/trunk/assets/js/splitit-blocks-um-cart.js
r3196395 r3200744 17 17 let umSelector = getUmSelector(umSettings); 18 18 let block = '<div id="on_site_message_block_cart"></div>'; 19 let isVisa = splititSettings.enabled_visa == 'yes'; 19 20 20 21 let blockStyles = ''; … … 30 31 } 31 32 32 let stripUm = makeBlock( tagName, umSettings.strip);33 let stripUm = makeBlock(isVisa, tagName, umSettings.strip); 33 34 block = '<div id="on_site_message_block_cart" style="position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-bottom: 15px;">'; 34 35 block += stripUm; … … 42 43 } 43 44 44 block = makeBlock( tagName, umSettings.banner);45 block = makeBlock(isVisa, tagName, umSettings.banner); 45 46 blockStyles = 'position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-top: 20px; margin-bottom: 20px'; 46 47 … … 55 56 umSettings.logo.installments = installments; 56 57 57 block = makeBlock( tagName, umSettings.logo);58 block = makeBlock(isVisa, tagName, umSettings.logo); 58 59 59 60 blockStyles = 'position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-top: 20px; margin-bottom: 20px'; … … 69 70 umSettings.one_liner.installments = installments; 70 71 71 block = makeBlock( tagName, umSettings.one_liner);72 block = makeBlock(isVisa, tagName, umSettings.one_liner); 72 73 73 74 blockStyles = 'position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-top: 20px; margin-bottom: 20px'; … … 127 128 } 128 129 129 function makeBlock( tagName, pageConfig, hideUpstreamMessage = '') {130 function makeBlock(isVisa, tagName, pageConfig, hideUpstreamMessage = '') { 130 131 let $block = $('<' + tagName + ' ' + hideUpstreamMessage + '></' + tagName + '>'); 131 132 … … 144 145 if (tagName === 'spt-strip' && pageConfig.position === 'top') { 145 146 $block.attr('is_solid', true); 147 } 148 149 if (isVisa) { 150 $block.attr('vis', true); 146 151 } 147 152 -
splitit-installment-payments/trunk/assets/js/splitit-blocks-um-checkout.js
r3196395 r3200744 17 17 let umSelector = getUmSelector(umSettings); 18 18 let block = '<div id="on_site_message_block_checkout"></div>'; 19 let isVisa = splititSettings.enabled_visa == 'yes'; 19 20 20 21 let blockStyles = ''; … … 30 31 } 31 32 32 let stripUm = makeBlock( tagName, umSettings.strip);33 let stripUm = makeBlock(isVisa, tagName, umSettings.strip); 33 34 block = '<div id="on_site_message_block_checkout" style="position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-bottom: 15px;">'; 34 35 block += stripUm; … … 42 43 } 43 44 44 block = makeBlock( tagName, umSettings.banner);45 block = makeBlock(isVisa, tagName, umSettings.banner); 45 46 blockStyles = 'position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-top: 20px; margin-bottom: 20px'; 46 47 … … 55 56 umSettings.logo.installments = installments; 56 57 57 block = makeBlock( tagName, umSettings.logo);58 block = makeBlock(isVisa, tagName, umSettings.logo); 58 59 59 60 blockStyles = 'position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-top: 20px; margin-bottom: 20px'; … … 69 70 umSettings.one_liner.installments = installments; 70 71 71 block = makeBlock( tagName, umSettings.one_liner);72 block = makeBlock(isVisa, tagName, umSettings.one_liner); 72 73 73 74 blockStyles = 'position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-top: 20px; margin-bottom: 20px'; … … 127 128 } 128 129 129 function makeBlock( tagName, pageConfig, hideUpstreamMessage = '') {130 function makeBlock(isVisa, tagName, pageConfig, hideUpstreamMessage = '') { 130 131 let $block = $('<' + tagName + ' ' + hideUpstreamMessage + '></' + tagName + '>'); 131 132 … … 144 145 if (tagName === 'spt-strip' && pageConfig.position === 'top') { 145 146 $block.attr('is_solid', true); 147 } 148 149 if (isVisa) { 150 $block.attr('vis', true); 146 151 } 147 152 -
splitit-installment-payments/trunk/classes/class-splitit-flexfields-payment-plugin-settings.php
r3177834 r3200744 90 90 ), 91 91 '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' => '', 97 97 'desc_tip' => false, 98 'options' => self::refund_strategy_selection(),98 'options' => self::refund_strategy_selection(), 99 99 ), 100 100 'splitit_inst_conf' => self::get_new_installment_fields( $settings ), … … 133 133 ), 134 134 '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', 135 141 ), 136 142 'pages' => array( -
splitit-installment-payments/trunk/classes/traits/splitit-flexfields-payment-plugin-upstream-messaging-trait.php
r3196395 r3200744 86 86 public function init_shop_page() { 87 87 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 } 93 270 94 271 /** … … 162 339 */ 163 340 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'] ) { 167 348 168 349 $custom_selector = false; 169 350 170 $page_config = $this->splitit_upstream_messaging_position_shop_page;171 351 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 ) ) ); 173 353 $custom_selector = true; 174 354 } 175 355 176 356 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 ) ) ); 178 358 $custom_selector = true; 179 359 } 180 360 181 361 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 ); 183 363 } 184 364 } … … 254 434 */ 255 435 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 256 439 $block = '<div id="on_site_message_block_' . $page . '"></div>'; 257 440 … … 263 446 } 264 447 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 ); 266 449 if ( 'checkout_page' === $page ) { 267 450 $block = '<div id="on_site_message_block_' . $page . '" style="position: relative; width: 100%; height: auto; min-width: 50px; min-height: 50px; margin-bottom: 15px;">'; … … 286 469 } 287 470 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 ); 289 472 290 473 if ( $page === 'product_page' || $page === 'cart_page' || $page === 'checkout_page' ) { … … 305 488 $page_config['logo']['installments'] = $installments; 306 489 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 ); 308 491 if ( $page === 'product_page' || $page === 'cart_page' || $page === 'checkout_page' ) { 309 492 $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">'; … … 314 497 } 315 498 } 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 } 333 516 } 334 517 … … 339 522 * Method for creation UM block 340 523 */ 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 ) { 342 525 $block = '<' . $tag_name . ' ' . $hide_upstream_message . ' '; 343 526 foreach ( $page_config as $key => $config ) { … … 368 551 } 369 552 } 553 554 if ( 'yes' == $is_visa ) { 555 $block .= ' vis=true'; 556 } 370 557 371 558 $block .= '></' . $tag_name . '>'; -
splitit-installment-payments/trunk/readme.txt
r3196395 r3200744 5 5 Tested up to: 6.6.2 6 6 WC requires at least: 6.0 7 WC tested up to: 9. 3.38 Stable tag: 4.2. 37 WC tested up to: 9.4.2 8 Stable tag: 4.2.4 9 9 License: GPLv3 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 62 62 == Changelog == 63 63 64 = 4.2.4 - 2024-12-02 = 65 On-Site Messaging improvements for Shop page 66 VIS support for On-Site Messaging 67 Code improvements and bug fixes 68 Tested compatibility with Woocommerce version 9.4.2 69 64 70 = 4.2.3 - 2024-11-05 = 65 71 Added Cart and Checkout Blocks compatibility -
splitit-installment-payments/trunk/splitIt-flexfields-payment-gateway.php
r3196395 r3200744 10 10 * Author: Splitit 11 11 * Author URI: https://www.splitit.com/ 12 * Version: 4.2. 312 * Version: 4.2.4 13 13 * WC requires at least: 6.0 14 * WC tested up to: 9. 3.314 * WC tested up to: 9.4.2 15 15 */ 16 16 … … 26 26 27 27 global $plugin_version; 28 $plugin_version = '4.2. 3';28 $plugin_version = '4.2.4'; 29 29 30 30 global $required_splitit_php_version; … … 601 601 return; 602 602 } 603 604 // add IPN in order transaction_id meta data 605 $order->update_meta_data('_transaction_id', $flex_field_ipn); 606 $order->save(); 603 607 604 608 $data = array( … … 3086 3090 <!--start section body--> 3087 3091 <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 3088 3121 <?php foreach ( (array) $data['pages'] as $page_key => $page ) : ?> 3089 3122 <div class="main-section"> … … 3766 3799 </div> 3767 3800 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; ?> 3782 3864 3783 3865 <div class="mt-3"> … … 4019 4101 </div> 4020 4102 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> 4034 4164 <?php endif; ?> 4035 4165 … … 4889 5019 } elseif ( 'New_Upstream_Messaging_Settings_section' === $key ) { 4890 5020 $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 ); 4891 5022 4892 5023 foreach ( $field['pages'] as $page_key => $page ) {
Note: See TracChangeset
for help on using the changeset viewer.