FranciscoPrado_PrecoParcelado - Version 2.0.0.1

Version Notes

Melhorias no código Javascript envolvendo a atualização de preços de produtos configuráveis.

Download this release

Release Info

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


Code changes from version 2.0.0.0 to 2.0.0.1

package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>FranciscoPrado_PrecoParcelado</name>
4
- <version>2.0.0.0</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>Adi&#xE7;&#xE3;o do recurso para calcular parcelas em pre&#xE7;os especiais.</notes>
12
  <authors><author><name>Francisco Prado</name><user>fr_prado</user><email>franciscontato@gmail.com</email></author></authors>
13
- <date>2014-08-25</date>
14
- <time>23:56:06</time>
15
- <contents><target name="magecommunity"><dir name="FranciscoPrado"><dir name="PrecoParcelado"><dir name="etc"><file name="config.xml" hash="f001297c2846d51fb20035e68067d357"/><file name="system.xml" hash="dcf2d6a5c24cb16d191a96eb04ceb0b9"/></dir><dir name="Helper"><file name="Data.php" hash="5b7d4cccefd84b8f1095179ea7120cb4"/></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="5f0553710de203fb01c86e56d5bebdc9"/></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.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>
skin/frontend/base/default/js/precoparcelado.js CHANGED
@@ -70,23 +70,36 @@ $pp(document).ready(function() {
70
  };
71
 
72
  var onPriceChange = function(e) {
73
- var ppTotalPrice = '';
74
 
75
- if ($pp('.special-price').size() > 0) {
76
- ppTotalPrice = $pp('.special-price .price').html();
 
 
 
 
 
77
  }
78
  else {
79
- ppTotalPrice = $pp('#product-price-' + ppId + ' span').html();
 
 
80
  }
81
 
82
- var ppCurrencyFormat = optionsPrice.priceFormat.pattern.replace('%s', '');
83
- var ppDecimalSymbol = optionsPrice.priceFormat.decimalSymbol;
84
- var ppGroupSymbol = optionsPrice.priceFormat.groupSymbol;
85
- var ppCurrent = parseFloat(ppTotalPrice.replace(ppCurrencyFormat, '').replace(ppGroupSymbol, '').replace(ppDecimalSymbol, ','));
86
-
87
- getPrice(ppCurrent);
88
  };
89
-
90
- $pp('*[name^=super_attribute], *[name^=options]').on('change', onPriceChange);
91
-
 
 
 
 
 
 
 
 
 
 
 
92
  });
70
  };
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) {
78
+ if (key == 'price') {
79
+ price += optionsPrice.optionPrices.config['price'];
80
+ }
81
+ }
82
  }
83
  else {
84
+ for (key in optionsPrice.customPrices) {
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') {
95
+ for (var i = 0; i < spConfig.settings.length; i++) {
96
+ $pp('#' + spConfig.settings[i].id).on('change', onPriceChange);
97
+ }
98
+ }
99
+ else {
100
+ for (id in optionsPrice.customPrices) {
101
+ $pp('#' + id).on('change', onPriceChange);
102
+ }
103
+ }
104
+
105
  });