Skip to content

Commit

Permalink
Merge pull request #206 from FatchipRobert/MAGE-357-Amazon-Pay-Widget…
Browse files Browse the repository at this point in the history
…-Fix

MAGE-357 - Amazon Widget.js will now be loaded after DOM is loaded co…
  • Loading branch information
Florian Bender authored May 14, 2018
2 parents 9e2aef2 + e79fb64 commit 1f6c3f3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,12 @@ $cartAction = $helper->getMagentoUrl('checkout/cart');
<!-- Load script Widgets.js from Amazon -->
<!-- URL changes to https://static-eu.payments-amazon.com/OffAmazonPayments/eur/lpa/js/Widgets.js when mode is live -->
<?php $useSandbox = $config->getMode() === \Payone_Enum_Mode::TEST ? '/sandbox' : '' ?>
<script async="async" src='<?php echo "https://static-eu.payments-amazon.com/OffAmazonPayments/eur{$useSandbox}/lpa/js/Widgets.js" ?>'></script>
<script>
document.observe("dom:loaded", function() {
var head = $$('head')[0];
if (head) {
var script = new Element('script', { type: 'text/javascript', src: '<?php echo "https://static-eu.payments-amazon.com/OffAmazonPayments/eur{$useSandbox}/lpa/js/Widgets.js" ?>' });
head.appendChild(script);
}
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ if (!empty($config)) :
<!-- Load script Widgets.js from Amazon -->
<!-- URL changes to https://static-eu.payments-amazon.com/OffAmazonPayments/eur/lpa/js/Widgets.js when mode=live -->
<?php $useSandbox = $config->getMode() === \Payone_Enum_Mode::TEST ? '/sandbox' : '' ?>
<script async="async" src='<?php echo "https://static-eu.payments-amazon.com/OffAmazonPayments/eur{$useSandbox}/lpa/js/Widgets.js" ?>'></script>
<script>
document.observe("dom:loaded", function() {
var head = $$('head')[0];
if (head) {
var script = new Element('script', { type: 'text/javascript', src: '<?php echo "https://static-eu.payments-amazon.com/OffAmazonPayments/eur{$useSandbox}/lpa/js/Widgets.js" ?>' });
head.appendChild(script);
}
});
</script>
<?php endif; ?>
<?php endif; ?>
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,17 @@ if (!empty($config)) :
}
</script>
<?php if ($this::$counter <= 1) : ?>
<!-- Load script Widgets.js from Amazon -->
<!-- URL changes to https://static-eu.payments-amazon.com/OffAmazonPayments/eur/lpa/js/Widgets.js when mode=live -->
<?php $useSandbox = $config->getMode() === \Payone_Enum_Mode::TEST ? '/sandbox' : '' ?>
<script async="async" src='<?php echo "https://static-eu.payments-amazon.com/OffAmazonPayments/eur{$useSandbox}/lpa/js/Widgets.js" ?>'></script>
<!-- Load script Widgets.js from Amazon -->
<!-- URL changes to https://static-eu.payments-amazon.com/OffAmazonPayments/eur/lpa/js/Widgets.js when mode=live -->
<?php $useSandbox = $config->getMode() === \Payone_Enum_Mode::TEST ? '/sandbox' : '' ?>
<script>
document.observe("dom:loaded", function() {
var head = $$('head')[0];
if (head) {
var script = new Element('script', { type: 'text/javascript', src: '<?php echo "https://static-eu.payments-amazon.com/OffAmazonPayments/eur{$useSandbox}/lpa/js/Widgets.js" ?>' });
head.appendChild(script);
}
});
</script>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>

0 comments on commit 1f6c3f3

Please sign in to comment.