ET_CurrencyManager - Version 0.2.3

Version Notes

stable release

Download this release

Release Info

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


Code changes from version 0.2.2 to 0.2.3

app/code/community/ET/CurrencyManager/Helper/Data.php CHANGED
@@ -35,15 +35,15 @@ class ET_CurrencyManager_Helper_Data extends Mage_Core_Helper_Abstract
35
  protected $_options = array();
36
  protected $_optionsadvanced = array();
37
 
38
- public function getOptions($options=array(), $old=false) // $old - for support Magento 1.3.x
39
  {
40
  $storeId=Mage::app()->getStore()->getStoreId();
41
- if ((!isset($this->_options[$storeId])) || (!isset($this->_optionsadvanced[$storeId])))
42
  {
43
- $this->setOptions();
44
  }
45
- $newOptions = $this->_options[$storeId];
46
- $newOptionsAdvanced = $this->_optionsadvanced[$storeId];
47
 
48
  if (!$old)
49
  $newOptions = $newOptions + $newOptionsAdvanced;
@@ -69,7 +69,7 @@ class ET_CurrencyManager_Helper_Data extends Mage_Core_Helper_Abstract
69
  }
70
 
71
 
72
- public function setOptions()
73
  {
74
  $config = Mage::getStoreConfig('currencymanager/general');
75
  $moduleName = Mage::app()->getRequest()->getModuleName();
@@ -114,7 +114,7 @@ class ET_CurrencyManager_Helper_Data extends Mage_Core_Helper_Abstract
114
 
115
  if(count($symbolreplace['currency'])>0)
116
  {
117
- $displayCurrencyCode = Mage::app()->getStore()-> getCurrentCurrencyCode(); //geting current display currency
118
 
119
  $configSubData = array_combine($symbolreplace['currency'], $symbolreplace['cutzerodecimal']);
120
  if (array_key_exists($displayCurrencyCode, $configSubData))
@@ -160,8 +160,13 @@ class ET_CurrencyManager_Helper_Data extends Mage_Core_Helper_Abstract
160
  }
161
  } // end NOT ENABLED
162
 
163
- $this->_options[$storeId] = $options;
164
- $this->_optionsadvanced[$storeId] = $optionsadvanced;
 
 
 
 
 
165
 
166
  return $this;
167
  }
35
  protected $_options = array();
36
  protected $_optionsadvanced = array();
37
 
38
+ public function getOptions($options=array(), $old=false,$currency="default") // $old - for support Magento 1.3.x
39
  {
40
  $storeId=Mage::app()->getStore()->getStoreId();
41
+ if ((!isset($this->_options[$storeId][$currency])) || (!isset($this->_optionsadvanced[$storeId][$currency])))
42
  {
43
+ $this->setOptions($currency);
44
  }
45
+ $newOptions = $this->_options[$storeId][$currency];
46
+ $newOptionsAdvanced = $this->_optionsadvanced[$storeId][$currency];
47
 
48
  if (!$old)
49
  $newOptions = $newOptions + $newOptionsAdvanced;
69
  }
70
 
71
 
72
+ public function setOptions($currency="default")
73
  {
74
  $config = Mage::getStoreConfig('currencymanager/general');
75
  $moduleName = Mage::app()->getRequest()->getModuleName();
114
 
115
  if(count($symbolreplace['currency'])>0)
116
  {
117
+ $displayCurrencyCode = $currency; //geting current display currency
118
 
119
  $configSubData = array_combine($symbolreplace['currency'], $symbolreplace['cutzerodecimal']);
120
  if (array_key_exists($displayCurrencyCode, $configSubData))
160
  }
161
  } // end NOT ENABLED
162
 
163
+ $this->_options[$storeId][$currency] = $options;
164
+ $this->_optionsadvanced[$storeId][$currency] = $optionsadvanced;
165
+ if(!isset($this->_options[$storeId]["default"]))
166
+ {
167
+ $this->_options[$storeId]["default"] = $options;
168
+ $this->_optionsadvanced[$storeId]["default"] = $optionsadvanced;
169
+ }
170
 
171
  return $this;
172
  }
app/code/community/ET/CurrencyManager/Model/Currency.php CHANGED
@@ -46,13 +46,14 @@ public function format($price, $options=array(), $includeContainer = true, $addB
46
 
47
  public function formatTxt($price, $options=array())
48
  {
 
49
  $answer = parent::formatTxt($price, $options);
50
  if(Mage::helper('currencymanager')->isEnabled())
51
  {
52
  $store = Mage::app()->getStore()->getStoreId();
53
  $moduleName = Mage::app()->getRequest()->getModuleName();
54
- $optionsAdvanced = Mage::helper('currencymanager')->getOptions($options);
55
- $options = Mage::helper('currencymanager')->getOptions($options,true);
56
 
57
  $answer = parent::formatTxt($price, $options);
58
 
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
 
app/code/community/ET/CurrencyManager/Model/Locale.php CHANGED
@@ -23,8 +23,8 @@ class ET_CurrencyManager_Model_Locale extends Mage_Core_Model_Locale
23
  public function currency($ccode)
24
  {
25
  $admcurrency = parent::currency($ccode);
26
- $options = Mage::helper('currencymanager')->getOptions(array(),true);
27
- $admcurrency->setFormat($options);
28
 
29
  return $admcurrency;
30
  }
23
  public function currency($ccode)
24
  {
25
  $admcurrency = parent::currency($ccode);
26
+ $options = Mage::helper('currencymanager')->getOptions(array(),true,$ccode);
27
+ $admcurrency->setFormat($options, $ccode);
28
 
29
  return $admcurrency;
30
  }
app/code/community/ET/CurrencyManager/etc/config.xml CHANGED
@@ -22,7 +22,7 @@
22
  <config>
23
  <modules>
24
  <ET_CurrencyManager>
25
- <version>0.2.2</version>
26
  <descr>
27
  <ru_RU><![CDATA[Позволяет управлять значениями локализации для валюты. Например: кол-во знаков после запятой для цены или символ валюты.]]>
28
  </ru_RU>
22
  <config>
23
  <modules>
24
  <ET_CurrencyManager>
25
+ <version>0.2.3</version>
26
  <descr>
27
  <ru_RU><![CDATA[Позволяет управлять значениями локализации для валюты. Например: кол-во знаков после запятой для цены или символ валюты.]]>
28
  </ru_RU>
app/code/community/ET/ET_CurrencyManager_ChangeLog.txt CHANGED
@@ -13,10 +13,14 @@ 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
- + Add ability to add price suffix. Example: make from 99.00 USD this 99,- USD
17
 
18
  =====================================
19
 
 
 
 
 
 
20
  ver. 0.2.2 (17/08/2011)
21
  + Replace zero decimals with suffix. Example: display 49,- instead of 49.00 or 49, but 49.99 remains unchanged.
22
  + Enable/Disable price rounding (precision parameter) on product input\edit page
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
 
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
22
+ * added type="text/javascript" for scrypt tag (w3c validation is ok now)
23
+
24
  ver. 0.2.2 (17/08/2011)
25
  + Replace zero decimals with suffix. Example: display 49,- instead of 49.00 or 49, but 49.99 remains unchanged.
26
  + Enable/Disable price rounding (precision parameter) on product input\edit page
app/design/frontend/default/default/template/et_currencymanager/js.phtml CHANGED
@@ -18,6 +18,6 @@
18
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
  */
20
  ?>
21
- <script>
22
  etCurrencyManagerJsConfig=<?php print $this->getJsonConfig();?>
23
  </script>
18
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
  */
20
  ?>
21
+ <script type="text/javascript">
22
  etCurrencyManagerJsConfig=<?php print $this->getJsonConfig();?>
23
  </script>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ET_CurrencyManager</name>
4
- <version>0.2.2</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-08-18</date>
18
- <time>06:53:50</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="d7becbc5aa8679f218364729a1b78caa"/><file name="system.xml" hash="99c95b7a2e2459617156cc38cc66e88a"/></dir><dir name="Helper"><file name="Data.php" hash="15b55f1f73a6b0ef19348d0d88b247cd"/></dir><dir name="Model"><file name="Currency.php" hash="e9292f4773ea244a48aa1fc55e8cc099"/><file name="Locale.php" hash="aa958546193577922e0df3f0e851b288"/><file name="Typeposition.php" hash="cd4bd5df29fa4c042cbbe3c1927824a3"/><file name="Typesymboluse.php" hash="2cee3e1a03b39ee2aaf61387948c3fc9"/></dir></dir><file name="ET_CurrencyManager_ChangeLog.txt" hash="8845d5544f8a393693a7e39f2c72b1cf"/><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="29d7a346ee4fad01afa5dc7b4661f1b5"/><file name="et_currencymanager_round.js" hash="6e337696b5afdfeb44d37c46311ff1e0"/></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="2d3e3c3e8993781385bedad19641c2f6"/></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.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
  * 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>
skin/frontend/default/default/et_currencymanager/et_currencymanager.js CHANGED
@@ -7,6 +7,8 @@ if(typeof(Product)!="undefined"){
7
  tmpPriceFormat.precision=0;
8
  tmpPriceFormat.requiredPrecision=0;
9
  }
 
 
10
  var price2return = formatCurrency(price, tmpPriceFormat);
11
  return price2return;
12
  }});
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
  }});
skin/frontend/default/default/et_currencymanager/et_currencymanager_round.js CHANGED
@@ -33,10 +33,12 @@ if(typeof(Product)!="undefined"){
33
  if(precision>0)str+= this.priceTemplate.evaluate({price:price.toFixed(precision)});
34
  else{
35
 
36
- if(typeof(etCurrencyManagerJsConfig.cutzerodecimal_suffix)!="undefined")
37
- if(etCurrencyManagerJsConfig.cutzerodecimal_suffix.length>0){
38
- price= price.toFixed(0)+""+etCurrencyManagerJsConfig.cutzerodecimal_suffix;
39
- }
 
 
40
  str+= this.priceTemplate.evaluate({price:price});
41
  }
42
  }
@@ -74,6 +76,9 @@ try{
74
 
75
  }
76
  }
 
 
 
77
 
78
  return originalFormatCurrency(price, format, showPlus);
79
 
33
  if(precision>0)str+= this.priceTemplate.evaluate({price:price.toFixed(precision)});
34
  else{
35
 
36
+ if(typeof(etCurrencyManagerJsConfig.cutzerodecimal)!="undefined")
37
+ if(etCurrencyManagerJsConfig.cutzerodecimal!=0)
38
+ if(typeof(etCurrencyManagerJsConfig.cutzerodecimal_suffix)!="undefined")
39
+ if(etCurrencyManagerJsConfig.cutzerodecimal_suffix.length>0){
40
+ price= price.toFixed(0)+""+etCurrencyManagerJsConfig.cutzerodecimal_suffix;
41
+ }
42
  str+= this.priceTemplate.evaluate({price:price});
43
  }
44
  }
76
 
77
  }
78
  }
79
+
80
+ if(format.precision<0)format.precision=0;
81
+ if(format.requiredPrecision<0)format.requiredPrecision=0;
82
 
83
  return originalFormatCurrency(price, format, showPlus);
84