ET_CurrencyManager - Version 0.2.6

Version Notes

stable release

Download this release

Release Info

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


Code changes from version 0.2.5 to 0.2.6

app/code/community/ET/CurrencyManager/Model/Currency.php CHANGED
@@ -56,7 +56,7 @@ public function format($price, $options=array(), $includeContainer = true, $addB
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)
@@ -80,11 +80,13 @@ public function format($price, $options=array(), $includeContainer = true, $addB
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);
@@ -102,16 +104,25 @@ public function format($price, $options=array(), $includeContainer = true, $addB
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
  }
56
  $options = Mage::helper('currencymanager')->getOptions($options,true,$this->getCurrencyCode());
57
 
58
  $answer = parent::formatTxt($price, $options);
59
+ //print "answer: " . $answer . "<br />";
60
  $suffix = isset($optionsAdvanced['cutzerodecimal_suffix'])?$optionsAdvanced['cutzerodecimal_suffix']:"";
61
 
62
  if (count($options)>0)
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), $options);
84
 
85
+ //print "answerBlank: " . $answerBlank . "<br />";
86
  // searching for fully formatted currency without currency symbol and rounded to int
87
  $options['precision'] = 0;
88
+ $answerRound = $this->_localizeNumber(parent::formatTxt($price, $options), $options);
89
+ //print "answerRound: " . $answerRound . "<br />";
90
 
91
  // replace cutted decimals with suffix
92
  $answer=str_replace($answerBlank,$answerRound.$suffix,$answer);
104
  return $answer;
105
  }
106
 
107
+ protected function _localizeNumber($number, $options = array())
108
  {
109
+ $options = Mage::helper('currencymanager')->getOptions($options,true,$this->getCurrencyCode());
110
+ if ($options['display'] == Zend_Currency::NO_SYMBOL)
111
+ {
112
+ // in Zend_Currency toCurrency() function are stripped unbreakable spaces only for currency without Currency Symbol
113
+ return $number;
114
+ }
115
+ else
116
+ {
117
+ $locale = Mage::app()->getLocale()->getLocaleCode();
118
+ $format = Zend_Locale_Data::getContent($locale, 'decimalnumber');
119
+ $number = Zend_Locale_Format::getNumber($number, array('locale' => $locale,
120
+ 'number_format' => $format,
121
+ 'precision' => 0));
122
+ return Zend_Locale_Format::toNumber($number, array('locale' => $locale,
123
+ 'number_format' => $format,
124
+ 'precision' => 0));
125
+ }
126
  }
127
 
128
  }
app/code/community/ET/CurrencyManager/etc/config.xml CHANGED
@@ -22,7 +22,7 @@
22
  <config>
23
  <modules>
24
  <ET_CurrencyManager>
25
- <version>0.2.5</version>
26
  <descr>
27
  <ru_RU><![CDATA[Позволяет управлять значениями локализации для валюты. Например: кол-во знаков после запятой для цены или символ валюты.]]>
28
  </ru_RU>
22
  <config>
23
  <modules>
24
  <ET_CurrencyManager>
25
+ <version>0.2.6</version>
26
  <descr>
27
  <ru_RU><![CDATA[Позволяет управлять значениями локализации для валюты. Например: кол-во знаков после запятой для цены или символ валюты.]]>
28
  </ru_RU>
app/code/community/ET/ET_CurrencyManager_ChangeLog.txt CHANGED
@@ -16,6 +16,9 @@ TODO:
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
 
16
 
17
  =====================================
18
 
19
+ ver. 0.2.6 (23/01/2012)
20
+ * fixed bug in function, which replaces zero decimals with custom suffix (for currency without currency symbol)
21
+
22
  ver. 0.2.5 (20/01/2012)
23
  * fixed bug in function, which replaces zero decimals with custom suffix (it was only in locales, where group separator is unbreakable whitespace - chr160)
24
 
package.xml CHANGED
@@ -1,7 +1,7 @@
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,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>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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ET_CurrencyManager</name>
4
+ <version>0.2.6</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-23</date>
18
+ <time>14:47:43</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="bb341c8c5af36eb4aff165e084999f5b"/><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="dd442daa85a7be3aa2279895464a8c1d"/><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="71bea2dd1c853b983e0db86ede6beb56"/><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>