ET_CurrencyManager - Version 1.0.2

Version Notes

stable release

Download this release

Release Info

Developer Jurij
Extension ET_CurrencyManager
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/community/ET/CurrencyManager/Block/Adminhtml/Heading.php CHANGED
@@ -17,9 +17,11 @@
17
  * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
  */
19
 
20
- if (version_compare(Mage::getVersion(), '1.4', '<')) {
21
- class ET_CurrencyManager_Block_Adminhtml_Heading
22
- extends Mage_Adminhtml_Block_Abstract
 
 
23
  implements Varien_Data_Form_Element_Renderer_Interface
24
  {
25
 
17
  * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
  */
19
 
20
+ //if (!class_exists('Mage_Adminhtml_Block_System_Config_Form_Field_Heading')) {
21
+ // https://bugs.php.net/bug.php?id=52339
22
+ if (version_compare(Mage::getVersion(), '1.4.1', '<')) {
23
+ class ET_CurrencyManager_Block_Adminhtml_Heading
24
+ extends Mage_Adminhtml_Block_Abstract
25
  implements Varien_Data_Form_Element_Renderer_Interface
26
  {
27
 
app/code/community/ET/CurrencyManager/Helper/Data.php CHANGED
@@ -150,7 +150,7 @@ class ET_CurrencyManager_Helper_Data extends Mage_Core_Helper_Abstract
150
  $tmpOptionsAdvanced = array();
151
 
152
  $tmpOptionsAdvanced['cutzerodecimal'] = $this->_getCurrencyOption(
153
- $currency, $symbolReplace, 'cutzerodecimal', false, true
154
  );
155
 
156
  if (isset($symbolReplace['cutzerodecimal_suffix'])) {
@@ -159,8 +159,8 @@ class ET_CurrencyManager_Helper_Data extends Mage_Core_Helper_Abstract
159
  );
160
  }
161
 
162
- $tmpOptions['position'] = $this->_getCurrencyOption($currency, $symbolReplace, 'position', false, true);
163
- $tmpOptions['display'] = $this->_getCurrencyOption($currency, $symbolReplace, 'display', false, true);
164
  $tmpOptions['symbol'] = $this->_getCurrencyOption($currency, $symbolReplace, 'symbol');
165
 
166
  if ($notCheckout) {
@@ -168,7 +168,7 @@ class ET_CurrencyManager_Helper_Data extends Mage_Core_Helper_Abstract
168
  $currency, $symbolReplace, 'zerotext'
169
  );
170
 
171
- $precision = $this->_getCurrencyOption($currency, $symbolReplace, 'precision', false, true);
172
  if ($precision !== false) {
173
  $tmpOptions['precision'] = min(30, max(-1, $precision));
174
  }
@@ -236,13 +236,15 @@ class ET_CurrencyManager_Helper_Data extends Mage_Core_Helper_Abstract
236
  $this->_optionsadvanced = array();
237
  }
238
 
239
- protected function _getCurrencyOption($currency, $symbolReplace, $option, $checkEmpty = true, $int = false)
240
  {
241
  $configSubData = array_combine($symbolReplace['currency'], $symbolReplace[$option]);
242
  if (array_key_exists($currency, $configSubData)) {
243
- if (!$checkEmpty || $configSubData[$currency] != "") {
244
- return ($int) ? (int)$configSubData[$currency] : $configSubData[$currency];
 
245
  }
 
246
  }
247
  return false;
248
  }
150
  $tmpOptionsAdvanced = array();
151
 
152
  $tmpOptionsAdvanced['cutzerodecimal'] = $this->_getCurrencyOption(
153
+ $currency, $symbolReplace, 'cutzerodecimal', true
154
  );
155
 
156
  if (isset($symbolReplace['cutzerodecimal_suffix'])) {
159
  );
160
  }
161
 
162
+ $tmpOptions['position'] = $this->_getCurrencyOption($currency, $symbolReplace, 'position', true);
163
+ $tmpOptions['display'] = $this->_getCurrencyOption($currency, $symbolReplace, 'display', true);
164
  $tmpOptions['symbol'] = $this->_getCurrencyOption($currency, $symbolReplace, 'symbol');
165
 
166
  if ($notCheckout) {
168
  $currency, $symbolReplace, 'zerotext'
169
  );
170
 
171
+ $precision = $this->_getCurrencyOption($currency, $symbolReplace, 'precision', true);
172
  if ($precision !== false) {
173
  $tmpOptions['precision'] = min(30, max(-1, $precision));
174
  }
236
  $this->_optionsadvanced = array();
237
  }
238
 
239
+ protected function _getCurrencyOption($currency, $symbolReplace, $option, $int = false)
240
  {
241
  $configSubData = array_combine($symbolReplace['currency'], $symbolReplace[$option]);
242
  if (array_key_exists($currency, $configSubData)) {
243
+ $value = $configSubData[$currency];
244
+ if ($value === "") {
245
+ return false;
246
  }
247
+ return ($int) ? (int)$value : $value;
248
  }
249
  return false;
250
  }
app/code/community/ET/CurrencyManager/etc/config.xml CHANGED
@@ -22,7 +22,7 @@
22
  <modules>
23
  <ET_CurrencyManager>
24
  <name>ET Currency Manager</name>
25
- <version>1.0.1</version>
26
  <descr>
27
  <ru_RU><![CDATA[Модуль позволяет владельцу магазина просто и удобно управлять отображением цены: указывать свой символ валюты, количество знаков после запятой, позицию символа и др.]]>
28
  </ru_RU>
22
  <modules>
23
  <ET_CurrencyManager>
24
  <name>ET Currency Manager</name>
25
+ <version>1.0.2</version>
26
  <descr>
27
  <ru_RU><![CDATA[Модуль позволяет владельцу магазина просто и удобно управлять отображением цены: указывать свой символ валюты, количество знаков после запятой, позицию символа и др.]]>
28
  </ru_RU>
app/code/community/ET/ET_CurrencyManager_ChangeLog.txt CHANGED
@@ -13,8 +13,15 @@ TODO:
13
  decimal separator (, or .)
14
  Так как в ядре Магенто это не реализовано, то придётся писать на прямую в файлы /lib/Zend/Locale/Data/
15
  Since it is not implemented in the Magento core, it will have to write directly to files in /lib/Zend/Locale/Data/
16
-
17
  =====================================
 
 
 
 
 
 
 
18
  ver. 1.0.1 (13/09/2012)
19
  * BOM in helper removed
20
 
13
  decimal separator (, or .)
14
  Так как в ядре Магенто это не реализовано, то придётся писать на прямую в файлы /lib/Zend/Locale/Data/
15
  Since it is not implemented in the Magento core, it will have to write directly to files in /lib/Zend/Locale/Data/
16
+ * Reallocate js files (from skin to js folder)
17
  =====================================
18
+
19
+ ver. 1.0.2 (28/09/2012)
20
+ * Fixed problem with entering configuration in Magento 1.4.0.0
21
+ * Fixed problem in JS for configurable products (in some cases price was XX.0000001 or xx.9999999)
22
+ * Fixed JS for error with disabled Module output
23
+ * Fixed JS Stackoverflow in IE
24
+
25
  ver. 1.0.1 (13/09/2012)
26
  * BOM in helper removed
27
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ET_CurrencyManager</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://shop.etwebsolutions.com/eng/etws-license-free-v1">ETWS Free License (EFL1)</license>
7
  <channel>community</channel>
@@ -14,9 +14,9 @@
14
  * symbol type (name, short name/code, symbol)</description>
15
  <notes>stable release</notes>
16
  <authors><author><name>Jurij</name><user>niro</user><email>support@etwebsolutions.com</email></author><author><name>Andrej</name><user>zlojd</user><email>support@etwebsolutions.com</email></author></authors>
17
- <date>2012-09-13</date>
18
- <time>11:04:24</time>
19
- <contents><target name="magecommunity"><dir name="ET"><dir name="CurrencyManager"><dir name="Block"><dir name="Adminhtml"><file name="Formprice.php" hash="787bb8c6466fd5b58edff9119aeca6f0"/><file name="Heading.php" hash="2bc94642d582b2b1410fd03c812801bb"/><file name="Support.php" hash="c6a46702557a855dbdedd370f8981551"/><file name="Symbolreplace.php" hash="575dd05525aaa2fba90fa17703db373b"/><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Linktooptions.php" hash="254eef26e1ae0edecc76a31541b244ae"/></dir></dir></dir></dir></dir><file name="Js.php" hash="086a2b3e70400c840615fd499ab5883e"/></dir><dir name="Helper"><file name="Data.php" hash="99512f5dfcc1788baec8b761e6954684"/></dir><dir name="Model"><file name="Currency.php" hash="6cb15c536e758b727dcb291f5bb6d0d6"/><file name="Locale.php" hash="5f4d8d523f8d7a351f5afc952cdc9dd5"/><file name="Store.php" hash="c4894be6525eca58ef8efa909f87f959"/><file name="Typeposition.php" hash="9132477fac1f0bc56be36e18613ff23c"/><file name="Typesymboluse.php" hash="50b7bdd60eb040007f1b8f5bd9486b19"/></dir><dir name="etc"><file name="config.xml" hash="03fb8f828b74f75bf67b3e317b5c969f"/><file name="system.xml" hash="9e055baa423482a3e3b3970f3aa9479e"/></dir></dir><file name="ET_CurrencyManager_ChangeLog.txt" hash="cc57d9ba7d6d525fa7afee903e891550"/><file name="ET_CurrencyManager_Description.txt" hash="8173c4954c3817d7ca455d47ab1054c0"/><file name="ET_CurrencyManager_LICENSE.txt" hash="c6b1377314f742d1cc53bbe1c23730be"/></dir></target><target name="magelocale"><dir name="ru_RU"><file name="ET_Currencymanager.csv" hash="4e3660d05aeb3623031169a55d34d649"/></dir><dir name="en_US"><file name="ET_Currencymanager.csv" hash="c763398c9a2bcba295fe3ba623b6614f"/></dir></target><target name="mageetc"><dir name="modules"><file name="ET_CurrencyManager.xml" hash="3c6bef9710e3c4922e45f962a41e1f9e"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="et_currencymanager.xml" hash="4f533fa64b1efdbc9c31fd974ffb534d"/></dir><dir name="template"><dir name="et_currencymanager"><file name="js.phtml" hash="0274f020be65ff87521d1ba053a31ad3"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="et_currencymanager"><file name="et_currencymanager.js" hash="0776bdd6350c39ce01a8a4846033697f"/><file name="et_currencymanager_round.js" hash="9eb7672b6a03669463c8caa22e4c7d44"/></dir></dir></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
22
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ET_CurrencyManager</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://shop.etwebsolutions.com/eng/etws-license-free-v1">ETWS Free License (EFL1)</license>
7
  <channel>community</channel>
14
  * symbol type (name, short name/code, symbol)</description>
15
  <notes>stable release</notes>
16
  <authors><author><name>Jurij</name><user>niro</user><email>support@etwebsolutions.com</email></author><author><name>Andrej</name><user>zlojd</user><email>support@etwebsolutions.com</email></author></authors>
17
+ <date>2012-10-25</date>
18
+ <time>10:15:31</time>
19
+ <contents><target name="magecommunity"><dir name="ET"><dir name="CurrencyManager"><dir name="Block"><dir name="Adminhtml"><file name="Formprice.php" hash="787bb8c6466fd5b58edff9119aeca6f0"/><file name="Heading.php" hash="0282201202dfbe3c2a9a7f0e3016bbd4"/><file name="Support.php" hash="c6a46702557a855dbdedd370f8981551"/><file name="Symbolreplace.php" hash="575dd05525aaa2fba90fa17703db373b"/><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Linktooptions.php" hash="254eef26e1ae0edecc76a31541b244ae"/></dir></dir></dir></dir></dir><file name="Js.php" hash="086a2b3e70400c840615fd499ab5883e"/></dir><dir name="Helper"><file name="Data.php" hash="d3056f75b04c2acc19e75ea0384450a0"/></dir><dir name="Model"><file name="Currency.php" hash="6cb15c536e758b727dcb291f5bb6d0d6"/><file name="Locale.php" hash="5f4d8d523f8d7a351f5afc952cdc9dd5"/><file name="Store.php" hash="c4894be6525eca58ef8efa909f87f959"/><file name="Typeposition.php" hash="9132477fac1f0bc56be36e18613ff23c"/><file name="Typesymboluse.php" hash="50b7bdd60eb040007f1b8f5bd9486b19"/></dir><dir name="etc"><file name="config.xml" hash="197e3a8f7fdd24906f0d0f5dbe6c76e2"/><file name="system.xml" hash="9e055baa423482a3e3b3970f3aa9479e"/></dir></dir><file name="ET_CurrencyManager_ChangeLog.txt" hash="d0411f00c96e2ab1d08958e3f502691d"/><file name="ET_CurrencyManager_Description.txt" hash="8173c4954c3817d7ca455d47ab1054c0"/><file name="ET_CurrencyManager_LICENSE.txt" hash="c6b1377314f742d1cc53bbe1c23730be"/></dir></target><target name="magelocale"><dir name="ru_RU"><file name="ET_Currencymanager.csv" hash="4e3660d05aeb3623031169a55d34d649"/></dir><dir name="en_US"><file name="ET_Currencymanager.csv" hash="c763398c9a2bcba295fe3ba623b6614f"/></dir></target><target name="mageetc"><dir name="modules"><file name="ET_CurrencyManager.xml" hash="3c6bef9710e3c4922e45f962a41e1f9e"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="et_currencymanager.xml" hash="4f533fa64b1efdbc9c31fd974ffb534d"/></dir><dir name="template"><dir name="et_currencymanager"><file name="js.phtml" hash="0274f020be65ff87521d1ba053a31ad3"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="et_currencymanager"><file name="et_currencymanager.js" hash="4eccc0024cae9c67123584d2cac2f38a"/><file name="et_currencymanager_round.js" hash="a57cee1500b4ab851110982fcaea4f36"/></dir></dir></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
22
  </package>
skin/frontend/default/default/et_currencymanager/et_currencymanager.js CHANGED
@@ -1,15 +1,18 @@
1
- var globalCutZeroSignPrice=true;
2
- if(typeof(Product)!="undefined"){
3
- Product.OptionsPrice.prototype=Object.extend(Product.OptionsPrice.prototype, {formatPrice:function(price)
4
- {
5
- var tmpPriceFormat = Object.clone(this.priceFormat);
6
- if(price-parseInt(price)==0){
7
- tmpPriceFormat.precision=0;
8
- tmpPriceFormat.requiredPrecision=0;
9
- }
10
- if(tmpPriceFormat.precision<0)tmpPriceFormat.precision=0;
11
- if(tmpPriceFormat.requiredPrecision<0)tmpPriceFormat.requiredPrecision=0;
12
- var price2return = formatCurrency(price, tmpPriceFormat);
13
- return price2return;
14
- }});
 
 
 
15
  }
1
+ var globalCutZeroSignPrice = true;
2
+ if (typeof(Product) != "undefined") {
3
+ Product.OptionsPrice.prototype = Object.extend(Product.OptionsPrice.prototype, {formatPrice:function (price) {
4
+ var tmpPriceFormat = Object.clone(this.priceFormat);
5
+ if (price - parseInt(price) == 0) {
6
+ tmpPriceFormat.precision = 0;
7
+ tmpPriceFormat.requiredPrecision = 0;
8
+ }
9
+ if (tmpPriceFormat.precision < 0) {
10
+ tmpPriceFormat.precision = 0;
11
+ }
12
+ if (tmpPriceFormat.requiredPrecision < 0) {
13
+ tmpPriceFormat.requiredPrecision = 0;
14
+ }
15
+ var price2return = formatCurrency(price, tmpPriceFormat);
16
+ return price2return;
17
+ }});
18
  }
skin/frontend/default/default/et_currencymanager/et_currencymanager_round.js CHANGED
@@ -20,18 +20,22 @@ if (typeof(Product) != "undefined") {
20
  }
21
  else {
22
  precision = 2;
23
- if (typeof(etCurrencyManagerJsConfig.precision) != "undefined") {
24
- precision = etCurrencyManagerJsConfig.precision;
 
 
25
  }
26
  if (typeof(optionsPrice) != "undefined") {
27
  if (typeof(optionsPrice.priceFormat) != "undefined") {
28
  precision = optionsPrice.priceFormat.requiredPrecision;
29
  }
30
  }
31
- if (typeof(etCurrencyManagerJsConfig.cutzerodecimal) != "undefined") {
32
- if (etCurrencyManagerJsConfig.cutzerodecimal != 0) {
33
- if (price - Math.round(price) == 0) {
34
- precision = 0;
 
 
35
  }
36
  }
37
  }
@@ -39,11 +43,14 @@ if (typeof(Product) != "undefined") {
39
  str += this.priceTemplate.evaluate({price:price.toFixed(precision)});
40
  }
41
  else {
42
- if (typeof(etCurrencyManagerJsConfig.cutzerodecimal) != "undefined") {
43
- if (etCurrencyManagerJsConfig.cutzerodecimal != 0) {
44
- if (typeof(etCurrencyManagerJsConfig.cutzerodecimal_suffix) != "undefined") {
45
- if (etCurrencyManagerJsConfig.cutzerodecimal_suffix.length > 0) {
46
- price = price.toFixed(0) + "" + etCurrencyManagerJsConfig.cutzerodecimal_suffix;
 
 
 
47
  }
48
  }
49
  }
@@ -63,7 +70,7 @@ try {
63
 
64
  originalFormatCurrency = window.formatCurrency;
65
 
66
- window.formatCurrency = function formatCurrency(price, format, showPlus) {
67
  //zeroSymbol
68
  //JS round fix
69
  price = Math.round(price * Math.pow(10, format.precision)) / Math.pow(10, format.precision);
@@ -81,16 +88,19 @@ try {
81
  }
82
  //cut zero decimal
83
  if (price - Math.round(price) == 0) {
84
- if (typeof(etCurrencyManagerJsConfig.cutzerodecimal) != "undefined") {
85
- if (etCurrencyManagerJsConfig.cutzerodecimal != 0) {
86
- format.precision = 0;
87
- format.requiredPrecision = 0;
 
88
 
89
- var for_replace = originalFormatCurrency(price, format, showPlus);
90
 
91
- if (typeof(etCurrencyManagerJsConfig.cutzerodecimal_suffix) != "undefined") {
92
- if (etCurrencyManagerJsConfig.cutzerodecimal_suffix.length > 0) {
93
- return for_replace.replace(price, price + "" + etCurrencyManagerJsConfig.cutzerodecimal_suffix);
 
 
94
  }
95
  }
96
  }
20
  }
21
  else {
22
  precision = 2;
23
+ if (typeof(etCurrencyManagerJsConfig) != "undefined") {
24
+ if (typeof(etCurrencyManagerJsConfig.precision) != "undefined") {
25
+ precision = etCurrencyManagerJsConfig.precision;
26
+ }
27
  }
28
  if (typeof(optionsPrice) != "undefined") {
29
  if (typeof(optionsPrice.priceFormat) != "undefined") {
30
  precision = optionsPrice.priceFormat.requiredPrecision;
31
  }
32
  }
33
+ if (typeof(etCurrencyManagerJsConfig) != "undefined") {
34
+ if (typeof(etCurrencyManagerJsConfig.cutzerodecimal) != "undefined") {
35
+ if (etCurrencyManagerJsConfig.cutzerodecimal != 0) {
36
+ if (price - Math.round(price) == 0) {
37
+ precision = 0;
38
+ }
39
  }
40
  }
41
  }
43
  str += this.priceTemplate.evaluate({price:price.toFixed(precision)});
44
  }
45
  else {
46
+ price = price.toFixed(0);
47
+ if (typeof(etCurrencyManagerJsConfig) != "undefined") {
48
+ if (typeof(etCurrencyManagerJsConfig.cutzerodecimal) != "undefined") {
49
+ if (etCurrencyManagerJsConfig.cutzerodecimal != 0) {
50
+ if (typeof(etCurrencyManagerJsConfig.cutzerodecimal_suffix) != "undefined") {
51
+ if (etCurrencyManagerJsConfig.cutzerodecimal_suffix.length > 0) {
52
+ price = price + "" + etCurrencyManagerJsConfig.cutzerodecimal_suffix;
53
+ }
54
  }
55
  }
56
  }
70
 
71
  originalFormatCurrency = window.formatCurrency;
72
 
73
+ window.formatCurrency = function (price, format, showPlus) {
74
  //zeroSymbol
75
  //JS round fix
76
  price = Math.round(price * Math.pow(10, format.precision)) / Math.pow(10, format.precision);
88
  }
89
  //cut zero decimal
90
  if (price - Math.round(price) == 0) {
91
+ if (typeof(etCurrencyManagerJsConfig) != "undefined") {
92
+ if (typeof(etCurrencyManagerJsConfig.cutzerodecimal) != "undefined") {
93
+ if (etCurrencyManagerJsConfig.cutzerodecimal != 0) {
94
+ format.precision = 0;
95
+ format.requiredPrecision = 0;
96
 
97
+ var for_replace = originalFormatCurrency(price, format, showPlus);
98
 
99
+ if (typeof(etCurrencyManagerJsConfig.cutzerodecimal_suffix) != "undefined") {
100
+ if (etCurrencyManagerJsConfig.cutzerodecimal_suffix.length > 0) {
101
+ return for_replace.replace(price, price + ""
102
+ + etCurrencyManagerJsConfig.cutzerodecimal_suffix);
103
+ }
104
  }
105
  }
106
  }