Skip to content

Commit

Permalink
Adapt simulators
Browse files Browse the repository at this point in the history
  • Loading branch information
PGarSol committed Feb 3, 2020
1 parent bab5a64 commit cc19576
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions templates/product_simulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ function checkSimulatorContent() {
return simulatorLoaded;
}

function moveToPrice()
{
if ('<?php echo $simulator_type; ?>' === 'sdk.simulator.types.SELECTABLE_TEXT_CUSTOM') {
var simnode = document.querySelector(findPositionSelector());

var detailnode = document.getElementsByClassName('woocommerce-product-details__short-description');
detailnode = detailnode['0'];

detailnode.parentNode.insertBefore(simnode,detailnode)
}
}

function checkAttempts() {
window.attempts = window.attempts + 1;
return (window.attempts > 4)
Expand All @@ -53,7 +65,6 @@ function checkAttempts() {
function prependSeparator()
{
var node = document.querySelector(findPositionSelector());

var textnode = document.createTextNode(<?php echo json_encode($separator);?>);
var spannode = document.createElement("span");
spannode.style.cssText = 'margin-right:5px';
Expand All @@ -73,8 +84,6 @@ function loadSimulatorPagantis()
return finishInterval();
}

var price = '<?php echo $total;?>';

var country = '<?php echo $country; ?>';
var locale = '<?php echo $locale; ?>';
var sdk = pgSDK;
Expand All @@ -96,7 +105,7 @@ function loadSimulatorPagantis()
thousandSeparator: '<?php echo $thousandSeparator;?>',
decimalSeparator: '<?php echo $decimalSeparator;?>'
},
numInstalments : '<?php echo $pagantisQuotesStart;?>',
numInstalments : '<?php echo $pagantisQuotesStart;?>',
skin : <?php echo $pagantisSimulatorSkin;?>,
position: <?php echo $pagantisSimulatorPosition;?>
};
Expand All @@ -107,6 +116,7 @@ function loadSimulatorPagantis()

if (typeof sdk != 'undefined') {
window.WCSimulatorId = sdk.simulator.init(simulator_options);
moveToPrice();
return false;
}
}
Expand All @@ -126,4 +136,4 @@ function loadSimulatorPagantis()
echo $promotedMessage;
}
?>
<div class="pagantisSimulator" style="display: flex"> </div>
<div class="pagantisSimulator" style="display:flex; margin-top: -30px;margin-bottom: 20px"></div><br/><br/>

0 comments on commit cc19576

Please sign in to comment.