FranciscoPrado_PrecoParcelado - Version 2.0.0.2

Version Notes

Correção no modo de cálculo, que passa a usar somente a tabela Price.

Download this release

Release Info

Developer Francisco Prado
Extension FranciscoPrado_PrecoParcelado
Version 2.0.0.2
Comparing to
See all releases


Code changes from version 2.0.0.1 to 2.0.0.2

app/code/community/FranciscoPrado/PrecoParcelado/Helper/Data.php CHANGED
@@ -9,11 +9,10 @@ class FranciscoPrado_PrecoParcelado_Helper_Data extends Mage_Core_Helper_Abstrac
9
  const XML_PATH_MIN_PARCEL_VALUE = 'sales/franciscoprado_precoparcelado/min_quote_value';
10
  const XML_PATH_MAX_NUMBER_MONTHS = 'sales/franciscoprado_precoparcelado/max_number_months';
11
  const XML_PATH_INTEREST_VALUE = 'sales/franciscoprado_precoparcelado/interest_value';
12
- const XML_PATH_USE_COMPOUND = 'sales/franciscoprado_precoparcelado/use_compound';
13
  const XML_PATH_TEXT_PATTERN = 'sales/franciscoprado_precoparcelado/text_pattern';
14
  const XML_PATH_TABLE_TEXT_PATTERN = 'sales/franciscoprado_precoparcelado/text_table_pattern';
15
  const XML_PATH_ADD_JQUERY = 'sales/franciscoprado_precoparcelado/add_jquery';
16
-
17
  public function isModuleEnabled($moduleName = null) {
18
  if ((int) Mage::getStoreConfig(self::XML_PATH_ACTIVE, Mage::app()->getStore()) != 1) {
19
  return false;
@@ -45,10 +44,6 @@ class FranciscoPrado_PrecoParcelado_Helper_Data extends Mage_Core_Helper_Abstrac
45
  return (float) Mage::getStoreConfig(self::XML_PATH_INTEREST_VALUE, $store);
46
  }
47
 
48
- public function useCompound($store = null) {
49
- return (int) Mage::getStoreConfig(self::XML_PATH_USE_COMPOUND, $store);
50
- }
51
-
52
  public function getText($store = null) {
53
  return Mage::getStoreConfig(self::XML_PATH_TEXT_PATTERN, $store);
54
  }
@@ -61,20 +56,20 @@ class FranciscoPrado_PrecoParcelado_Helper_Data extends Mage_Core_Helper_Abstrac
61
  return Mage::getStoreConfig(self::XML_PATH_ADD_JQUERY, $store);
62
  }
63
 
64
- public function getSimpleInterest($value, $interest, $parcels) {
65
- $interest = $interest / 100;
66
- $m = $value * (1 + $interest * $parcels);
67
- $parcelValue = $m / $parcels;
68
-
69
- return $parcelValue;
70
- }
71
 
72
- public function getCompoundInterest($value, $interest, $parcels) {
73
- $interest = $interest / 100;
74
- $parcelValue = $value * pow((1 + $interest), $parcels);
75
- $parcelValue = $parcelValue / $parcels;
 
 
76
 
77
- return $parcelValue;
 
78
  }
79
 
80
  public function getPrice($value) {
@@ -84,11 +79,7 @@ class FranciscoPrado_PrecoParcelado_Helper_Data extends Mage_Core_Helper_Abstrac
84
  $finalText = '';
85
 
86
  for ($i = 2; $i <= $this->getMaxNumberMonths(); $i++) {
87
- if ($this->useCompound()) {
88
- $parcel = $this->getCompoundInterest($value, $this->getInterest(), $i);
89
- } else {
90
- $parcel = $this->getSimpleInterest($value, $this->getInterest(), $i);
91
- }
92
 
93
  if ($parcel >= $this->getMinParcelValue()) {
94
  $price = Mage::helper('core')->currency($parcel, true, false);
@@ -96,9 +87,9 @@ class FranciscoPrado_PrecoParcelado_Helper_Data extends Mage_Core_Helper_Abstrac
96
  $finalText = str_replace('{preco}', $price, $replaceText);
97
  }
98
  }
99
-
100
  $returnHtml = sprintf('<span class="precoparcelado-parcels">%s</span>', $finalText);
101
-
102
  return $returnHtml;
103
  }
104
  }
9
  const XML_PATH_MIN_PARCEL_VALUE = 'sales/franciscoprado_precoparcelado/min_quote_value';
10
  const XML_PATH_MAX_NUMBER_MONTHS = 'sales/franciscoprado_precoparcelado/max_number_months';
11
  const XML_PATH_INTEREST_VALUE = 'sales/franciscoprado_precoparcelado/interest_value';
 
12
  const XML_PATH_TEXT_PATTERN = 'sales/franciscoprado_precoparcelado/text_pattern';
13
  const XML_PATH_TABLE_TEXT_PATTERN = 'sales/franciscoprado_precoparcelado/text_table_pattern';
14
  const XML_PATH_ADD_JQUERY = 'sales/franciscoprado_precoparcelado/add_jquery';
15
+
16
  public function isModuleEnabled($moduleName = null) {
17
  if ((int) Mage::getStoreConfig(self::XML_PATH_ACTIVE, Mage::app()->getStore()) != 1) {
18
  return false;
44
  return (float) Mage::getStoreConfig(self::XML_PATH_INTEREST_VALUE, $store);
45
  }
46
 
 
 
 
 
47
  public function getText($store = null) {
48
  return Mage::getStoreConfig(self::XML_PATH_TEXT_PATTERN, $store);
49
  }
56
  return Mage::getStoreConfig(self::XML_PATH_ADD_JQUERY, $store);
57
  }
58
 
59
+ public function getParcelsValue($value, $interest, $parcel) {
60
+ $interest = bcdiv($interest, 100, 15);
61
+ $E = 1.0;
62
+ $cont = 1.0;
 
 
 
63
 
64
+ for ($i = 1; $i <= $parcel; $i++) {
65
+ $cont = bcmul($cont, bcadd($interest, 1, 15), 15);
66
+ $E = bcadd($E, $cont, 15);
67
+ }
68
+
69
+ $E = bcsub($E, $cont, 15);
70
 
71
+ $value = bcmul($value, $cont, 15);
72
+ return bcdiv($value, $E, 15);
73
  }
74
 
75
  public function getPrice($value) {
79
  $finalText = '';
80
 
81
  for ($i = 2; $i <= $this->getMaxNumberMonths(); $i++) {
82
+ $parcel = $this->getParcelsValue($value, $this->getInterest(), $i);
 
 
 
 
83
 
84
  if ($parcel >= $this->getMinParcelValue()) {
85
  $price = Mage::helper('core')->currency($parcel, true, false);
87
  $finalText = str_replace('{preco}', $price, $replaceText);
88
  }
89
  }
90
+
91
  $returnHtml = sprintf('<span class="precoparcelado-parcels">%s</span>', $finalText);
92
+
93
  return $returnHtml;
94
  }
95
  }
app/code/community/FranciscoPrado/PrecoParcelado/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <FranciscoPrado_PrecoParcelado>
5
- <version>2.0.0.0</version>
6
  </FranciscoPrado_PrecoParcelado>
7
  </modules>
8
  <global>
@@ -59,13 +59,12 @@
59
  <sales>
60
  <franciscoprado_precoparcelado>
61
  <active>1</active>
62
- <show_table>1</show_table>
63
  <table_title>Valor das Parcelas</table_title>
64
  <show_price_in_parcels>1</show_price_in_parcels>
65
  <min_quote_value>50</min_quote_value>
66
  <max_number_months>12</max_number_months>
67
  <interest_value>1</interest_value>
68
- <use_compound>1</use_compound>
69
  <text_pattern>ou em {parcelas} vezes de {preco}</text_pattern>
70
  <text_table_pattern>{parcelas}x de</text_table_pattern>
71
  <add_jquery>0</add_jquery>
2
  <config>
3
  <modules>
4
  <FranciscoPrado_PrecoParcelado>
5
+ <version>2.0.0.2</version>
6
  </FranciscoPrado_PrecoParcelado>
7
  </modules>
8
  <global>
59
  <sales>
60
  <franciscoprado_precoparcelado>
61
  <active>1</active>
62
+ <show_table>0</show_table>
63
  <table_title>Valor das Parcelas</table_title>
64
  <show_price_in_parcels>1</show_price_in_parcels>
65
  <min_quote_value>50</min_quote_value>
66
  <max_number_months>12</max_number_months>
67
  <interest_value>1</interest_value>
 
68
  <text_pattern>ou em {parcelas} vezes de {preco}</text_pattern>
69
  <text_table_pattern>{parcelas}x de</text_table_pattern>
70
  <add_jquery>0</add_jquery>
app/code/community/FranciscoPrado/PrecoParcelado/etc/system.xml CHANGED
@@ -78,18 +78,6 @@
78
  <show_in_store>0</show_in_store>
79
  <validate>validate-zero-or-greater</validate>
80
  </interest_value>
81
- <use_compound>
82
- <label>Use Compound Interest?</label>
83
- <sort_order>80</sort_order>
84
- <frontend_type>select</frontend_type>
85
- <source_model>adminhtml/system_config_source_yesno</source_model>
86
- <show_in_default>1</show_in_default>
87
- <show_in_website>1</show_in_website>
88
- <show_in_store>0</show_in_store>
89
- <comment>
90
- Se Sim, usará fórmula de juros compostos. Se Não, usará a de juros simples.
91
- </comment>
92
- </use_compound>
93
  <text_pattern>
94
  <label>Text Pattern</label>
95
  <frontend_type>text</frontend_type>
78
  <show_in_store>0</show_in_store>
79
  <validate>validate-zero-or-greater</validate>
80
  </interest_value>
 
 
 
 
 
 
 
 
 
 
 
 
81
  <text_pattern>
82
  <label>Text Pattern</label>
83
  <frontend_type>text</frontend_type>
app/design/frontend/base/default/template/precoparcelado/jsdata.phtml CHANGED
@@ -7,19 +7,17 @@ $isActive = $helper->isModuleEnabled();
7
  $showTable = $helper->showTable();
8
  $minParcel = Mage::helper('franciscoprado_precoparcelado')->getMinParcelValue();
9
  $maxNumberMonths = Mage::helper('franciscoprado_precoparcelado')->getMaxNumberMonths();
10
- $useCompound = Mage::helper('franciscoprado_precoparcelado')->useCompound();
11
  $interest = Mage::helper('franciscoprado_precoparcelado')->getInterest();
12
  $text = Mage::helper('franciscoprado_precoparcelado')->getText();
13
  $tableText = Mage::helper('franciscoprado_precoparcelado')->getTableText();
14
  $addJquery = Mage::helper('franciscoprado_precoparcelado')->addJquery();
15
-
16
  if ($isActive): ?>
17
  <script>
18
  /* preco parcelado */
19
  var showTable = <?php echo $showTable ? 'true' : 'false'; ?>;
20
  var minParcel = <?php echo $minParcel ?>;
21
  var maxNumberMonths = <?php echo $maxNumberMonths ?>;
22
- var useCompound = <?php echo $useCompound ? 'true' : 'false' ?>;
23
  var interest = <?php echo $interest ?>;
24
  var ppText = '<?php echo $text ?>';
25
  var ppTableText = '<?php echo $tableText ?>';
7
  $showTable = $helper->showTable();
8
  $minParcel = Mage::helper('franciscoprado_precoparcelado')->getMinParcelValue();
9
  $maxNumberMonths = Mage::helper('franciscoprado_precoparcelado')->getMaxNumberMonths();
 
10
  $interest = Mage::helper('franciscoprado_precoparcelado')->getInterest();
11
  $text = Mage::helper('franciscoprado_precoparcelado')->getText();
12
  $tableText = Mage::helper('franciscoprado_precoparcelado')->getTableText();
13
  $addJquery = Mage::helper('franciscoprado_precoparcelado')->addJquery();
14
+
15
  if ($isActive): ?>
16
  <script>
17
  /* preco parcelado */
18
  var showTable = <?php echo $showTable ? 'true' : 'false'; ?>;
19
  var minParcel = <?php echo $minParcel ?>;
20
  var maxNumberMonths = <?php echo $maxNumberMonths ?>;
 
21
  var interest = <?php echo $interest ?>;
22
  var ppText = '<?php echo $text ?>';
23
  var ppTableText = '<?php echo $tableText ?>';
app/design/frontend/base/default/template/precoparcelado/table.phtml CHANGED
@@ -20,11 +20,7 @@ if ($isActive && $showTable):
20
  if ($productPrice > $minParcelValue):
21
  for ($i = 2; $i <= $maxNumberMonths; $i++):
22
 
23
- if ($helper->useCompound()):
24
- $parcel = $helper->getCompoundInterest($productPrice, $interest, $i);
25
- else:
26
- $parcel = $helper->getSimpleInterest($productPrice, $interest, $i);
27
- endif;
28
 
29
  $tableText = str_replace('{parcelas}', $i, $helper->getTableText());
30
  $parcelPrice = Mage::helper('core')->currency($parcel, true, false);
20
  if ($productPrice > $minParcelValue):
21
  for ($i = 2; $i <= $maxNumberMonths; $i++):
22
 
23
+ $parcel = $helper->getParcelsValue($productPrice, $interest, $i);
 
 
 
 
24
 
25
  $tableText = str_replace('{parcelas}', $i, $helper->getTableText());
26
  $parcelPrice = Mage::helper('core')->currency($parcel, true, false);
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>FranciscoPrado_PrecoParcelado</name>
4
- <version>2.0.0.1</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>M&#xF3;dulo para mostrar o pre&#xE7;o do produto em forma de parcelas, que &#xE9; um tipo de pagamento comum no Brasil.</summary>
10
- <description>Com esta extens&#xE3;o &#xE9; poss&#xED;vel voc&#xEA; mostrar o pre&#xE7;o parcelado do seu produto. Atrav&#xE9;s do painel de administra&#xE7;&#xE3;o &#xE9; poss&#xED;vel configurar os modos de exibi&#xE7;&#xE3;o (tabela de parcelas ou em texto espec&#xED;fico), n&#xFA;mero de meses, valor do juros, juro simples ou composto, parcela m&#xED;nima, entre outros.</description>
11
- <notes>Melhorias no c&#xF3;digo Javascript envolvendo a atualiza&#xE7;&#xE3;o de pre&#xE7;os de produtos configur&#xE1;veis.</notes>
12
  <authors><author><name>Francisco Prado</name><user>fr_prado</user><email>franciscontato@gmail.com</email></author></authors>
13
- <date>2014-09-24</date>
14
- <time>23:17:30</time>
15
- <contents><target name="magecommunity"><dir name="FranciscoPrado"><dir name="PrecoParcelado"><dir name="Helper"><file name="Data.php" hash="5b7d4cccefd84b8f1095179ea7120cb4"/></dir><dir name="etc"><file name="config.xml" hash="f001297c2846d51fb20035e68067d357"/><file name="system.xml" hash="dcf2d6a5c24cb16d191a96eb04ceb0b9"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="franciscoprado_precoparcelado.xml" hash="2e78e3b82b16ca71f4f678ae89c6930e"/></dir><dir name="template"><dir name="precoparcelado"><file name="jsdata.phtml" hash="c1cbd480b4839ac5681d58f7090f46f9"/><file name="table.phtml" hash="a1f35bcd3c28fcd80f8ccaa353a0ce40"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="FranciscoPrado_PrecoParcelado.xml" hash="ff2352dd5dcf370b98b77782ac230e5f"/></dir></target><target name="magelocale"><dir name="pt_BR"><file name="FranciscoPrado_PrecoParcelado.csv" hash="20d484ae51b10f0bda926502b383a61d"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="precoparcelado.css" hash="8b127443908efc0529ff9953e4d1402e"/></dir><dir name="js"><file name="precoparcelado.js" hash="6a44ab150d0a6077da8d9521479df9c8"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>FranciscoPrado_PrecoParcelado</name>
4
+ <version>2.0.0.2</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>M&#xF3;dulo para mostrar o pre&#xE7;o do produto em forma de parcelas, que &#xE9; um tipo de pagamento comum no Brasil.</summary>
10
+ <description>M&#xF3;dulo para mostrar o pre&#xE7;o do produto em forma de parcelas, que &#xE9; um tipo de pagamento comum no Brasil.</description>
11
+ <notes>Corre&#xE7;&#xE3;o no modo de c&#xE1;lculo, que passa a usar somente a tabela Price.</notes>
12
  <authors><author><name>Francisco Prado</name><user>fr_prado</user><email>franciscontato@gmail.com</email></author></authors>
13
+ <date>2014-10-13</date>
14
+ <time>20:59:48</time>
15
+ <contents><target name="mageetc"><dir><dir name="modules"><file name="FranciscoPrado_PrecoParcelado.xml" hash="ff2352dd5dcf370b98b77782ac230e5f"/></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="precoparcelado"><file name="jsdata.phtml" hash="7c05341c50664fc28ee9b5027e5bcc5e"/><file name="table.phtml" hash="66c9a9bd9785ed6fb2689b70b2c8e3c8"/></dir></dir><dir name="layout"><file name="franciscoprado_precoparcelado.xml" hash="2e78e3b82b16ca71f4f678ae89c6930e"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="pt_BR"><file name="FranciscoPrado_PrecoParcelado.csv" hash="20d484ae51b10f0bda926502b383a61d"/></dir></dir></target><target name="mageskin"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="js"><file name="precoparcelado.js" hash="9d048b9ee02ef4b9c62b0d0c2b8bb846"/></dir><dir name="css"><file name="precoparcelado.css" hash="8b127443908efc0529ff9953e4d1402e"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir><dir name="FranciscoPrado"><dir name="PrecoParcelado"><dir><dir name="etc"><file name="config.xml" hash="a5c1038b7b7d39a14e7f8142faedb2fd"/><file name="system.xml" hash="7adf1173acb4fe428b02d088bac35ec8"/></dir><dir name="Helper"><file name="Data.php" hash="86b19fe600259fbef62975e04115f9b4"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
skin/frontend/base/default/js/precoparcelado.js CHANGED
@@ -4,30 +4,31 @@ $pp(document).ready(function() {
4
 
5
  Number.prototype.formatMoney = function(c, d, t) {
6
  var n = this,
7
- c = isNaN(c = Math.abs(c)) ? 2 : c,
8
- d = d == undefined ? "." : d,
9
- t = t == undefined ? "," : t,
10
- s = n < 0 ? "-" : "",
11
- i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
12
- j = (j = i.length) > 3 ? j % 3 : 0;
13
-
14
  return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
15
  };
16
 
17
- var getSimpleInterest = function(value, interest, parcels) {
18
- interest = interest / 100;
19
- var m = value * (1 + interest * parcels);
20
- var parcelValue = m / parcels;
21
 
22
- return parcelValue;
23
- };
 
 
 
 
 
24
 
25
- var getCompoundInterest = function(value, interest, parcels) {
26
- interest = interest / 100;
27
- var parcelValue = value * Math.pow((1 + interest), parcels);
28
- var parcelValue = parcelValue / parcels;
29
-
30
- return parcelValue;
31
  };
32
 
33
  var getPrice = function(value) {
@@ -38,21 +39,17 @@ $pp(document).ready(function() {
38
  var ppGroupSymbol = optionsPrice.priceFormat.groupSymbol;
39
  var finalText = '';
40
  var tableText = '';
41
-
42
  for (var i = 2; i <= maxNumberMonths; i++) {
43
  var parcel = 0;
44
 
45
- if (useCompound) {
46
- parcel = getCompoundInterest(value, interest, i);
47
- } else {
48
- parcel = getSimpleInterest(value, interest, i);
49
- }
50
 
51
  if (parcel >= minParcel) {
52
  var parcelToCurrency = ppCurrencyFormat + (parcel).formatMoney(2, ppDecimalSymbol, ppGroupSymbol);
53
  finalText = ppText.replace('{preco}', parcelToCurrency);
54
  finalText = finalText.replace('{parcelas}', i);
55
-
56
  if (showTable) {
57
  tableText += '<tr>';
58
  tableText += '<td>' + ppTableText.replace('{parcelas}', i) + '</td>';
@@ -61,7 +58,7 @@ $pp(document).ready(function() {
61
  }
62
  }
63
  }
64
-
65
  $pp('.precoparcelado-parcels').html(finalText);
66
  $pp('.precoparcelado-table tbody').html(tableText);
67
  }
@@ -71,7 +68,7 @@ $pp(document).ready(function() {
71
 
72
  var onPriceChange = function(e) {
73
  var price = optionsPrice.productPrice;
74
-
75
  // if is configurable product
76
  if (typeof spConfig !== 'undefined') {
77
  for (key in optionsPrice.optionPrices.config) {
@@ -85,10 +82,10 @@ $pp(document).ready(function() {
85
  price += optionsPrice.customPrices[key].price;
86
  }
87
  }
88
-
89
  getPrice(price);
90
  };
91
-
92
  // add the 'change' event listener for each configurable option
93
  // if is configurable product
94
  if (typeof spConfig !== 'undefined') {
@@ -101,5 +98,5 @@ $pp(document).ready(function() {
101
  $pp('#' + id).on('change', onPriceChange);
102
  }
103
  }
104
-
105
  });
4
 
5
  Number.prototype.formatMoney = function(c, d, t) {
6
  var n = this,
7
+ c = isNaN(c = Math.abs(c)) ? 2 : c,
8
+ d = d == undefined ? "." : d,
9
+ t = t == undefined ? "," : t,
10
+ s = n < 0 ? "-" : "",
11
+ i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
12
+ j = (j = i.length) > 3 ? j % 3 : 0;
13
+
14
  return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
15
  };
16
 
17
+ var getParcelsValue = function(value, interest, parcels) {
18
+ interest = interest / 100;
19
+ var E = 1.0;
20
+ var cont = 1.0;
21
 
22
+ for (var i = 1; i <= parcels; i++)
23
+ {
24
+ cont = cont * (interest + 1);
25
+ E = E + cont;
26
+ }
27
+
28
+ E = E - cont;
29
 
30
+ parcel = value * cont;
31
+ return parcel / E;
 
 
 
 
32
  };
33
 
34
  var getPrice = function(value) {
39
  var ppGroupSymbol = optionsPrice.priceFormat.groupSymbol;
40
  var finalText = '';
41
  var tableText = '';
42
+
43
  for (var i = 2; i <= maxNumberMonths; i++) {
44
  var parcel = 0;
45
 
46
+ parcel = getParcelsValue(value, interest, i);
 
 
 
 
47
 
48
  if (parcel >= minParcel) {
49
  var parcelToCurrency = ppCurrencyFormat + (parcel).formatMoney(2, ppDecimalSymbol, ppGroupSymbol);
50
  finalText = ppText.replace('{preco}', parcelToCurrency);
51
  finalText = finalText.replace('{parcelas}', i);
52
+
53
  if (showTable) {
54
  tableText += '<tr>';
55
  tableText += '<td>' + ppTableText.replace('{parcelas}', i) + '</td>';
58
  }
59
  }
60
  }
61
+
62
  $pp('.precoparcelado-parcels').html(finalText);
63
  $pp('.precoparcelado-table tbody').html(tableText);
64
  }
68
 
69
  var onPriceChange = function(e) {
70
  var price = optionsPrice.productPrice;
71
+
72
  // if is configurable product
73
  if (typeof spConfig !== 'undefined') {
74
  for (key in optionsPrice.optionPrices.config) {
82
  price += optionsPrice.customPrices[key].price;
83
  }
84
  }
85
+
86
  getPrice(price);
87
  };
88
+
89
  // add the 'change' event listener for each configurable option
90
  // if is configurable product
91
  if (typeof spConfig !== 'undefined') {
98
  $pp('#' + id).on('change', onPriceChange);
99
  }
100
  }
101
+
102
  });