FranciscoPrado_PrecoParcelado - Version 2.0.0.0

Version Notes

Adição do recurso para calcular parcelas em preços especiais.

Download this release

Release Info

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


Code changes from version 1.1.0.1 to 2.0.0.0

app/code/community/FranciscoPrado/PrecoParcelado/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <FranciscoPrado_PrecoParcelado>
5
- <version>1.1.0.1</version>
6
  </FranciscoPrado_PrecoParcelado>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <FranciscoPrado_PrecoParcelado>
5
+ <version>2.0.0.0</version>
6
  </FranciscoPrado_PrecoParcelado>
7
  </modules>
8
  <global>
app/design/frontend/base/default/template/precoparcelado/table.phtml CHANGED
@@ -1,5 +1,4 @@
1
- <?php
2
-
3
  $helper = Mage::helper('franciscoprado_precoparcelado');
4
  $isActive = $helper->isModuleEnabled();
5
  $showTable = $helper->showTable();
@@ -8,41 +7,41 @@ if ($isActive && $showTable):
8
  $maxNumberMonths = $helper->getMaxNumberMonths();
9
  $minParcelValue = $helper->getMinParcelValue();
10
  $interest = $helper->getInterest();
11
- $productPrice = Mage::registry('current_product')->getPrice();
12
-
13
  ?>
14
  <table class="precoparcelado-table">
15
  <thead>
16
- <tr>
17
- <th colspan="2"><?php echo $helper->getTableTitle() ?></th>
18
- </tr>
19
  </thead>
20
  <tbody>
21
  <?php
22
  if ($productPrice > $minParcelValue):
23
- for ($i = 2; $i <= $maxNumberMonths; $i++):
24
-
25
- if ($helper->useCompound()):
26
- $parcel = $helper->getCompoundInterest($productPrice, $interest, $i);
27
- else:
28
- $parcel = $helper->getSimpleInterest($productPrice, $interest, $i);
29
- endif;
30
-
31
- $tableText = str_replace('{parcelas}', $i, $helper->getTableText());
32
- $parcelPrice = Mage::helper('core')->currency($parcel, true, false);
33
-
34
- if ($parcel >= $minParcelValue):
35
- ?>
36
- <tr>
37
- <td><?php echo $tableText ?></td>
38
- <td><?php echo $parcelPrice ?></td>
39
- <tr>
40
- <?php
41
- endif;
42
- endfor;
43
  endif;
44
  ?>
45
  </tbody>
46
  </table>
47
  <?php
 
48
  endif;
1
+ <?php
 
2
  $helper = Mage::helper('franciscoprado_precoparcelado');
3
  $isActive = $helper->isModuleEnabled();
4
  $showTable = $helper->showTable();
7
  $maxNumberMonths = $helper->getMaxNumberMonths();
8
  $minParcelValue = $helper->getMinParcelValue();
9
  $interest = $helper->getInterest();
10
+ $productPrice = Mage::registry('current_product')->getFinalPrice();
 
11
  ?>
12
  <table class="precoparcelado-table">
13
  <thead>
14
+ <tr>
15
+ <th colspan="2"><?php echo $helper->getTableTitle() ?></th>
16
+ </tr>
17
  </thead>
18
  <tbody>
19
  <?php
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);
31
+
32
+ if ($parcel >= $minParcelValue):
33
+ ?>
34
+ <tr>
35
+ <td><?php echo $tableText ?></td>
36
+ <td><?php echo $parcelPrice ?></td>
37
+ <tr>
38
+ <?php
39
+ endif;
40
+ endfor;
41
  endif;
42
  ?>
43
  </tbody>
44
  </table>
45
  <?php
46
+
47
  endif;
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>FranciscoPrado_PrecoParcelado</name>
4
- <version>1.1.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>Terceira vers&#xE3;o est&#xE1;vel.</notes>
12
  <authors><author><name>Francisco Prado</name><user>fr_prado</user><email>franciscontato@gmail.com</email></author></authors>
13
- <date>2014-08-06</date>
14
- <time>12:00:39</time>
15
- <contents><target name="magecommunity"><dir name="FranciscoPrado"><dir name="PrecoParcelado"><dir name="etc"><file name="config.xml" hash="b3848abc429b5560a7613f7936fc6fd5"/><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="5375174d15dc910bf48cff5f55c88eed"/></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="ea630f0ab4b7be6efc08cb40150194b7"/></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.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>
skin/frontend/base/default/js/precoparcelado.js CHANGED
@@ -70,7 +70,15 @@ $pp(document).ready(function() {
70
  };
71
 
72
  var onPriceChange = function(e) {
73
- var ppTotalPrice = $pp('#product-price-' + ppId + ' span').html();
 
 
 
 
 
 
 
 
74
  var ppCurrencyFormat = optionsPrice.priceFormat.pattern.replace('%s', '');
75
  var ppDecimalSymbol = optionsPrice.priceFormat.decimalSymbol;
76
  var ppGroupSymbol = optionsPrice.priceFormat.groupSymbol;
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;