Skip to content

Commit 40391fc

Browse files
author
Marten Jansen
committed
Merge branch 'develop'
2 parents 1c88f22 + 3a55f29 commit 40391fc

File tree

5 files changed

+33
-3
lines changed

5 files changed

+33
-3
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
"issues": "https://github.com/CreditClick/PriceModuleMagento2/issues"
2222
},
2323
"require": {
24-
"php": "~5.5.0|~5.6.0|~7.0.0|~7.1.0",
25-
"magento/framework": "*"
24+
"php": "~5.5.0|~5.6.0|~7.0.0|~7.1.0"
2625
},
2726
"autoload": {
2827
"files": [

etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
22
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
3-
<module name="CreditClick_PriceModule" setup_version="1.0.1">
3+
<module name="CreditClick_PriceModule" setup_version="1.0.2">
44
</module>
55
</config>

view/frontend/templates/product/view/catalog_category.phtml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,26 @@ $price = 0;
1414
<?=$custom_css;?>
1515
</style>
1616
<script type="text/javascript">
17+
String.prototype.replaceAll = function(target, replacement) {
18+
return this.split(target).join(replacement);
19+
};
1720
require(["jquery","domReady!"], function ($) {
1821

1922
$('.products.list.items.product-items').children('li').each(function( index ) {
2023
let price_module = $(this).find('.cc-price-module-catalog_category');
24+
let price_box = $(this).find('.price-wrapper');
25+
2126
if ($(price_module[0]).hasClass('cc-loc-changed') === false) {
2227
let target = $(this).find('.price-box.price-final_price');
2328
let price = $(this).find('[data-price-amount]').data('price-amount') * 100;
2429
$(price_module[0]).attr('data-cc', price);
2530
$(price_module[0]).appendTo(target);
2631
$(price_module[0]).addClass('cc-loc-changed');
32+
$(price_box).on('DOMSubtreeModified', function() {
33+
let price2 = ($('.price', price_box).html() + "").replaceAll('€', '').replaceAll(' ', '').replaceAll('&nbsp;', '').replaceAll('.', '').replaceAll(',', '');
34+
$(price_module[0]).attr('data-cc', price2);
35+
loadCreditClick();
36+
});
2737
}
2838
});
2939
loadCreditClick();

view/frontend/templates/product/view/catalog_product.phtml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,19 @@ $custom_css = $block->escapeHtml($this->helper('\CreditClick\PriceModule\Helper\
1515
<div class="cc-price-module-catalog_product" data-cc="<?=$price;?>" data-cc-btn="<?=$button_type?>"></div>
1616
<script type="text/javascript">
1717
require(["jquery","domReady!"], function ($) {
18+
String.prototype.replaceAll = function(target, replacement) {
19+
return this.split(target).join(replacement);
20+
};
1821
loadCreditClick();
22+
$(document).ready(function () {
23+
let price_box = $(this).find('.price-wrapper');
24+
debugger;
25+
$(price_box).on('DOMSubtreeModified', function () {
26+
let price2 = ($('.price', price_box).html() + "").replaceAll('€', '').replaceAll(' ', '').replaceAll('&nbsp;', '').replaceAll('.', '').replaceAll(',', '');
27+
$('.cc-price-module-catalog_product').attr('data-cc', price2);
28+
loadCreditClick();
29+
});
30+
});
1931
});
2032
</script>
2133
<style>

view/frontend/templates/product/view/catalogsearch_result.phtml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,25 @@ $price = 0;
1919
<?=$custom_css;?>
2020
</style>
2121
<script type="text/javascript">
22+
String.prototype.replaceAll = function(target, replacement) {
23+
return this.split(target).join(replacement);
24+
};
2225
require(["jquery","domReady!"], function ($) {
2326

2427
$('.products.list.items.product-items').children('li').each(function( index ) {
2528
let price_module = $(this).find('.cc-price-module-catalogsearch_result');
29+
let price_box = $(this).find('.price-wrapper');
2630
if ($(price_module[0]).hasClass('cc-loc-changed') === false) {
2731
let target = $(this).find('[data-price-box]');
2832
let price = $(this).find('[data-price-amount]').data('price-amount') * 100;
2933
$(price_module[0]).attr('data-cc', price);
3034
$(price_module[0]).appendTo(target);
3135
$(price_module[0]).addClass('cc-loc-changed');
36+
$(price_box).on('DOMSubtreeModified', function() {
37+
let price2 = ($('.price', price_box).html() + "").replaceAll('€', '').replaceAll(' ', '').replaceAll('&nbsp;', '').replaceAll('.', '').replaceAll(',', '');
38+
$(price_module[0]).attr('data-cc', price2);
39+
loadCreditClick();
40+
});
3241
}
3342
});
3443
loadCreditClick();

0 commit comments

Comments
 (0)