PluginProbe
seQura / 2.0.6
seQura v2.0.6
4.3.4 4.3.3 4.3.2 4.3.1 trunk 2.0.0 2.0.10 2.0.11 2.0.12 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 3.0.0 3.0.2 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 4.0.0 All 30 releases
sequra / templates / partpayment-teaser.php

partpayment-teaser.php in seQura 2.0.6, at templates/partpayment-teaser.php

63 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Part payment teaser template.
4 *
5 * @package woocommerce-sequra
6 */
7
8 // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
9 ?>
10 <script type='text/javascript'>
11 /*Customize if needed*/
12 VARIATION_PRICE_SEL = '.woocommerce-variation-price .price>.amount,.woocommerce-variation-price .price ins .amount,.woocommerce-variation-price .price .amount';
13
14 /*********************/
15
16 function displaySequra<?php echo esc_js( $product ); ?>Teaser(the_price_container, sq_product, campaign, theme) {
17 var dest = '#sequra_partpayment_teaser_default_container';
18 if (jQuery('.woocommerce-variation-price').length) {
19 dest = '.woocommerce-variation-price';
20 the_price_container = VARIATION_PRICE_SEL;
21 }
22
23 <?php if ( isset( $atts['dest'] ) && '' !== trim( $atts['dest'] ) ) { ?>
24 var custom_dest = '<?php echo esc_js( $atts['dest'] ); ?>'.replace(/\&gt\;/g, ">");
25 if (jQuery(custom_dest).is(':visible')) {
26 dest = custom_dest;
27 }
28 <?php } ?>
29 SequraHelper.waitForElement(the_price_container).then(function () {
30 SequraHelper.waitForElement(dest).then(function () {
31 SequraHelper.drawPromotionWidget(the_price_container, dest, sq_product, theme, 0, campaign, <?php echo esc_js( $registration_amount ); ?>);
32 Sequra.onLoad(function () {
33 Sequra.refreshComponents();
34 });
35 });
36 });
37 }
38
39 function updateSequra<?php echo esc_js( $product ); ?>Teaser(e) {
40 var the_price_container = '<?php echo esc_js( $price_container ); ?>'.replace(/\&gt\;/g, ">");
41 if (e.type == 'show_variation' && jQuery(VARIATION_PRICE_SEL).length) {
42 the_price_container = VARIATION_PRICE_SEL;
43 }
44 var price_in_cents = SequraHelper.selectorToCents(the_price_container);
45 jQuery('[data-product=<?php echo esc_js( $product ); ?>]').attr('data-amount', price_in_cents);
46 Sequra.onLoad(function () {
47 Sequra.refreshComponents();
48 });
49 }
50
51 document.addEventListener("DOMContentLoaded", function () {
52 displaySequra<?php echo esc_js( $product ); ?>Teaser(
53 '<?php echo esc_js( $price_container ); ?>'.replace(/\&gt\;/g, ">"),
54 '<?php echo esc_js( $product ); ?>',
55 '<?php echo esc_js( $campaign ); ?>',
56 '<?php echo esc_js( $theme ); ?>'.replace(/\&quot\;/g, "\"")
57 );
58 jQuery('.variations_form')
59 .on('hide_variation', updateSequra<?php echo esc_js( $product ); ?>Teaser)
60 .on('show_variation', updateSequra<?php echo esc_js( $product ); ?>Teaser);
61 });
62 </script>
63