ET_CurrencyManager - Version 0.2.5

Version Notes

stable release

Download this release

Release Info

Developer Magento Core Team
Extension ET_CurrencyManager
Version 0.2.5
Comparing to
See all releases


Code changes from version 0.2.3 to 0.2.5

app/code/community/ET/CurrencyManager/Block/Js.php CHANGED
@@ -23,10 +23,10 @@ class ET_CurrencyManager_Block_Js extends Mage_Core_Block_Template
23
  public function getJsonConfig()
24
  {
25
  if(method_exists(Mage::helper('core'),'jsonEncode')){
26
- return Mage::helper('core')->jsonEncode(Mage::helper('currencymanager')->getOptions(array()));
27
  }
28
  else {
29
- return Zend_Json::encode(Mage::helper('currencymanager')->getOptions(array()));
30
  }
31
 
32
 
23
  public function getJsonConfig()
24
  {
25
  if(method_exists(Mage::helper('core'),'jsonEncode')){
26
+ return Mage::helper('core')->jsonEncode(Mage::helper('currencymanager')->getOptions(array(),false,Mage::app()->getBaseCurrencyCode()));
27
  }
28
  else {
29
+ return Zend_Json::encode(Mage::helper('currencymanager')->getOptions(array(),false,Mage::app()->getBaseCurrencyCode()));
30
  }
31
 
32
 
app/code/community/ET/CurrencyManager/Model/Currency.php CHANGED
@@ -1,106 +1,117 @@
1
- <?php
2
- /**
3
- * ET Web Solutions
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- *
9
- * DISCLAIMER
10
- *
11
- * Do not edit or add to this file if you wish to upgrade to newer
12
- * versions in the future.
13
- *
14
- * @category ET
15
- * @package ET_CurrencyManager
16
- * @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
17
- * @contacts support@etwebsolutions.com
18
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
- */
20
-
21
- class ET_CurrencyManager_Model_Currency extends Mage_Directory_Model_Currency
22
- {
23
-
24
- /*
25
- public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
26
- {
27
- $config = Mage::getStoreConfig('currencymanager/general');
28
- $store = Mage::app()->getStore()->getStoreId();
29
-
30
- if (($config['enabledadm'])and($store=0))
31
- $options = Mage::helper('currencymanager')->getOptions($options);
32
-
33
- if (($config['enabled'])and($store>0))
34
- $options = Mage::helper('currencymanager')->getOptions($options);
35
-
36
- return parent::format($price, $options, $includeContainer, $addBrackets);
37
- }
38
- */
39
-
40
- public function getOutputFormat()
41
- {
42
- $formated = $this->formatTxt(1);
43
- $number = $this->formatTxt(1, array('display'=>Zend_Currency::NO_SYMBOL));
44
- return str_replace($number, '%s', $formated);
45
- }
46
-
47
- public function formatTxt($price, $options=array())
48
- {
49
-
50
- $answer = parent::formatTxt($price, $options);
51
- if(Mage::helper('currencymanager')->isEnabled())
52
- {
53
- $store = Mage::app()->getStore()->getStoreId();
54
- $moduleName = Mage::app()->getRequest()->getModuleName();
55
- $optionsAdvanced = Mage::helper('currencymanager')->getOptions($options,false,$this->getCurrencyCode());
56
- $options = Mage::helper('currencymanager')->getOptions($options,true,$this->getCurrencyCode());
57
-
58
- $answer = parent::formatTxt($price, $options);
59
-
60
- $suffix = isset($optionsAdvanced['cutzerodecimal_suffix'])?$optionsAdvanced['cutzerodecimal_suffix']:"";
61
-
62
- if (count($options)>0)
63
- {
64
-
65
- if (($moduleName == 'admin'))
66
- {
67
- $answer = parent::formatTxt($price, $options);
68
- }
69
-
70
-
71
- if (!(($moduleName == 'checkout') & $optionsAdvanced['excludecheckout']))
72
- {
73
-
74
- if($price==0)
75
- if(isset($optionsAdvanced['zerotext']))
76
- if($optionsAdvanced['zerotext']!="")return $optionsAdvanced['zerotext'];
77
-
78
- if ($optionsAdvanced['cutzerodecimal'] && (round($price,$optionsAdvanced['precision']) == round($price,0))) // cut decimal if it = 0
79
- {
80
- if ((isset($suffix)) && (strlen($suffix)>0)) // if need to add suffix
81
- {
82
- // searching for fully formatted currency without currency symbol
83
- $options['display'] = Zend_Currency::NO_SYMBOL;
84
- $answerBlank = parent::formatTxt($price, $options);
85
-
86
- // searching for fully formatted currency without currency symbol and rounded to int
87
- $options['precision'] = 0;
88
- $answerRound = parent::formatTxt($price, $options);
89
-
90
- // replace cutted decimals with suffix
91
- $answer=str_replace($answerBlank,$answerRound.$suffix,$answer);
92
- }
93
- else // esle only changing precision
94
- {
95
- $options['precision'] = 0;
96
- $answer = parent::formatTxt($price, $options);
97
- }
98
- }
99
- }
100
- }
101
- }
102
-
103
- return $answer;
104
- }
105
-
106
- }
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ET Web Solutions
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade to newer
12
+ * versions in the future.
13
+ *
14
+ * @category ET
15
+ * @package ET_CurrencyManager
16
+ * @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
17
+ * @contacts support@etwebsolutions.com
18
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
+ */
20
+
21
+ class ET_CurrencyManager_Model_Currency extends Mage_Directory_Model_Currency
22
+ {
23
+
24
+ /*
25
+ public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
26
+ {
27
+ $config = Mage::getStoreConfig('currencymanager/general');
28
+ $store = Mage::app()->getStore()->getStoreId();
29
+
30
+ if (($config['enabledadm'])and($store=0))
31
+ $options = Mage::helper('currencymanager')->getOptions($options);
32
+
33
+ if (($config['enabled'])and($store>0))
34
+ $options = Mage::helper('currencymanager')->getOptions($options);
35
+
36
+ return parent::format($price, $options, $includeContainer, $addBrackets);
37
+ }
38
+ */
39
+
40
+ public function getOutputFormat()
41
+ {
42
+ $formated = $this->formatTxt(1);
43
+ $number = $this->formatTxt(1, array('display'=>Zend_Currency::NO_SYMBOL));
44
+ return str_replace($number, '%s', $formated);
45
+ }
46
+
47
+ public function formatTxt($price, $options=array())
48
+ {
49
+
50
+ $answer = parent::formatTxt($price, $options);
51
+ if(Mage::helper('currencymanager')->isEnabled())
52
+ {
53
+ $store = Mage::app()->getStore()->getStoreId();
54
+ $moduleName = Mage::app()->getRequest()->getModuleName();
55
+ $optionsAdvanced = Mage::helper('currencymanager')->getOptions($options,false,$this->getCurrencyCode());
56
+ $options = Mage::helper('currencymanager')->getOptions($options,true,$this->getCurrencyCode());
57
+
58
+ $answer = parent::formatTxt($price, $options);
59
+
60
+ $suffix = isset($optionsAdvanced['cutzerodecimal_suffix'])?$optionsAdvanced['cutzerodecimal_suffix']:"";
61
+
62
+ if (count($options)>0)
63
+ {
64
+
65
+ if (($moduleName == 'admin'))
66
+ {
67
+ $answer = parent::formatTxt($price, $options);
68
+ }
69
+
70
+ if (!(($moduleName == 'checkout') & $optionsAdvanced['excludecheckout']))
71
+ {
72
+
73
+ if($price==0)
74
+ if(isset($optionsAdvanced['zerotext']))
75
+ if($optionsAdvanced['zerotext']!="")return $optionsAdvanced['zerotext'];
76
+
77
+ if ($optionsAdvanced['cutzerodecimal'] && (round($price,$optionsAdvanced['precision']) == round($price,0))) // cut decimal if it = 0
78
+ {
79
+ if ((isset($suffix)) && (strlen($suffix)>0)) // if need to add suffix
80
+ {
81
+ // searching for fully formatted currency without currency symbol
82
+ $options['display'] = Zend_Currency::NO_SYMBOL;
83
+ $answerBlank = $this->_localizeNumber(parent::formatTxt($price, $options));
84
+
85
+ // searching for fully formatted currency without currency symbol and rounded to int
86
+ $options['precision'] = 0;
87
+ $answerRound = $this->_localizeNumber(parent::formatTxt($price, $options));
88
+
89
+ // replace cutted decimals with suffix
90
+ $answer=str_replace($answerBlank,$answerRound.$suffix,$answer);
91
+ }
92
+ else // esle only changing precision
93
+ {
94
+ $options['precision'] = 0;
95
+ $answer = parent::formatTxt($price, $options);
96
+ }
97
+ }
98
+ }
99
+ }
100
+ }
101
+
102
+ return $answer;
103
+ }
104
+
105
+ protected function _localizeNumber($number)
106
+ {
107
+ $locale = Mage::app()->getLocale()->getLocaleCode();
108
+ $format = Zend_Locale_Data::getContent($locale, 'decimalnumber');
109
+ $number = Zend_Locale_Format::getNumber($number, array('locale' => $locale,
110
+ 'number_format' => $format,
111
+ 'precision' => 0));
112
+ return Zend_Locale_Format::toNumber($number, array('locale' => $locale,
113
+ 'number_format' => $format,
114
+ 'precision' => 0));
115
+ }
116
+
117
+ }
app/code/community/ET/CurrencyManager/etc/config.xml CHANGED
@@ -22,7 +22,7 @@
22
  <config>
23
  <modules>
24
  <ET_CurrencyManager>
25
- <version>0.2.3</version>
26
  <descr>
27
  <ru_RU><![CDATA[Позволяет управлять значениями локализации для валюты. Например: кол-во знаков после запятой для цены или символ валюты.]]>
28
  </ru_RU>
22
  <config>
23
  <modules>
24
  <ET_CurrencyManager>
25
+ <version>0.2.5</version>
26
  <descr>
27
  <ru_RU><![CDATA[Позволяет управлять значениями локализации для валюты. Например: кол-во знаков после запятой для цены или символ валюты.]]>
28
  </ru_RU>
app/code/community/ET/ET_CurrencyManager_ChangeLog.txt CHANGED
@@ -16,6 +16,12 @@ TODO:
16
 
17
  =====================================
18
 
 
 
 
 
 
 
19
  ver. 0.2.3 (29/09/2011)
20
  * fixed bug for displaying 2 different currencies in checkout
21
  * fixed bug for displaying negative precision using javascript
16
 
17
  =====================================
18
 
19
+ ver. 0.2.5 (20/01/2012)
20
+ * fixed bug in function, which replaces zero decimals with custom suffix (it was only in locales, where group separator is unbreakable whitespace - chr160)
21
+
22
+ ver. 0.2.4 (28/11/2011)
23
+ * fixed bug for displaying price instead zero text in configurable products when total price is zero
24
+
25
  ver. 0.2.3 (29/09/2011)
26
  * fixed bug for displaying 2 different currencies in checkout
27
  * fixed bug for displaying negative precision using javascript
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ET_CurrencyManager</name>
4
- <version>0.2.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/afl-3.0.php">AFL v3.0</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>auto-converted</user><email>support@etwebsolutions.com</email></author><author><name>Andrej</name><user>auto-converted</user><email>support@etwebsolutions.com</email></author></authors>
17
- <date>2011-09-30</date>
18
- <time>06:07:06</time>
19
- <contents><target name="magelocale"><dir name="en_US"><file name="ET_Currencymanager.csv" hash="c763398c9a2bcba295fe3ba623b6614f"/></dir><dir name="ru_RU"><file name="ET_Currencymanager.csv" hash="98bfa39b23bc23d511ed8cf1fd6977c1"/></dir></target><target name="magecommunity"><dir name="ET"><dir name="CurrencyManager"><dir name="Block"><dir name="Adminhtml"><file name="Formprice.php" hash="ca0be84893611f4c2ee870241ae14981"/><file name="Heading.php" hash="e60e170675c34ecfad27627fb40bbc17"/><file name="Symbolreplace.php" hash="8fbda51ecded6b82cafd5385c5fd8675"/></dir><file name="Js.php" hash="336a2b57ab7bcfdb6926cea9f3c724fe"/></dir><dir name="etc"><file name="config.xml" hash="b3947ddc7c8a4c6e83e961e494d517f9"/><file name="system.xml" hash="99c95b7a2e2459617156cc38cc66e88a"/></dir><dir name="Helper"><file name="Data.php" hash="f42d40721dccf886af047f723ad3d98d"/></dir><dir name="Model"><file name="Currency.php" hash="0d174e0b5a5a02cd414918a1adf7b242"/><file name="Locale.php" hash="ddaf2a78580afac7c5eb9b657c3b8dc7"/><file name="Typeposition.php" hash="cd4bd5df29fa4c042cbbe3c1927824a3"/><file name="Typesymboluse.php" hash="2cee3e1a03b39ee2aaf61387948c3fc9"/></dir></dir><file name="ET_CurrencyManager_ChangeLog.txt" hash="faaaeda20b2c09f4a5723a3ca4208d6d"/><file name="ET_CurrencyManager_Description.txt" hash="71f8a20d656437cd150c17ba138fced6"/><file name="ET_CurrencyManager_LICENSE.txt" hash="b799504264c23c11a941473d7a3e3ab7"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="et_currencymanager"><file name="et_currencymanager.js" hash="1d6dc4d48ab73b973ecf1cc152ade534"/><file name="et_currencymanager_round.js" hash="d4d2986d5d55807943ad4fe80eae7db4"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="et_currencymanager.xml" hash="6bccf55ecf305295e74b3b3edc07c374"/></dir><dir name="template"><dir name="et_currencymanager"><file name="js.phtml" hash="6083b321eac8ce899c6c58b892a430e7"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ET_CurrencyManager.xml" hash="c1951d24b4320ed1bf3704363b0ace86"/></dir></target></contents>
20
  <compatible/>
21
  <dependencies/>
22
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ET_CurrencyManager</name>
4
+ <version>0.2.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/afl-3.0.php">AFL v3.0</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>auto-converted</user><email>support@etwebsolutions.com</email></author><author><name>Andrej</name><user>auto-converted</user><email>support@etwebsolutions.com</email></author></authors>
17
+ <date>2012-01-20</date>
18
+ <time>17:54:36</time>
19
+ <contents><target name="magelocale"><dir name="en_US"><file name="ET_Currencymanager.csv" hash="c763398c9a2bcba295fe3ba623b6614f"/></dir><dir name="ru_RU"><file name="ET_Currencymanager.csv" hash="98bfa39b23bc23d511ed8cf1fd6977c1"/></dir></target><target name="magecommunity"><dir name="ET"><dir name="CurrencyManager"><dir name="Block"><dir name="Adminhtml"><file name="Formprice.php" hash="ca0be84893611f4c2ee870241ae14981"/><file name="Heading.php" hash="e60e170675c34ecfad27627fb40bbc17"/><file name="Symbolreplace.php" hash="8fbda51ecded6b82cafd5385c5fd8675"/></dir><file name="Js.php" hash="3bf23f441d9bc9bccf6479cbc949dafb"/></dir><dir name="etc"><file name="config.xml" hash="f07c6c1a7c99b574ae41b402b3d9046d"/><file name="system.xml" hash="99c95b7a2e2459617156cc38cc66e88a"/></dir><dir name="Helper"><file name="Data.php" hash="f42d40721dccf886af047f723ad3d98d"/></dir><dir name="Model"><file name="Currency.php" hash="4e8deb92bf3dea7aba9426ba68291761"/><file name="Locale.php" hash="ddaf2a78580afac7c5eb9b657c3b8dc7"/><file name="Typeposition.php" hash="cd4bd5df29fa4c042cbbe3c1927824a3"/><file name="Typesymboluse.php" hash="2cee3e1a03b39ee2aaf61387948c3fc9"/></dir></dir><file name="ET_CurrencyManager_ChangeLog.txt" hash="709d9d9c2a9b38aca785d73f7e8f7452"/><file name="ET_CurrencyManager_Description.txt" hash="71f8a20d656437cd150c17ba138fced6"/><file name="ET_CurrencyManager_LICENSE.txt" hash="b799504264c23c11a941473d7a3e3ab7"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="et_currencymanager"><file name="et_currencymanager.js" hash="1d6dc4d48ab73b973ecf1cc152ade534"/><file name="et_currencymanager_round.js" hash="d4d2986d5d55807943ad4fe80eae7db4"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="et_currencymanager.xml" hash="6bccf55ecf305295e74b3b3edc07c374"/></dir><dir name="template"><dir name="et_currencymanager"><file name="js.phtml" hash="6083b321eac8ce899c6c58b892a430e7"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ET_CurrencyManager.xml" hash="c1951d24b4320ed1bf3704363b0ace86"/></dir></target></contents>
20
  <compatible/>
21
  <dependencies/>
22
  </package>