ET_CurrencyManager - Version 1.0.0

Version Notes

stable release

Download this release

Release Info

Developer Jurij
Extension ET_CurrencyManager
Version 1.0.0
Comparing to
See all releases


Code changes from version 0.2.6 to 1.0.0

Files changed (24) hide show
  1. app/code/community/ET/CurrencyManager/Block/Adminhtml/Formprice.php +17 -19
  2. app/code/community/ET/CurrencyManager/Block/Adminhtml/Heading.php +23 -24
  3. app/code/community/ET/CurrencyManager/Block/Adminhtml/Support.php +122 -0
  4. app/code/community/ET/CurrencyManager/Block/Adminhtml/Symbolreplace.php +233 -182
  5. app/code/community/ET/CurrencyManager/Block/Adminhtml/System/Config/Form/Field/Linktooptions.php +29 -0
  6. app/code/community/ET/CurrencyManager/Block/Js.php +25 -19
  7. app/code/community/ET/CurrencyManager/Helper/Data.php +234 -158
  8. app/code/community/ET/CurrencyManager/Model/Currency.php +167 -128
  9. app/code/community/ET/CurrencyManager/Model/Locale.php +44 -46
  10. app/code/community/ET/CurrencyManager/Model/Store.php +34 -0
  11. app/code/community/ET/CurrencyManager/Model/Typeposition.php +34 -35
  12. app/code/community/ET/CurrencyManager/Model/Typesymboluse.php +36 -37
  13. app/code/community/ET/CurrencyManager/etc/config.xml +173 -149
  14. app/code/community/ET/CurrencyManager/etc/system.xml +220 -195
  15. app/code/community/ET/ET_CurrencyManager_ChangeLog.txt +84 -61
  16. app/code/community/ET/ET_CurrencyManager_Description.txt +88 -88
  17. app/code/community/ET/ET_CurrencyManager_LICENSE.txt +60 -48
  18. app/design/frontend/default/default/layout/et_currencymanager.xml +12 -13
  19. app/design/frontend/default/default/template/et_currencymanager/js.phtml +22 -23
  20. app/etc/modules/ET_CurrencyManager.xml +11 -13
  21. app/locale/ru_RU/ET_Currencymanager.csv +66 -45
  22. package.xml +11 -11
  23. skin/frontend/default/default/et_currencymanager/et_currencymanager.js +12 -12
  24. skin/frontend/default/default/et_currencymanager/et_currencymanager_round.js +164 -89
app/code/community/ET/CurrencyManager/Block/Adminhtml/Formprice.php CHANGED
@@ -1,10 +1,9 @@
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
  *
@@ -13,27 +12,26 @@
13
  *
14
  * @category ET
15
  * @package ET_CurrencyManager
16
- * @copyright Copyright (c) 2011 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_Block_Adminhtml_Formprice extends Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Price
22
  {
23
- public function getEscapedValue($index=null)
24
- {
25
- $options=Mage::helper('currencymanager')->getOptions(array());
26
- $value = $this->getValue();
27
-
28
- if (!is_numeric($value))
29
- {
30
- return null;
31
- }
32
 
33
- if(isset($options["input_admin"]) && isset($options['precision']))
34
- return number_format($value, $options['precision'], null, '');
 
35
 
36
- return parent::getEscapedValue($index);
37
- }
 
38
 
39
- }
 
 
1
  <?php
2
  /**
 
 
3
  * NOTICE OF LICENSE
4
  *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
  *
8
  * DISCLAIMER
9
  *
12
  *
13
  * @category ET
14
  * @package ET_CurrencyManager
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
16
  * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
  */
19
 
20
  class ET_CurrencyManager_Block_Adminhtml_Formprice extends Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Price
21
  {
22
+ public function getEscapedValue($index=null)
23
+ {
24
+ $options = Mage::helper('currencymanager')->getOptions(array());
25
+ $value = $this->getValue();
 
 
 
 
 
26
 
27
+ if (!is_numeric($value)) {
28
+ return null;
29
+ }
30
 
31
+ if (isset($options["input_admin"]) && isset($options['precision'])) {
32
+ return number_format($value, $options['precision'], null, '');
33
+ }
34
 
35
+ return parent::getEscapedValue($index);
36
+ }
37
+ }
app/code/community/ET/CurrencyManager/Block/Adminhtml/Heading.php CHANGED
@@ -1,10 +1,9 @@
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
  *
@@ -13,27 +12,27 @@
13
  *
14
  * @category ET
15
  * @package ET_CurrencyManager
16
- * @copyright Copyright (c) 2011 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
- if (version_compare(Mage::getVersion(), '1.4', '<'))
22
- {
23
- class ET_CurrencyManager_Block_Adminhtml_Heading extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
24
- {
25
- public function render(Varien_Data_Form_Element_Abstract $element)
26
- {
27
- $useContainerId = $element->getData('use_container_id');
28
- return sprintf('<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5"><h4 id="%s">%s</h4></td></tr>',
29
- $element->getHtmlId(), $element->getHtmlId(), $element->getLabel()
30
- );
31
- }
32
- }
33
- }
34
- else
35
- {
36
- class ET_CurrencyManager_Block_Adminhtml_Heading extends Mage_Adminhtml_Block_System_Config_Form_Field_Heading
37
- {
38
- }
39
- }
1
  <?php
2
  /**
 
 
3
  * NOTICE OF LICENSE
4
  *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
  *
8
  * DISCLAIMER
9
  *
12
  *
13
  * @category ET
14
  * @package ET_CurrencyManager
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
16
  * @contacts support@etwebsolutions.com
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
+
26
+ public function render(Varien_Data_Form_Element_Abstract $element)
27
+ {
28
+ return sprintf(
29
+ '<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5"><h4 id="%s">%s</h4></td></tr>',
30
+ $element->getHtmlId(), $element->getHtmlId(), $element->getLabel()
31
+ );
32
+ }
33
+ }
34
+ } else {
35
+ class ET_CurrencyManager_Block_Adminhtml_Heading extends Mage_Adminhtml_Block_System_Config_Form_Field_Heading
36
+ {
37
+ }
38
+ }
app/code/community/ET/CurrencyManager/Block/Adminhtml/Support.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_CurrencyManager
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_CurrencyManager_Block_Adminhtml_Support
21
+ extends Mage_Adminhtml_Block_Abstract
22
+ implements Varien_Data_Form_Element_Renderer_Interface
23
+ {
24
+ /**
25
+ * Support tab
26
+ * version 1.0.0
27
+ */
28
+ public function render(Varien_Data_Form_Element_Abstract $element)
29
+ {
30
+ $helper = Mage::helper('currencymanager');
31
+ $moduleNameId = 'ET_CurrencyManager';
32
+
33
+ $moduleVersion = $this->_getConfigValue($moduleNameId, 'version');
34
+ $moduleName = $this->_getConfigValue($moduleNameId, 'name');
35
+ $moduleShortDescription = $this->_getConfigValue($moduleNameId, 'descr');
36
+ $moduleLicense = $this->_getConfigValue($moduleNameId, 'license');
37
+
38
+ $linkParameters = '?module=' . $moduleNameId . '&ver=' . $moduleVersion . '&ref=' . $_SERVER['HTTP_HOST'];
39
+ $moduleLicenseLink = $this->_getConfigValue($moduleNameId, 'licenselink') . $linkParameters;
40
+ $moduleSupportLink = $this->_getConfigValue($moduleNameId, 'redminelink') . $linkParameters;
41
+ $moduleLink = $this->_getConfigValue($moduleNameId, 'permanentlink') . $linkParameters;
42
+ $servicesLink = $this->_getConfigValue($moduleNameId, 'ourserviceslink') . $linkParameters;
43
+
44
+ $html =
45
+ '<style>
46
+ .line {border-top: 1px solid #c6c6c6; }
47
+ .developer-label {color: #000000; font-weight:bold; width: 150px;}
48
+ .developer-text { padding-bottom: 15px;}
49
+ .developer {width: 600px; }
50
+ </style>';
51
+
52
+ $html .= '
53
+ <table cellspacing="0" cellpading="0" class="developer">
54
+ <tr>
55
+ <td class="developer-label">' . $helper->__('Extension:') . '</td>
56
+ <td class="developer-text">' . $helper->__(
57
+ '<strong>%s</strong> (version %s)',
58
+ $moduleName,
59
+ $moduleVersion
60
+ ) . '</td>
61
+ </tr>
62
+ <tr>
63
+ <td class="developer-label">' . $helper->__('License:') . '</td>
64
+ <td class="developer-text">' . $helper->__(
65
+ '<a href="%s" target="_blank">%s</a>',
66
+ $moduleLicenseLink,
67
+ $moduleLicense
68
+ ) . '</td>
69
+ </tr>
70
+ <tr>
71
+ <td class="developer-label">' . $helper->__('Short Description:') . '</td>
72
+ <td class="developer-text">' .$moduleShortDescription. '</td>
73
+ </tr>
74
+ <tr>
75
+ <td class="developer-label">' . $helper->__('Documentation:') . '</td>
76
+ <td class="developer-text">' . $helper->__(
77
+ 'You can see description of extension features and answers to the ' .
78
+ 'frequently asked questions on <a href="%s" target="_balnk">our website</a>.',
79
+ $moduleLink) . '</td>
80
+ </tr>
81
+ <tr>
82
+ <td class="developer-label line">' . $helper->__('Support:') . '</td>
83
+ <td class="developer-text line">' . $helper->__(
84
+ 'Extension support is available through <a href="%s" target="_blank">issue tracking system' .
85
+ '</a>.<br>You can see information freely, but you will have to sign up to open a ticket.<br>' .
86
+ '<br>Please, report all bugs and feature requests that are connected to this extension.<br>' .
87
+ '<br>If by some reason you can not submit a question, bug report or feature request to our ' .
88
+ 'ticket system, you can write us an email - support@etwebsolutions.com.',
89
+ $moduleSupportLink) . '</td>
90
+ </tr>
91
+ <tr>
92
+ <td class="developer-label line">' . $helper->__('Advertisement:') . '</td>
93
+ <td class="developer-text line">' . $helper->__(
94
+ 'You can hire our team to customize the extension. E-mail us on sales@etwebsolutions.com.<br>' .
95
+ '<br>You can see a list of provided services on <a href="%s" target="_blank">our website</a>.',
96
+ $servicesLink) . '</td>
97
+ </tr>
98
+ </table>';
99
+
100
+
101
+ return $html;
102
+ }
103
+
104
+ protected function _getConfigValue($module, $config)
105
+ {
106
+ $locale = Mage::app()->getLocale()->getLocaleCode();
107
+ $defaultLocale = 'en_US';
108
+ $mainConfig = Mage::getConfig();
109
+ $moduleConfig = $mainConfig->getNode('modules/' . $module . '/' . $config);
110
+
111
+ if ((string)$moduleConfig) {
112
+ return $moduleConfig;
113
+ }
114
+
115
+ if ($moduleConfig->$locale) {
116
+ return $moduleConfig->$locale;
117
+ } else {
118
+ return $moduleConfig->$defaultLocale;
119
+ }
120
+ }
121
+
122
+ }
app/code/community/ET/CurrencyManager/Block/Adminhtml/Symbolreplace.php CHANGED
@@ -1,183 +1,234 @@
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_Block_Adminhtml_Symbolreplace extends Mage_Adminhtml_Block_System_Config_Form_Field
22
- {
23
- protected $_addRowButtonHtml = array();
24
- protected $_removeRowButtonHtml = array();
25
-
26
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
27
- {
28
- $this->setElement($element);
29
-
30
- $html = '<div id="symbolreplace_template" style="display:none">';
31
- $html .= $this->_getRowTemplateHtml();
32
- $html .= '</div>';
33
-
34
- $html .= '<ul id="symbolreplace_container">';
35
- if ($this->_getValue('currency')) {
36
- foreach ($this->_getValue('currency') as $i=>$f)
37
- {
38
- if ($i)
39
- {
40
- $html .= $this->_getRowTemplateHtml($i);
41
- }
42
- }
43
- }
44
- $html .= '</ul>';
45
- $html .= $this->_getAddRowButtonHtml('symbolreplace_container',
46
- 'symbolreplace_template', $this->__('Add currency specific options'));
47
-
48
- return $html;
49
- }
50
-
51
- protected function _getRowTemplateHtml($i=0)
52
- {
53
-
54
- $html = '<li><fieldset>';
55
- $html .= '<label>'.$this->__('Select currency:').' </label> ';
56
-
57
- $html .= '<select name="'.$this->getElement()->getName().'[currency][]" '.$this->_getDisabled().'>';
58
-
59
- $html .= '<option value="">'.$this->__('* Select currency').'</option>';
60
- foreach ($this->getAllowedCurrencies() as $currencyCode=>$currency)
61
- {
62
- $html .= '<option value="'.$currencyCode.'" '.$this->_getSelected('currency/'.$i, $currencyCode).' style="background:white;">'.$currency. " - " .$currencyCode.'</option>';
63
- }
64
- $html .= '</select>';
65
-
66
- $html .= '<label>'.$this->__('Precision:').' </label> ';
67
- $html .= '<input class="input-text" name="'.$this->getElement()->getName().'[precision][]" value="'.$this->_getValue('precision/'.$i).'" '.$this->_getDisabled().'/> ';
68
- $html .= '<p class="nm"><small>' . $this->__('Leave empty for global value use') . '</small></p>';
69
-
70
- $html .= '<label>'.$this->__('Cut Zero Decimals:').' </label> ';
71
- $html .= '<select class="input-text" name="'.$this->getElement()->getName().'[cutzerodecimal][]">';
72
- foreach(Mage::getModel("adminhtml/system_config_source_yesno")->toOptionArray() as $labelValue)
73
- {
74
- $html .= '<option value="'.$labelValue["value"].'" '.($this->_getValue('cutzerodecimal/'.$i)==$labelValue["value"]?'selected="selected"':'').'>'.$labelValue["label"]."</option>";
75
- }
76
- $html .= '</select>';
77
-
78
-
79
- $html .= '<label>'.$this->__('Suffix:').' </label> ';
80
- $html .= '<input class="input-text" name="'.$this->getElement()->getName().'[cutzerodecimal_suffix][]" value="'.$this->_getValue('cutzerodecimal_suffix/'.$i).'" '.$this->_getDisabled().'/> ';
81
- $html .= '<p class="nm"><small>' . $this->__('Leave empty for global value use') . '</small></p>';
82
-
83
-
84
- $html .= '<label>'.$this->__('Symbol position:').' </label> ';
85
- $html .= '<select class="input-text" name="'.$this->getElement()->getName().'[position][]">';
86
- foreach(Mage::getModel("currencymanager/typeposition")->toOptionArray() as $labelValue)
87
- {
88
- $html .= '<option value="'.$labelValue["value"].'" '.($this->_getValue('position/'.$i)==$labelValue["value"]?'selected="selected"':'').'>'.$labelValue["label"]."</option>";
89
- }
90
- $html .= '</select>';
91
-
92
- $html .= '<label>'.$this->__('Currency symbol use:').' </label> ';
93
- $html .= '<select class="input-text" name="'.$this->getElement()->getName().'[display][]">';
94
- foreach(Mage::getModel("currencymanager/typesymboluse")->toOptionArray() as $labelValue)
95
- {
96
- $html .= '<option value="'.$labelValue["value"].'" '.($this->_getValue('display/'.$i)==$labelValue["value"]?'selected="selected"':'').'>'.$labelValue["label"]."</option>";
97
- }
98
- $html .= '</select>';
99
-
100
- $html .= '<label>'.$this->__('Replace symbol to:').' </label> ';
101
- $html .= '<input class="input-text" name="'.$this->getElement()->getName().'[symbol][]" value="'.$this->_getValue('symbol/'.$i).'" '.$this->_getDisabled().'/> ';
102
- $html .= '<p class="nm"><small>' . $this->__('Leave empty for disable replace') . '</small></p>';
103
-
104
- $html .= '<label>'.$this->__('Replace Zero Price to:').' </label> ';
105
- $html .= '<input class="input-text" name="'.$this->getElement()->getName().'[zerotext][]" value="'.$this->_getValue('zerotext/'.$i).'" '.$this->_getDisabled().'/> ';
106
- $html .= '<p class="nm"><small>' . $this->__('Leave empty for disable replace') . '</small></p>';
107
-
108
- $html .= '<br /> <br />';
109
- $html .= $this->_getRemoveRowButtonHtml();
110
- //$html .= '</div>';
111
- $html .= '</fieldset></li>';
112
-
113
- return $html;
114
- }
115
-
116
- protected function getAllowedCurrencies()
117
- {
118
-
119
- if (!$this->hasData('allowed_currencies'))
120
- {
121
- $currencies = Mage::app()->getLocale()->getOptionCurrencies();
122
- $allowed_currency_codes = Mage::getSingleton('directory/currency')->getConfigAllowCurrencies();
123
-
124
- $formatet_currencies = array();
125
- foreach ($currencies as $k=>$currency)
126
- $formatet_currencies[$currency['value']]['label'] = $currency['label'];
127
-
128
- $allowed_currencies = array();
129
- foreach ($allowed_currency_codes as $k=>$currencyCode)
130
- $allowed_currencies[$currencyCode] = $formatet_currencies[$currencyCode]['label'];
131
-
132
- $this->setData('allowed_currencies', $allowed_currencies);
133
- }
134
- return $this->getData('allowed_currencies');
135
- }
136
-
137
- protected function _getDisabled()
138
- {
139
- return $this->getElement()->getDisabled() ? ' disabled' : '';
140
- }
141
-
142
- protected function _getValue($key)
143
- {
144
- return $this->getElement()->getData('value/'.$key);
145
- }
146
-
147
- protected function _getSelected($key, $value)
148
- {
149
- return $this->getElement()->getData('value/'.$key)==$value ? 'selected="selected"' : '';
150
- }
151
-
152
- protected function _getAddRowButtonHtml($container, $template, $title='Add')
153
- {
154
- if (!isset($this->_addRowButtonHtml[$container]))
155
- {
156
- $this->_addRowButtonHtml[$container] = $this->getLayout()->createBlock('adminhtml/widget_button')
157
- ->setType('button')
158
- ->setClass('add '.$this->_getDisabled())
159
- ->setLabel($this->__($title))
160
- //$this->__('Add')
161
- ->setOnClick("Element.insert($('".$container."'), {bottom: $('".$template."').innerHTML})")
162
- ->setDisabled($this->_getDisabled())
163
- ->toHtml();
164
- }
165
- return $this->_addRowButtonHtml[$container];
166
- }
167
-
168
- protected function _getRemoveRowButtonHtml($selector='li', $title='Remove')
169
- {
170
- if (!$this->_removeRowButtonHtml)
171
- {
172
- $this->_removeRowButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')
173
- ->setType('button')
174
- ->setClass('delete v-middle '.$this->_getDisabled())
175
- ->setLabel($this->__($title))
176
- //$this->__('Remove')
177
- ->setOnClick("Element.remove($(this).up('".$selector."'))")
178
- ->setDisabled($this->_getDisabled())
179
- ->toHtml();
180
- }
181
- return $this->_removeRowButtonHtml;
182
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  }
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_CurrencyManager
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_CurrencyManager_Block_Adminhtml_Symbolreplace extends Mage_Adminhtml_Block_System_Config_Form_Field
21
+ {
22
+ protected $_addRowButtonHtml = array();
23
+ protected $_removeRowButtonHtml = array();
24
+
25
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
26
+ {
27
+ $this->setElement($element);
28
+
29
+ $html = '<div id="symbolreplace_template" style="display:none">';
30
+ $html .= $this->_getRowTemplateHtml();
31
+ $html .= '</div>';
32
+
33
+ $html .= '<ul id="symbolreplace_container">';
34
+ if ($this->_getValue('currency')) {
35
+ foreach (array_keys($this->_getValue('currency')) as $row) {
36
+ if ($row) {
37
+ $html .= $this->_getRowTemplateHtml($row);
38
+ }
39
+ }
40
+ }
41
+ $html .= '</ul>';
42
+ $html .= $this->_getAddRowButtonHtml(
43
+ 'symbolreplace_container',
44
+ 'symbolreplace_template', $this->__('Add currency specific options')
45
+ );
46
+
47
+ return $html;
48
+ }
49
+
50
+ protected function _getRowTemplateHtml($row = 0)
51
+ {
52
+ $html = '<li><fieldset>';
53
+ $html .= $this->_getCurrencySelectHtml($row);
54
+ $html .= $this->_getPrecisionHtml($row);
55
+ $html .= $this->_getCutZeroHtml($row);
56
+ $html .= $this->_getSuffixHtml($row);
57
+ $html .= $this->_getSymbolPositionHtml($row);
58
+ $html .= $this->_getSymbolUseHtml($row);
59
+ $html .= $this->_getSymbolReplaceHtml($row);
60
+ $html .= $this->_getZeroPriceReplaceHtml($row);
61
+
62
+ $html .= '<br /> <br />';
63
+ $html .= $this->_getRemoveRowButtonHtml();
64
+ $html .= '</fieldset></li>';
65
+
66
+ return $html;
67
+ }
68
+
69
+ protected function _getZeroPriceReplaceHtml($row)
70
+ {
71
+ $html = '<label>' . $this->__('Replace Zero Price to:') . ' </label> ';
72
+ $html .= '<input class="input-text" name="' . $this->getElement()->getName() . '[zerotext][]" value="'
73
+ . $this->_getValue('zerotext/' . $row) . '" ' . $this->_getDisabled() . '/> ';
74
+ $html .= '<p class="nm"><small>' . $this->__('Leave empty for disable replace') . '</small></p>';
75
+ return $html;
76
+ }
77
+
78
+ protected function _getSymbolReplaceHtml($row)
79
+ {
80
+ $html = '<label>' . $this->__('Replace symbol to:') . ' </label> ';
81
+ $html .= '<input class="input-text" name="' . $this->getElement()->getName() . '[symbol][]" value="'
82
+ . $this->_getValue('symbol/' . $row) . '" ' . $this->_getDisabled() . '/> ';
83
+ $html .= '<p class="nm"><small>' . $this->__('Leave empty for disable replace') . '</small></p>';
84
+ return $html;
85
+ }
86
+
87
+ protected function _getSymbolUseHtml($row)
88
+ {
89
+ $html = '<label>' . $this->__('Currency symbol use:') . ' </label> ';
90
+ $html .= '<select class="input-text" name="' . $this->getElement()->getName() . '[display][]">';
91
+ foreach (Mage::getModel("currencymanager/typesymboluse")->toOptionArray() as $labelValue) {
92
+ $html .= '<option value="' . $labelValue["value"] . '" '
93
+ . ($this->_getValue('display/' . $row) == $labelValue["value"] ? 'selected="selected"' : '') . '>'
94
+ . $labelValue["label"] . "</option>";
95
+ }
96
+ $html .= '</select>';
97
+ return $html;
98
+ }
99
+
100
+ protected function _getSymbolPositionHtml($row)
101
+ {
102
+ $html = '<label>' . $this->__('Symbol position:') . ' </label> ';
103
+ $html .= '<select class="input-text" name="' . $this->getElement()->getName() . '[position][]">';
104
+ foreach (Mage::getModel("currencymanager/typeposition")->toOptionArray() as $labelValue) {
105
+ $html .= '<option value="' . $labelValue["value"] . '" '
106
+ . ($this->_getValue('position/' . $row) == $labelValue["value"] ? 'selected="selected"' : '') . '>'
107
+ . $labelValue["label"] . "</option>";
108
+ }
109
+ $html .= '</select>';
110
+ return $html;
111
+ }
112
+
113
+ protected function _getSuffixHtml($row)
114
+ {
115
+ $html = '<label>' . $this->__('Suffix:') . ' </label> ';
116
+ $html .= '<input class="input-text" name="' . $this->getElement()->getName()
117
+ . '[cutzerodecimal_suffix][]" value="' . $this->_getValue('cutzerodecimal_suffix/' . $row)
118
+ . '" ' . $this->_getDisabled() . '/> ';
119
+ $html .= '<p class="nm"><small>' . $this->__('Leave empty for global value use') . '</small></p>';
120
+ return $html;
121
+ }
122
+
123
+ protected function _getCutZeroHtml($row)
124
+ {
125
+ $html = '<label>' . $this->__('Cut Zero Decimals:') . ' </label> ';
126
+ $html .= '<select class="input-text" name="' . $this->getElement()->getName() . '[cutzerodecimal][]">';
127
+ foreach (Mage::getModel("adminhtml/system_config_source_yesno")->toOptionArray() as $labelValue) {
128
+ $html .= '<option value="' . $labelValue["value"] . '" '
129
+ . ($this->_getValue('cutzerodecimal/' . $row) == $labelValue["value"] ? 'selected="selected"' : '')
130
+ . '>' . $labelValue["label"] . "</option>";
131
+ }
132
+ $html .= '</select>';
133
+ return $html;
134
+ }
135
+
136
+ protected function _getPrecisionHtml($row)
137
+ {
138
+ $html = '<label>' . $this->__('Precision:') . ' </label> ';
139
+ $html .= '<input class="input-text" name="' . $this->getElement()->getName() . '[precision][]" value="'
140
+ . $this->_getValue('precision/' . $row) . '" ' . $this->_getDisabled() . '/> ';
141
+ $html .= '<p class="nm"><small>' . $this->__('Leave empty for global value use') . '</small></p>';
142
+ return $html;
143
+ }
144
+
145
+ protected function _getCurrencySelectHtml($row)
146
+ {
147
+ $html = '<label>' . $this->__('Select currency:') . ' </label> ';
148
+
149
+ $html .= '<select name="' . $this->getElement()->getName() . '[currency][]" ' . $this->_getDisabled() . '>';
150
+
151
+ $html .= '<option value="">' . $this->__('* Select currency') . '</option>';
152
+ foreach ($this->getAllowedCurrencies() as $currencyCode => $currency) {
153
+ $html .= '<option value="' . $currencyCode . '" ' . $this->_getSelected('currency/' . $row, $currencyCode)
154
+ . ' style="background:white;">' . $currency . " - " . $currencyCode . '</option>';
155
+ }
156
+ $html .= '</select>';
157
+ return $html;
158
+ }
159
+
160
+ protected function getAllowedCurrencies()
161
+ {
162
+
163
+ if (!$this->hasData('allowed_currencies')) {
164
+ $currencies = Mage::app()->getLocale()->getOptionCurrencies();
165
+ $allowedCurrencyCodes = Mage::getSingleton('directory/currency')->getConfigAllowCurrencies();
166
+
167
+ $formattedCurrencies = array();
168
+ foreach ($currencies as $currency) {
169
+ $formattedCurrencies[$currency['value']]['label'] = $currency['label'];
170
+ }
171
+
172
+ $allowedCurrencies = array();
173
+ foreach ($allowedCurrencyCodes as $currencyCode) {
174
+ $allowedCurrencies[$currencyCode] = $formattedCurrencies[$currencyCode]['label'];
175
+ }
176
+
177
+ $this->setData('allowed_currencies', $allowedCurrencies);
178
+ }
179
+ return $this->getData('allowed_currencies');
180
+ }
181
+
182
+ protected function _getDisabled()
183
+ {
184
+ return $this->getElement()->getDisabled() ? ' disabled' : '';
185
+ }
186
+
187
+ protected function _getValue($key)
188
+ {
189
+ $value = $this->getElement()->getData('value/' . $key);
190
+ if (is_null($value) && $key != 'currency') {
191
+ $key = explode("/", $key);
192
+ $key = array_shift($key);
193
+ //$value = Mage::app()->getConfig()->getNode('default/currencymanager/general/symbolreplace/'.$key);
194
+ $value = Mage::app()->getConfig()->getNode('default/currencymanager/general/'.$key);
195
+ return (string)$value;
196
+ }
197
+ return $value;
198
+ }
199
+
200
+ protected function _getSelected($key, $value)
201
+ {
202
+ return $this->getElement()->getData('value/' . $key) == $value ? 'selected="selected"' : '';
203
+ }
204
+
205
+ protected function _getAddRowButtonHtml($container, $template, $title = 'Add')
206
+ {
207
+ if (!isset($this->_addRowButtonHtml[$container])) {
208
+ $this->_addRowButtonHtml[$container] = $this->getLayout()->createBlock('adminhtml/widget_button')
209
+ ->setType('button')
210
+ ->setClass('add ' . $this->_getDisabled())
211
+ ->setLabel($this->__($title))
212
+ //$this->__('Add')
213
+ ->setOnClick("Element.insert($('" . $container . "'), {bottom: $('" . $template . "').innerHTML})")
214
+ ->setDisabled($this->_getDisabled())
215
+ ->toHtml();
216
+ }
217
+ return $this->_addRowButtonHtml[$container];
218
+ }
219
+
220
+ protected function _getRemoveRowButtonHtml($selector = 'li', $title = 'Remove')
221
+ {
222
+ if (!$this->_removeRowButtonHtml) {
223
+ $this->_removeRowButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')
224
+ ->setType('button')
225
+ ->setClass('delete v-middle ' . $this->_getDisabled())
226
+ ->setLabel($this->__($title))
227
+ //$this->__('Remove')
228
+ ->setOnClick("Element.remove($(this).up('" . $selector . "'))")
229
+ ->setDisabled($this->_getDisabled())
230
+ ->toHtml();
231
+ }
232
+ return $this->_removeRowButtonHtml;
233
+ }
234
  }
app/code/community/ET/CurrencyManager/Block/Adminhtml/System/Config/Form/Field/Linktooptions.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_CurrencyManager
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_CurrencyManager_Block_Adminhtml_System_Config_Form_Field_Linktooptions
21
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
22
+ {
23
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
24
+ {
25
+ return '<a href="' . $this->getUrl('*/system_config/edit', array('section' => 'currencymanager')) . '">' .
26
+ Mage::helper('currencymanager')->__('Click here to configure currency additional display options') .
27
+ '</a>';
28
+ }
29
+ }
app/code/community/ET/CurrencyManager/Block/Js.php CHANGED
@@ -1,10 +1,9 @@
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
  *
@@ -13,24 +12,31 @@
13
  *
14
  * @category ET
15
  * @package ET_CurrencyManager
16
- * @copyright Copyright (c) 2011 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_Block_Js extends Mage_Core_Block_Template
22
  {
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
-
33
-
34
- }
35
- }
36
-
 
 
 
 
 
 
 
1
  <?php
2
  /**
 
 
3
  * NOTICE OF LICENSE
4
  *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
  *
8
  * DISCLAIMER
9
  *
12
  *
13
  * @category ET
14
  * @package ET_CurrencyManager
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
16
  * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
  */
19
 
20
  class ET_CurrencyManager_Block_Js extends Mage_Core_Block_Template
21
  {
22
+ public function getJsonConfig()
23
+ {
24
+ if (method_exists(Mage::helper('core'), 'jsonEncode')) {
25
+ return Mage::helper('core')->jsonEncode(
26
+ Mage::helper('currencymanager')->getOptions(
27
+ array(),
28
+ false,
29
+ Mage::app()->getStore()->getCurrentCurrencyCode()
30
+ )
31
+ );
32
+ } else {
33
+ return Zend_Json::encode(
34
+ Mage::helper('currencymanager')->getOptions(
35
+ array(),
36
+ false,
37
+ Mage::app()->getStore()->getCurrentCurrencyCode()
38
+ )
39
+ );
40
+ }
41
+ }
42
+ }
app/code/community/ET/CurrencyManager/Helper/Data.php CHANGED
@@ -1,10 +1,9 @@
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
  *
@@ -13,162 +12,239 @@
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_Helper_Data extends Mage_Core_Helper_Abstract
22
  {
23
- /**
24
- * ZEND constants avalable in /lib/Zend/Currency.php
25
- *
26
- * NOTICE
27
- *
28
- * Magento ver 1.3.x - display - USE_SHORTNAME(3) by default
29
- * Magento ver 1.4.x - display - USE_SYMBOL(2) by default
30
- *
31
- * position: 8 - standart; 16 - right; 32 - left
32
- *
33
- */
34
-
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;
50
-
51
- // For JavaScript prices: Strange Symbol extracting in function getOutputFormat in file app/code/core/Mage/Directory/Model/Currency.php
52
- // For Configurable, Bundle and Simple with custom options
53
- // This causes problem if any currency has by default NO_SYMBOL
54
- // with this module can't change display value in this case
55
- if(isset($options["display"]))if($options["display"]==Zend_Currency::NO_SYMBOL)unset($newOptions["display"]);
56
-
57
- if (count($options) > 0)
58
- return $newOptions + $options;
59
- else
60
- return $newOptions;
61
- }
62
-
63
-
64
- public function isEnabled()
65
- {
66
- $config = Mage::getStoreConfig('currencymanager/general');
67
- $storeId = Mage::app()->getStore()->getStoreId();
68
- return ((($config['enabled'])&&($storeId>0))||(($config['enabledadm'])&&($storeId==0)));
69
- }
70
-
71
-
72
- public function setOptions($currency="default")
73
- {
74
- $config = Mage::getStoreConfig('currencymanager/general');
75
- $moduleName = Mage::app()->getRequest()->getModuleName();
76
- $options = array();
77
- $optionsadvanced = array();
78
- $storeId = Mage::app()->getStore()->getStoreId();
79
- if ($this->isEnabled())
80
- {
81
- if (!($config['excludecheckout'] & ($moduleName == 'checkout')))
82
- if (isset($config['precision'])) // precision must be in range -1 .. 30
83
- $options['precision'] = min(30, max(-1, (int)$config['precision']));
84
-
85
- if (isset($config['position']))$options['position'] = (int)$config['position'];
86
- if (isset($config['display']))$options['display'] = (int)$config['display'];
87
- if (isset($config['input_admin']))$optionsadvanced['input_admin'] = (int)$config['input_admin'];
88
-
89
-
90
-
91
- $optionsadvanced['excludecheckout'] = $config['excludecheckout'];
92
- $optionsadvanced['cutzerodecimal'] = $config['cutzerodecimal'];
93
- $optionsadvanced['cutzerodecimal_suffix'] = isset($config['cutzerodecimal_suffix'])?$config['cutzerodecimal_suffix']:"";
94
-
95
-
96
- // formating symbols from admin, preparing to use. Maybe can better :)
97
- // если в админке будут внесены несколько значений для одной валюты, то использоваться будет только одна
98
- if(isset($config['symbolreplace']))
99
- {
100
- $symbolreplace = unserialize($config['symbolreplace']);
101
- foreach($symbolreplace['currency'] as $symbolreplaceKey=>$symbolreplaceValue)
102
- if(strlen(trim($symbolreplace['currency'][$symbolreplaceKey]))==0)
103
- {
104
- unset($symbolreplace['currency'][$symbolreplaceKey]);
105
- unset($symbolreplace['precision'][$symbolreplaceKey]);
106
- unset($symbolreplace['cutzerodecimal'][$symbolreplaceKey]);
107
- unset($symbolreplace['cutzerodecimal_suffix'][$symbolreplaceKey]);
108
- unset($symbolreplace['position'][$symbolreplaceKey]);
109
- unset($symbolreplace['display'][$symbolreplaceKey]);
110
- unset($symbolreplace['symbol'][$symbolreplaceKey]);
111
- unset($symbolreplace['zerotext'][$symbolreplaceKey]);
112
- }
113
-
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))
121
- $optionsadvanced['cutzerodecimal'] = (int)$configSubData[$displayCurrencyCode];
122
-
123
-
124
-
125
- if(isset($symbolreplace['cutzerodecimal_suffix'])){
126
- $configSubData = array_combine($symbolreplace['currency'], $symbolreplace['cutzerodecimal_suffix']);
127
- if (array_key_exists($displayCurrencyCode, $configSubData))
128
- if($configSubData[$displayCurrencyCode]!=""){
129
- $optionsadvanced["cutzerodecimal_suffix"] = $configSubData[$displayCurrencyCode];
130
- }
131
- }
132
-
133
- $configSubData = array_combine($symbolreplace['currency'], $symbolreplace['position']);
134
- if (array_key_exists($displayCurrencyCode, $configSubData))
135
- $options['position'] = (int)$configSubData[$displayCurrencyCode];
136
-
137
- $configSubData = array_combine($symbolreplace['currency'], $symbolreplace['display']);
138
- if (array_key_exists($displayCurrencyCode, $configSubData))
139
- $options['display'] = (int)$configSubData[$displayCurrencyCode];
140
-
141
- $configSubData = array_combine($symbolreplace['currency'], $symbolreplace['symbol']);
142
- if (array_key_exists($displayCurrencyCode, $configSubData))
143
- if($configSubData[$displayCurrencyCode]!="")
144
- $options['symbol'] = $configSubData[$displayCurrencyCode];
145
-
146
- if (!($config['excludecheckout'] & ($moduleName == 'checkout')))
147
- {
148
- $configSubData = array_combine($symbolreplace['currency'], $symbolreplace['zerotext']);
149
- if (array_key_exists($displayCurrencyCode, $configSubData))
150
- if($configSubData[$displayCurrencyCode]!="")
151
- $optionsadvanced['zerotext'] = $configSubData[$displayCurrencyCode];
152
-
153
- $configSubData = array_combine($symbolreplace['currency'], $symbolreplace['precision']);
154
- if (array_key_exists($displayCurrencyCode, $configSubData))
155
- if($configSubData[$displayCurrencyCode]!="")
156
- $options['precision'] = min(30, max(-1, (int)$configSubData[$displayCurrencyCode]));
157
- }
158
-
159
- }
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
- }
173
-
174
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
  /**
 
 
3
  * NOTICE OF LICENSE
4
  *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
  *
8
  * DISCLAIMER
9
  *
12
  *
13
  * @category ET
14
  * @package ET_CurrencyManager
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
16
  * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
  */
19
 
20
  class ET_CurrencyManager_Helper_Data extends Mage_Core_Helper_Abstract
21
  {
22
+ /**
23
+ * ZEND constants avalable in /lib/Zend/Currency.php
24
+ *
25
+ * NOTICE
26
+ *
27
+ * Magento ver 1.3.x - display - USE_SHORTNAME(3) by default
28
+ * Magento ver 1.4.x - display - USE_SYMBOL(2) by default
29
+ *
30
+ * position: 8 - standart; 16 - right; 32 - left
31
+ *
32
+ */
33
+
34
+ protected $_options = array();
35
+ protected $_optionsadvanced = array();
36
+
37
+ public function getOptions($options = array(), $old = false, $currency = "default") //$old for support Magento 1.3.x
38
+ {
39
+ $storeId = Mage::app()->getStore()->getStoreId();
40
+ if ((!isset($this->_options[$storeId][$currency])) || (!isset($this->_optionsadvanced[$storeId][$currency]))) {
41
+ $this->setOptions($currency);
42
+ }
43
+ $newOptions = $this->_options[$storeId][$currency];
44
+ $newOptionsAdvanced = $this->_optionsadvanced[$storeId][$currency];
45
+
46
+ if (!$old) {
47
+ $newOptions = $newOptions + $newOptionsAdvanced;
48
+ }
49
+
50
+ // For JavaScript prices: Strange Symbol extracting in function getOutputFormat
51
+ // in file app/code/core/Mage/Directory/Model/Currency.php
52
+ // For Configurable, Bundle and Simple with custom options
53
+ // This causes problem if any currency has by default NO_SYMBOL
54
+ // with this module can't change display value in this case
55
+ if (isset($options["display"])) {
56
+ if ($options["display"] == Zend_Currency::NO_SYMBOL) {
57
+ unset($newOptions["display"]);
58
+ }
59
+ }
60
+
61
+ if (count($options) > 0) {
62
+ return $newOptions + $options;
63
+ } else {
64
+ return $newOptions;
65
+ }
66
+ }
67
+
68
+ public function clearOptions($options)
69
+ {
70
+ $oldOptions = array("position", "format", "display", "precision", "script", "name", "currency", "symbol");
71
+ foreach (array_keys($options) as $optionKey) {
72
+ if (!in_array($optionKey, $oldOptions)) {
73
+ unset($options[$optionKey]);
74
+ }
75
+ }
76
+ return $options;
77
+ }
78
+
79
+
80
+ public function isEnabled()
81
+ {
82
+ $config = Mage::getStoreConfig('currencymanager/general');
83
+ $storeId = Mage::app()->getStore()->getStoreId();
84
+ return ((($config['enabled']) && ($storeId > 0)) || (($config['enabledadm']) && ($storeId == 0)));
85
+ }
86
+
87
+
88
+ public function setOptions($currency = "default")
89
+ {
90
+ $config = Mage::getStoreConfig('currencymanager/general');
91
+
92
+ $moduleName = Mage::app()->getRequest()->getModuleName();
93
+ $options = array();
94
+ $optionsAdvanced = array();
95
+ $storeId = Mage::app()->getStore()->getStoreId();
96
+ if ($this->isEnabled()) {
97
+ $notCheckout = !($config['excludecheckout'] & $this->isInOrder());
98
+ $this->_getGeneralOptions($config, $options, $optionsAdvanced, $notCheckout);
99
+
100
+ // formatting symbols from admin, preparing to use. Maybe can do better :)
101
+ // если в админке будут внесены
102
+ // несколько значений для одной валюты,
103
+ // то использоваться будет только одна
104
+ if (isset($config['symbolreplace'])) {
105
+ $this->_collectCurrencyOptions($config, $currency, $notCheckout, $options, $optionsAdvanced);
106
+ }
107
+ } // end NOT ENABLED
108
+
109
+ $this->_options[$storeId][$currency] = $options;
110
+ $this->_optionsadvanced[$storeId][$currency] = $optionsAdvanced;
111
+ if (!isset($this->_options[$storeId]["default"])) {
112
+ $this->_options[$storeId]["default"] = $options;
113
+ $this->_optionsadvanced[$storeId]["default"] = $optionsAdvanced;
114
+ }
115
+
116
+ return $this;
117
+ }
118
+
119
+ protected function _getGeneralOptions($config, &$options, &$optionsAdvanced, $notCheckout)
120
+ {
121
+ if ($notCheckout) {
122
+ if (isset($config['precision'])) { // precision must be in range -1 .. 30
123
+ $options['precision'] = min(30, max(-1, (int)$config['precision']));
124
+ }
125
+ }
126
+
127
+ if (isset($config['position'])) {
128
+ $options['position'] = (int)$config['position'];
129
+ }
130
+ if (isset($config['display'])) {
131
+ $options['display'] = (int)$config['display'];
132
+ }
133
+
134
+ if (isset($config['input_admin'])) {
135
+ $optionsAdvanced['input_admin'] = (int)$config['input_admin'];
136
+ }
137
+
138
+ $optionsAdvanced['excludecheckout'] = $config['excludecheckout'];
139
+ $optionsAdvanced['cutzerodecimal'] = $config['cutzerodecimal'];
140
+ $optionsAdvanced['cutzerodecimal_suffix'] = isset($config['cutzerodecimal_suffix']) ?
141
+ $config['cutzerodecimal_suffix'] : "";
142
+ }
143
+
144
+ protected function _collectCurrencyOptions($config, $currency, $notCheckout, &$options, &$optionsAdvanced)
145
+ {
146
+ $symbolReplace = $this->_unsetSymbolReplace($config);
147
+
148
+ if (count($symbolReplace['currency']) > 0) {
149
+ $tmpOptions = array();
150
+ $tmpOptionsAdvanced = array();
151
+
152
+ $tmpOptionsAdvanced['cutzerodecimal'] = $this->_getCurrencyOption(
153
+ $currency, $symbolReplace, 'cutzerodecimal', false, true
154
+ );
155
+
156
+ if (isset($symbolReplace['cutzerodecimal_suffix'])) {
157
+ $tmpOptionsAdvanced["cutzerodecimal_suffix"] = $this->_getCurrencyOption(
158
+ $currency, $symbolReplace, 'cutzerodecimal_suffix'
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) {
167
+ $tmpOptionsAdvanced['zerotext'] = $this->_getCurrencyOption(
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
+ }
175
+ }
176
+
177
+ foreach ($tmpOptions as $option => $value) {
178
+ if ($value !== false) {
179
+ $options[$option] = $value;
180
+ }
181
+ }
182
+
183
+ foreach ($tmpOptionsAdvanced as $option => $value) {
184
+ if ($value !== false) {
185
+ $optionsAdvanced[$option] = $value;
186
+ }
187
+ }
188
+
189
+ }
190
+ }
191
+
192
+ /**
193
+ * To check where price is used
194
+ * in some cases default values for precision and zerotext should be used
195
+ * for sales/checkout in frontend
196
+ * for admin AND sales_order*
197
+ *
198
+ * @return bool
199
+ */
200
+ public function isInOrder()
201
+ {
202
+ $moduleName = Mage::app()->getRequest()->getModuleName();
203
+ $controllerName = Mage::app()->getRequest()->getControllerName();
204
+
205
+ return (($moduleName == 'checkout')
206
+ || ($moduleName == 'sales')
207
+ || (
208
+ ($moduleName == 'admin') && (strpos($controllerName, 'sales_order') !== false)
209
+ ));
210
+ }
211
+
212
+ protected function _unsetSymbolReplace($config)
213
+ {
214
+ if (!is_array($config['symbolreplace'])) {
215
+ $symbolReplace = unserialize($config['symbolreplace']);
216
+ foreach (array_keys($symbolReplace['currency']) as $symbolReplaceKey) {
217
+ if (strlen(trim($symbolReplace['currency'][$symbolReplaceKey])) == 0) {
218
+ unset($symbolReplace['currency'][$symbolReplaceKey]);
219
+ unset($symbolReplace['precision'][$symbolReplaceKey]);
220
+ unset($symbolReplace['cutzerodecimal'][$symbolReplaceKey]);
221
+ unset($symbolReplace['cutzerodecimal_suffix'][$symbolReplaceKey]);
222
+ unset($symbolReplace['position'][$symbolReplaceKey]);
223
+ unset($symbolReplace['display'][$symbolReplaceKey]);
224
+ unset($symbolReplace['symbol'][$symbolReplaceKey]);
225
+ unset($symbolReplace['zerotext'][$symbolReplaceKey]);
226
+ }
227
+ }
228
+ return $symbolReplace;
229
+ }
230
+ return false;
231
+ }
232
+
233
+ public function resetOptions()
234
+ {
235
+ $this->_options = array();
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
+ }
249
+
250
+ }
app/code/community/ET/CurrencyManager/Model/Currency.php CHANGED
@@ -1,128 +1,167 @@
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
- //print "answer: " . $answer . "<br />";
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), $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);
93
- }
94
- else // esle only changing precision
95
- {
96
- $options['precision'] = 0;
97
- $answer = parent::formatTxt($price, $options);
98
- }
99
- }
100
- }
101
- }
102
- }
103
-
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_CurrencyManager
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_CurrencyManager_Model_Currency extends Mage_Directory_Model_Currency
21
+ {
22
+
23
+ public function format($price, $options = array(), $includeContainer = true, $addBrackets = false)
24
+ {
25
+ if (method_exists($this, "formatPrecision")) {
26
+ $options = Mage::helper('currencymanager')->getOptions(array());
27
+
28
+ return $this->formatPrecision(
29
+ $price,
30
+ isset($options["precision"]) ? $options["precision"] : 2,
31
+ Mage::helper('currencymanager')->clearOptions($options),
32
+ $includeContainer,
33
+ $addBrackets
34
+ );
35
+ }
36
+ return parent::format($price, $options, $includeContainer, $addBrackets);
37
+ }
38
+
39
+ public function getOutputFormat()
40
+ {
41
+ $formatted = $this->formatTxt(10);
42
+ $number = $this->formatTxt(10, array('display' => Zend_Currency::NO_SYMBOL));
43
+ return str_replace($number, '%s', $formatted);
44
+ }
45
+
46
+ public function formatTxt($price, $options = array())
47
+ {
48
+ /* @var $helper ET_CurrencyManager_Helper_Data */
49
+ $helper = Mage::helper('currencymanager');
50
+
51
+ $answer = parent::formatTxt($price, $helper->clearOptions($options));
52
+
53
+ if ($helper->isEnabled()) {
54
+ $moduleName = Mage::app()->getRequest()->getModuleName();
55
+
56
+ $optionsAdvanced = $helper->getOptions($options, false, $this->getCurrencyCode());
57
+ $options = $helper->getOptions($options, true, $this->getCurrencyCode());
58
+
59
+ $answer = parent::formatTxt($price, $options);
60
+
61
+ if (count($options) > 0) {
62
+ if (($moduleName == 'admin')) {
63
+ $answer = parent::formatTxt($price, $helper->clearOptions($options));
64
+ }
65
+
66
+ //check against -0
67
+ $answer = $this->_formatWithPrecision($options, $optionsAdvanced, $price, $answer);
68
+
69
+ if (!($helper->isInOrder() & $optionsAdvanced['excludecheckout'])) {
70
+ if ($price == 0) {
71
+ if (isset($optionsAdvanced['zerotext']) && $optionsAdvanced['zerotext'] != "") {
72
+ return $optionsAdvanced['zerotext'];
73
+ }
74
+ }
75
+
76
+ $answer = $this->_cutZeroDecimal($options, $optionsAdvanced, $price, $answer);
77
+ }
78
+ }
79
+ }
80
+ return $answer;
81
+ }
82
+
83
+ protected function _formatWithPrecision($options, $optionsAdvanced, &$price, $answer)
84
+ {
85
+ $helper = Mage::helper('currencymanager');
86
+ if (isset($optionsAdvanced['precision'])) {
87
+ $price = round($price, $optionsAdvanced['precision']);
88
+ if ($optionsAdvanced['precision'] < 0) {
89
+ $options['precision'] = 0;
90
+ }
91
+
92
+ //for correction -0 float zero
93
+ if ($price == 0) {
94
+ $price = 0;
95
+ }
96
+ //if no need to cut zero we must recreate default answer
97
+ return parent::formatTxt($price, $helper->clearOptions($options));
98
+ }
99
+ return $answer;
100
+ }
101
+
102
+ protected function _cutZeroDecimal($options, $optionsAdvanced, $price, $answer)
103
+ {
104
+ $helper = Mage::helper('currencymanager');
105
+ $zeroDecimal = (round($price, $optionsAdvanced['precision']) == round($price, 0));
106
+ $suffix = isset($optionsAdvanced['cutzerodecimal_suffix']) ? $optionsAdvanced['cutzerodecimal_suffix'] : "";
107
+ if ($optionsAdvanced['cutzerodecimal'] && $zeroDecimal) { // cut decimal if it is equal to 0
108
+ if ((isset($suffix)) && (strlen($suffix) > 0)) { // if need to add suffix
109
+ // searching for fully formatted currency without currency symbol
110
+ $options['display'] = Zend_Currency::NO_SYMBOL;
111
+ $answerBlank = $this->_localizeNumber(parent::formatTxt($price, $options), $options);
112
+
113
+ //print "answerBlank: " . $answerBlank . "<br />";
114
+ // searching for fully formatted currency without currency symbol and rounded to int
115
+ $options['precision'] = 0;
116
+ $answerRound = $this->_localizeNumber(parent::formatTxt($price,
117
+ $helper->clearOptions($options)
118
+ ), $options);
119
+ //print "answerRound: " . $answerRound . "<br />";
120
+
121
+ // replace cut decimals with suffix
122
+ $answer = str_replace($answerBlank, $answerRound . $suffix, $answer);
123
+ return $answer;
124
+ } else { // only changing precision
125
+ $options['precision'] = 0;
126
+ $answer = parent::formatTxt($price, $helper->clearOptions($options));
127
+ return $answer;
128
+ }
129
+ } else {
130
+ return $answer;
131
+ }
132
+ }
133
+
134
+ protected function _localizeNumber($number, $options = array())
135
+ {
136
+ $options = Mage::helper('currencymanager')->getOptions($options, true, $this->getCurrencyCode());
137
+ if ($options['display'] == Zend_Currency::NO_SYMBOL) {
138
+ // in Zend_Currency toCurrency() function
139
+ // are stripped unbreakable spaces only for currency without Currency Symbol
140
+ return $number;
141
+ } else {
142
+ $locale = Mage::app()->getLocale()->getLocaleCode();
143
+ $format = Zend_Locale_Data::getContent($locale, 'decimalnumber');
144
+ $numberOptions = array(
145
+ 'locale' => $locale,
146
+ 'number_format' => $format,
147
+ 'precision' => 0,
148
+ );
149
+ $number = Zend_Locale_Format::getNumber($number, $numberOptions);
150
+ return Zend_Locale_Format::toNumber($number, $numberOptions);
151
+ }
152
+ }
153
+
154
+ //sometimes we need make correction
155
+ public function convert($price, $toCurrency = null)
156
+ {
157
+ $result = parent::convert($price, $toCurrency);
158
+ $data = new Varien_Object(array(
159
+ "price" => $price,
160
+ "toCurrency" => $toCurrency,
161
+ "result" => $result
162
+ ));
163
+ Mage::dispatchEvent("currency_convert_after", array("conversion" => $data));
164
+ return $data->getData("result");
165
+ }
166
+
167
+ }
app/code/community/ET/CurrencyManager/Model/Locale.php CHANGED
@@ -1,46 +1,44 @@
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_Locale extends Mage_Core_Model_Locale
22
- {
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
- }
31
-
32
-
33
- public function getJsPriceFormat()
34
- {
35
- // For JavaScript prices
36
- $parentFormat=parent::getJsPriceFormat();
37
- $options = Mage::helper('currencymanager')->getOptions(array());
38
- if (isset($options["precision"]))
39
- {
40
- $parentFormat["requiredPrecision"] = $options["precision"];
41
- $parentFormat["precision"] = $options["precision"];
42
- }
43
-
44
- return $parentFormat;
45
- }
46
- }
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_CurrencyManager
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_CurrencyManager_Model_Locale extends Mage_Core_Model_Locale
21
+ {
22
+ public function currency($ccode)
23
+ {
24
+ $admcurrency = parent::currency($ccode);
25
+ $options = Mage::helper('currencymanager')->getOptions(array(), true, $ccode);
26
+ $admcurrency->setFormat($options, $ccode);
27
+
28
+ return $admcurrency;
29
+ }
30
+
31
+
32
+ public function getJsPriceFormat()
33
+ {
34
+ // For JavaScript prices
35
+ $parentFormat = parent::getJsPriceFormat();
36
+ $options = Mage::helper('currencymanager')->getOptions(array());
37
+ if (isset($options["precision"])) {
38
+ $parentFormat["requiredPrecision"] = $options["precision"];
39
+ $parentFormat["precision"] = $options["precision"];
40
+ }
41
+
42
+ return $parentFormat;
43
+ }
44
+ }
 
 
app/code/community/ET/CurrencyManager/Model/Store.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_CurrencyManager
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_CurrencyManager_Model_Store extends Mage_Core_Model_Store
21
+ {
22
+
23
+ /**
24
+ * Round price
25
+ *
26
+ * @param mixed $price
27
+ * @return double
28
+ */
29
+ public function roundPrice($price)
30
+ {
31
+ $options = Mage::helper('currencymanager')->getOptions(array());
32
+ return round($price, isset($options["precision"])?$options["precision"]:2);
33
+ }
34
+ }
app/code/community/ET/CurrencyManager/Model/Typeposition.php CHANGED
@@ -1,36 +1,35 @@
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_Typeposition extends Varien_Object
22
- {
23
- /**
24
- * Options getter
25
- *
26
- * @return array
27
- */
28
- public function toOptionArray()
29
- {
30
- return array(
31
- array('value' => 8, 'label'=>Mage::helper('currencymanager')->__('Default')),
32
- array('value' => 16, 'label'=>Mage::helper('currencymanager')->__('Right')),
33
- array('value' => 32, 'label'=>Mage::helper('currencymanager')->__('Left'))
34
- );
35
- }
36
  }
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_CurrencyManager
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_CurrencyManager_Model_Typeposition extends Varien_Object
21
+ {
22
+ /**
23
+ * Options getter
24
+ *
25
+ * @return array
26
+ */
27
+ public function toOptionArray()
28
+ {
29
+ return array(
30
+ array('value' => 8, 'label'=>Mage::helper('currencymanager')->__('Default')),
31
+ array('value' => 16, 'label'=>Mage::helper('currencymanager')->__('Right')),
32
+ array('value' => 32, 'label'=>Mage::helper('currencymanager')->__('Left')),
33
+ );
34
+ }
 
35
  }
app/code/community/ET/CurrencyManager/Model/Typesymboluse.php CHANGED
@@ -1,37 +1,36 @@
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_Typesymboluse extends Varien_Object
22
- {
23
- /**
24
- * Options getter
25
- *
26
- * @return array
27
- */
28
- public function toOptionArray()
29
- {
30
- return array(
31
- array('value' => 1, 'label'=>Mage::helper('currencymanager')->__('Do not use')),
32
- array('value' => 2, 'label'=>Mage::helper('currencymanager')->__('Use symbol')),
33
- array('value' => 3, 'label'=>Mage::helper('currencymanager')->__('Use short name')),
34
- array('value' => 4, 'label'=>Mage::helper('currencymanager')->__('Use name'))
35
- );
36
- }
37
- }
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_CurrencyManager
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_CurrencyManager_Model_Typesymboluse extends Varien_Object
21
+ {
22
+ /**
23
+ * Options getter
24
+ *
25
+ * @return array
26
+ */
27
+ public function toOptionArray()
28
+ {
29
+ return array(
30
+ array('value' => 1, 'label'=>Mage::helper('currencymanager')->__('Do not use')),
31
+ array('value' => 2, 'label'=>Mage::helper('currencymanager')->__('Use symbol')),
32
+ array('value' => 3, 'label'=>Mage::helper('currencymanager')->__('Use short name')),
33
+ array('value' => 4, 'label'=>Mage::helper('currencymanager')->__('Use name')),
34
+ );
35
+ }
36
+ }
 
app/code/community/ET/CurrencyManager/etc/config.xml CHANGED
@@ -1,149 +1,173 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * ET Web Solutions
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Academic Free License (AFL 3.0)
9
- *
10
- * DISCLAIMER
11
- *
12
- * Do not edit or add to this file if you wish to upgrade to newer
13
- * versions in the future.
14
- *
15
- * @category ET
16
- * @package ET_CurrencyManager
17
- * @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
18
- * @contacts support@etwebsolutions.com
19
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
- */
21
- -->
22
- <config>
23
- <modules>
24
- <ET_CurrencyManager>
25
- <version>0.2.6</version>
26
- <descr>
27
- <ru_RU><![CDATA[Позволяет управлять значениями локализации для валюты. Например: кол-во знаков после запятой для цены или символ валюты.]]>
28
- </ru_RU>
29
- <en_US><![CDATA[Allow to change localization options for currency. Example: currency symbol or price decimals.]]>
30
- </en_US>
31
- </descr>
32
- </ET_CurrencyManager>
33
- </modules>
34
-
35
- <global>
36
- <helpers>
37
- <currencymanager>
38
- <class>ET_CurrencyManager_Helper</class>
39
- </currencymanager>
40
- </helpers>
41
- <models>
42
- <directory>
43
- <rewrite>
44
- <currency>ET_CurrencyManager_Model_Currency</currency>
45
- </rewrite>
46
- </directory>
47
-
48
- <core>
49
- <rewrite>
50
- <locale>ET_CurrencyManager_Model_Locale</locale>
51
- </rewrite>
52
- </core>
53
-
54
- <currencymanager>
55
- <class>ET_CurrencyManager_Model</class>
56
- </currencymanager>
57
- </models>
58
- <blocks>
59
- <currencymanager>
60
- <class>ET_CurrencyManager_Block</class>
61
- </currencymanager>
62
- <adminhtml>
63
- <rewrite>
64
- <catalog_product_helper_form_price>ET_CurrencyManager_Block_Adminhtml_Formprice</catalog_product_helper_form_price>
65
- </rewrite>
66
- </adminhtml>
67
- </blocks>
68
- <resources>
69
- <currencymanager_setup>
70
- <setup>
71
- <module>ET_CurrencyManager</module>
72
- </setup>
73
- <connection>
74
- <use>core_setup</use>
75
- </connection>
76
- </currencymanager_setup>
77
- <currencymanager_write>
78
- <connection>
79
- <use>core_write</use>
80
- </connection>
81
- </currencymanager_write>
82
- <currencymanager_read>
83
- <connection>
84
- <use>core_read</use>
85
- </connection>
86
- </currencymanager_read>
87
- </resources>
88
- </global>
89
-
90
- <default>
91
- <currencymanager>
92
- <general>
93
- <enabled>1</enabled>
94
- <excludecheckout>0</excludecheckout>
95
- <enabledadm>0</enabledadm>
96
- <input_admin>0</input_admin>
97
- <cutzerodecimal>0</cutzerodecimal>
98
- <cutzerodecimal_suffix>,-</cutzerodecimal_suffix>
99
- <precision>0</precision>
100
- <position>8</position>
101
- <display>2</display>
102
- </general>
103
- </currencymanager>
104
- </default>
105
-
106
-
107
- <frontend>
108
- <layout>
109
- <updates>
110
- <currencymanager>
111
- <file>et_currencymanager.xml</file>
112
- </currencymanager>
113
- </updates>
114
- </layout>
115
- </frontend>
116
-
117
- <adminhtml>
118
- <acl>
119
- <resources>
120
- <admin>
121
- <children>
122
- <system>
123
- <children>
124
- <config>
125
- <children>
126
- <currencymanager translate="title" module="currencymanager">
127
- <title>ET Currency Manager</title>
128
- <sort_order>400</sort_order>
129
- </currencymanager>
130
- </children>
131
- </config>
132
- </children>
133
- </system>
134
- </children>
135
- </admin>
136
- </resources>
137
- </acl>
138
- <translate>
139
- <modules>
140
- <ET_CurrencyManager>
141
- <files>
142
- <default>ET_Currencymanager.csv</default>
143
- </files>
144
- </ET_CurrencyManager>
145
- </modules>
146
- </translate>
147
- </adminhtml>
148
-
149
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * You may not sell, sub-license, rent or lease
7
+ * any portion of the Software or Documentation to anyone.
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) 2012 ET Web Solutions (http://etwebsolutions.com)
17
+ * @contacts support@etwebsolutions.com
18
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
19
+ */
20
+ -->
21
+ <config>
22
+ <modules>
23
+ <ET_CurrencyManager>
24
+ <name>ET Currency Manager</name>
25
+ <version>1.0.0</version>
26
+ <descr>
27
+ <ru_RU><![CDATA[Модуль позволяет владельцу магазина просто и удобно управлять отображением цены: указывать свой символ валюты, количество знаков после запятой, позицию символа и др.]]>
28
+ </ru_RU>
29
+ <en_US><![CDATA[Allows to change localization options for currency. Example: currency symbol or price decimals.]]>
30
+ </en_US>
31
+ </descr>
32
+ <permanentlink>
33
+ <ru_RU>http://shop.etwebsolutions.com/rus/et-currency-manager.html</ru_RU>
34
+ <en_US>http://shop.etwebsolutions.com/eng/et-currency-manager.html</en_US>
35
+ </permanentlink>
36
+ <license>
37
+ <ru_RU><![CDATA[ETWS Свободная лицензия (EFL1)]]></ru_RU>
38
+ <en_US><![CDATA[ETWS Free License (EFL1)]]></en_US>
39
+ </license>
40
+ <licenselink>
41
+ <ru_RU>http://shop.etwebsolutions.com/rus/etws-license-free-v1</ru_RU>
42
+ <en_US>http://shop.etwebsolutions.com/eng/etws-license-free-v1</en_US>
43
+ </licenselink>
44
+ <redminelink>http://support.etwebsolutions.com/projects/et-currency-manager/roadmap</redminelink>
45
+ <ourserviceslink>
46
+ <ru_RU>http://shop.etwebsolutions.com/rus/our-services</ru_RU>
47
+ <en_US>http://shop.etwebsolutions.com/eng/our-services</en_US>
48
+ </ourserviceslink>
49
+ </ET_CurrencyManager>
50
+ </modules>
51
+
52
+ <global>
53
+ <helpers>
54
+ <currencymanager>
55
+ <class>ET_CurrencyManager_Helper</class>
56
+ </currencymanager>
57
+ </helpers>
58
+ <models>
59
+ <directory>
60
+ <rewrite>
61
+ <currency>ET_CurrencyManager_Model_Currency</currency>
62
+ </rewrite>
63
+ </directory>
64
+
65
+ <core>
66
+ <rewrite>
67
+ <locale>ET_CurrencyManager_Model_Locale</locale>
68
+ <store>ET_CurrencyManager_Model_Store</store>
69
+ </rewrite>
70
+ </core>
71
+
72
+ <currencymanager>
73
+ <class>ET_CurrencyManager_Model</class>
74
+ </currencymanager>
75
+ </models>
76
+ <blocks>
77
+ <currencymanager>
78
+ <class>ET_CurrencyManager_Block</class>
79
+ </currencymanager>
80
+ <adminhtml>
81
+ <rewrite>
82
+ <catalog_product_helper_form_price>ET_CurrencyManager_Block_Adminhtml_Formprice</catalog_product_helper_form_price>
83
+ </rewrite>
84
+ </adminhtml>
85
+ </blocks>
86
+ <resources>
87
+ <currencymanager_setup>
88
+ <setup>
89
+ <module>ET_CurrencyManager</module>
90
+ </setup>
91
+ <connection>
92
+ <use>core_setup</use>
93
+ </connection>
94
+ </currencymanager_setup>
95
+ <currencymanager_write>
96
+ <connection>
97
+ <use>core_write</use>
98
+ </connection>
99
+ </currencymanager_write>
100
+ <currencymanager_read>
101
+ <connection>
102
+ <use>core_read</use>
103
+ </connection>
104
+ </currencymanager_read>
105
+ </resources>
106
+ </global>
107
+
108
+ <default>
109
+ <currencymanager>
110
+ <general>
111
+ <enabled>1</enabled>
112
+ <excludecheckout>1</excludecheckout>
113
+ <enabledadm>0</enabledadm>
114
+ <input_admin>0</input_admin>
115
+ <cutzerodecimal>0</cutzerodecimal>
116
+ <cutzerodecimal_suffix>,-</cutzerodecimal_suffix>
117
+ <precision>0</precision>
118
+ <position>8</position>
119
+ <display>2</display>
120
+ </general>
121
+ </currencymanager>
122
+ </default>
123
+
124
+
125
+ <frontend>
126
+ <layout>
127
+ <updates>
128
+ <currencymanager>
129
+ <file>et_currencymanager.xml</file>
130
+ </currencymanager>
131
+ </updates>
132
+ </layout>
133
+ </frontend>
134
+
135
+ <adminhtml>
136
+ <acl>
137
+ <resources>
138
+ <admin>
139
+ <children>
140
+ <system>
141
+ <children>
142
+ <config>
143
+ <children>
144
+ <currencymanager translate="title" module="currencymanager">
145
+ <title>ET Currency Manager</title>
146
+ <sort_order>400</sort_order>
147
+ </currencymanager>
148
+ </children>
149
+ </config>
150
+ </children>
151
+ </system>
152
+ </children>
153
+ </admin>
154
+ </resources>
155
+ </acl>
156
+ <translate>
157
+ <modules>
158
+ <ET_CurrencyManager>
159
+ <files>
160
+ <default>ET_Currencymanager.csv</default>
161
+ </files>
162
+ </ET_CurrencyManager>
163
+ </modules>
164
+ </translate>
165
+ </adminhtml>
166
+ <phpunit>
167
+ <suite>
168
+ <modules>
169
+ <ET_CurrencyManager />
170
+ </modules>
171
+ </suite>
172
+ </phpunit>
173
+ </config>
app/code/community/ET/CurrencyManager/etc/system.xml CHANGED
@@ -1,195 +1,220 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * ET Web Solutions
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Academic Free License (AFL 3.0)
9
- *
10
- * DISCLAIMER
11
- *
12
- * Do not edit or add to this file if you wish to upgrade to newer
13
- * versions in the future.
14
- *
15
- * @category ET
16
- * @package ET_CurrencyManager
17
- * @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
18
- * @contacts support@etwebsolutions.com
19
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
- */
21
- -->
22
- <config>
23
- <tabs>
24
- <etall translate="label">
25
- <label>ET Extensions</label>
26
- <sort_order>400</sort_order>
27
- </etall>
28
- </tabs>
29
-
30
- <sections>
31
- <currencymanager translate="label" module="currencymanager">
32
- <label>Currency Manager</label>
33
- <tab>etall</tab>
34
- <frontend_type>text</frontend_type>
35
- <sort_order>300</sort_order>
36
- <show_in_default>1</show_in_default>
37
- <show_in_website>1</show_in_website>
38
- <show_in_store>1</show_in_store>
39
- <groups>
40
- <info translate="label">
41
- <label>Currency Manager information</label>
42
- <comment><![CDATA[Support by support@etwebsolutions.com <br /> You can hire our team for any customizations. Contact us at sales@etwebsolutions.com]]></comment>
43
- <frontend_type>text</frontend_type>
44
- <sort_order>1</sort_order>
45
- <show_in_default>1</show_in_default>
46
- <show_in_website>1</show_in_website>
47
- <show_in_store>1</show_in_store>
48
- </info>
49
- <general translate="label">
50
- <label>Currency Options</label>
51
- <frontend_type>text</frontend_type>
52
- <sort_order>10</sort_order>
53
- <show_in_default>1</show_in_default>
54
- <show_in_website>1</show_in_website>
55
- <show_in_store>1</show_in_store>
56
- <fields>
57
- <heading_frontend translate="label">
58
- <label>Frontend specific options</label>
59
- <frontend_model>currencymanager/adminhtml_heading</frontend_model>
60
- <sort_order>100</sort_order>
61
- <show_in_default>1</show_in_default>
62
- <show_in_website>1</show_in_website>
63
- <show_in_store>1</show_in_store>
64
- </heading_frontend>
65
- <enabled translate="label">
66
- <label>Enabled for Frontend</label>
67
- <frontend_type>select</frontend_type>
68
- <source_model>adminhtml/system_config_source_yesno</source_model>
69
- <sort_order>110</sort_order>
70
- <show_in_default>1</show_in_default>
71
- <show_in_website>1</show_in_website>
72
- <show_in_store>1</show_in_store>
73
- </enabled>
74
- <excludecheckout translate="label comment">
75
- <label>Exclude for checkout</label>
76
- <comment>If Yes - options [Precision] and [Replace Zero Price] will not affect display of prices in checkout.</comment>
77
- <frontend_type>select</frontend_type>
78
- <source_model>adminhtml/system_config_source_yesno</source_model>
79
- <sort_order>120</sort_order>
80
- <show_in_default>1</show_in_default>
81
- <show_in_website>1</show_in_website>
82
- <show_in_store>1</show_in_store>
83
- </excludecheckout>
84
-
85
- <heading_admin translate="label">
86
- <label>Admin specific options</label>
87
- <frontend_model>currencymanager/adminhtml_heading</frontend_model>
88
- <sort_order>200</sort_order>
89
- <show_in_default>1</show_in_default>
90
- <show_in_website>1</show_in_website>
91
- <show_in_store>1</show_in_store>
92
- </heading_admin>
93
- <enabledadm translate="label">
94
- <label>Enabled for Admin</label>
95
- <frontend_type>select</frontend_type>
96
- <source_model>adminhtml/system_config_source_yesno</source_model>
97
- <sort_order>210</sort_order>
98
- <show_in_default>1</show_in_default>
99
- <show_in_website>1</show_in_website>
100
- <show_in_store>1</show_in_store>
101
- </enabledadm>
102
-
103
- <input_admin translate="label">
104
- <label>Enable for Inputs</label>
105
- <frontend_type>select</frontend_type>
106
- <source_model>adminhtml/system_config_source_yesno</source_model>
107
- <sort_order>220</sort_order>
108
- <show_in_default>1</show_in_default>
109
- <show_in_website>1</show_in_website>
110
- <show_in_store>1</show_in_store>
111
- </input_admin>
112
-
113
-
114
- <heading_global translate="label">
115
- <label>Currency options (global)</label>
116
- <frontend_model>currencymanager/adminhtml_heading</frontend_model>
117
- <sort_order>300</sort_order>
118
- <show_in_default>1</show_in_default>
119
- <show_in_website>1</show_in_website>
120
- <show_in_store>1</show_in_store>
121
- </heading_global>
122
- <precision translate="label comment">
123
- <label>Precision</label>
124
- <comment>Number of decimal (e.g. 0, 1, 2). Default: 0</comment>
125
- <frontend_type>text</frontend_type>
126
- <sort_order>310</sort_order>
127
- <show_in_default>1</show_in_default>
128
- <show_in_website>1</show_in_website>
129
- <show_in_store>1</show_in_store>
130
- </precision>
131
- <cutzerodecimal translate="label comment">
132
- <label>Cut Zero Decimals</label>
133
- <comment>If Yes price will be 99 instead of 99.00, but 99.99 if price 99.99</comment>
134
- <frontend_type>select</frontend_type>
135
- <source_model>adminhtml/system_config_source_yesno</source_model>
136
- <sort_order>320</sort_order>
137
- <show_in_default>1</show_in_default>
138
- <show_in_website>1</show_in_website>
139
- <show_in_store>1</show_in_store>
140
- </cutzerodecimal>
141
-
142
- <cutzerodecimal_suffix translate="label comment">
143
- <label>Replaces Cuted Zero Decimals</label>
144
- <comment>Used only if Cut Zero Decimals = Yes, default ",-"</comment>
145
- <frontend_type>text</frontend_type>
146
- <sort_order>325</sort_order>
147
- <show_in_default>1</show_in_default>
148
- <show_in_website>1</show_in_website>
149
- <show_in_store>1</show_in_store>
150
- </cutzerodecimal_suffix>
151
-
152
- <position translate="label">
153
- <label>Symbol position</label>
154
- <frontend_type>select</frontend_type>
155
- <source_model>currencymanager/typeposition</source_model>
156
- <sort_order>330</sort_order>
157
- <show_in_default>1</show_in_default>
158
- <show_in_website>1</show_in_website>
159
- <show_in_store>1</show_in_store>
160
- </position>
161
- <display translate="label comment">
162
- <label>Currency symbol use</label>
163
- <comment>e.g. Symbol = Ls, Short name = LVL, Name = Latvian Lats</comment>
164
- <frontend_type>select</frontend_type>
165
- <source_model>currencymanager/typesymboluse</source_model>
166
- <sort_order>340</sort_order>
167
- <show_in_default>1</show_in_default>
168
- <show_in_website>1</show_in_website>
169
- <show_in_store>1</show_in_store>
170
- </display>
171
-
172
- <heading_specific translate="label">
173
- <label>Currency options (for specific currency)</label>
174
- <frontend_model>currencymanager/adminhtml_heading</frontend_model>
175
- <sort_order>400</sort_order>
176
- <show_in_default>1</show_in_default>
177
- <show_in_website>1</show_in_website>
178
- <show_in_store>1</show_in_store>
179
- </heading_specific>
180
- <symbolreplace translate="label">
181
- <label>Currency specific options</label>
182
- <frontend_type>select</frontend_type>
183
- <frontend_model>currencymanager/adminhtml_symbolreplace</frontend_model>
184
- <backend_model>adminhtml/system_config_backend_serialized</backend_model>
185
- <sort_order>410</sort_order>
186
- <show_in_default>1</show_in_default>
187
- <show_in_website>1</show_in_website>
188
- <show_in_store>1</show_in_store>
189
- </symbolreplace>
190
- </fields>
191
- </general>
192
- </groups>
193
- </currencymanager>
194
- </sections>
195
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * You may not sell, sub-license, rent or lease
7
+ * any portion of the Software or Documentation to anyone.
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) 2012 ET Web Solutions (http://etwebsolutions.com)
17
+ * @contacts support@etwebsolutions.com
18
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
19
+ */
20
+ -->
21
+ <config>
22
+ <tabs>
23
+ <etall translate="label">
24
+ <label>ET Extensions</label>
25
+ <sort_order>400</sort_order>
26
+ </etall>
27
+ </tabs>
28
+
29
+ <sections>
30
+ <currency>
31
+ <groups>
32
+ <options>
33
+ <fields>
34
+ <currencymanageroptions translate="label">
35
+ <label>ET Currency Manager</label>
36
+ <frontend_type>label</frontend_type>
37
+ <frontend_model>currencymanager/adminhtml_system_config_form_field_linktooptions</frontend_model>
38
+ <sort_order>999</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>1</show_in_store>
42
+ </currencymanageroptions>
43
+ </fields>
44
+ </options>
45
+ </groups>
46
+ </currency>
47
+
48
+ <currencymanager translate="label" module="currencymanager">
49
+ <label>Currency Manager</label>
50
+ <tab>etall</tab>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>300</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ <groups>
57
+ <info translate="label">
58
+ <label>Currency Manager information</label>
59
+ <frontend_type>text</frontend_type>
60
+ <sort_order>1</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ <fields>
65
+ <support_information>
66
+ <frontend_model>currencymanager/adminhtml_support</frontend_model>
67
+ <sort_order>100</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>1</show_in_store>
71
+ </support_information>
72
+ </fields>
73
+ </info>
74
+ <general translate="label">
75
+ <label>Currency Options</label>
76
+ <frontend_type>text</frontend_type>
77
+ <sort_order>10</sort_order>
78
+ <show_in_default>1</show_in_default>
79
+ <show_in_website>1</show_in_website>
80
+ <show_in_store>1</show_in_store>
81
+ <fields>
82
+ <heading_frontend translate="label">
83
+ <label>Frontend specific options</label>
84
+ <frontend_model>currencymanager/adminhtml_heading</frontend_model>
85
+ <sort_order>100</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ </heading_frontend>
90
+ <enabled translate="label">
91
+ <label>Enabled for Frontend</label>
92
+ <frontend_type>select</frontend_type>
93
+ <source_model>adminhtml/system_config_source_yesno</source_model>
94
+ <sort_order>110</sort_order>
95
+ <show_in_default>1</show_in_default>
96
+ <show_in_website>1</show_in_website>
97
+ <show_in_store>1</show_in_store>
98
+ </enabled>
99
+ <excludecheckout translate="label comment">
100
+ <label>Exclude for checkout</label>
101
+ <comment><![CDATA[If Yes - options [Precision] and [Replace Zero Price] will not affect display of prices in checkout.]]></comment>
102
+ <frontend_type>select</frontend_type>
103
+ <source_model>adminhtml/system_config_source_yesno</source_model>
104
+ <sort_order>120</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>1</show_in_website>
107
+ <show_in_store>1</show_in_store>
108
+ </excludecheckout>
109
+
110
+ <heading_admin translate="label">
111
+ <label>Admin specific options</label>
112
+ <frontend_model>currencymanager/adminhtml_heading</frontend_model>
113
+ <sort_order>200</sort_order>
114
+ <show_in_default>1</show_in_default>
115
+ <show_in_website>1</show_in_website>
116
+ <show_in_store>1</show_in_store>
117
+ </heading_admin>
118
+ <enabledadm translate="label">
119
+ <label>Enabled for Admin</label>
120
+ <frontend_type>select</frontend_type>
121
+ <source_model>adminhtml/system_config_source_yesno</source_model>
122
+ <sort_order>210</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>1</show_in_store>
126
+ </enabledadm>
127
+
128
+ <input_admin translate="label">
129
+ <label>Enable for Inputs</label>
130
+ <frontend_type>select</frontend_type>
131
+ <source_model>adminhtml/system_config_source_yesno</source_model>
132
+ <sort_order>220</sort_order>
133
+ <show_in_default>1</show_in_default>
134
+ <show_in_website>1</show_in_website>
135
+ <show_in_store>1</show_in_store>
136
+ </input_admin>
137
+
138
+
139
+ <heading_global translate="label">
140
+ <label>Currency options (global)</label>
141
+ <frontend_model>currencymanager/adminhtml_heading</frontend_model>
142
+ <sort_order>300</sort_order>
143
+ <show_in_default>1</show_in_default>
144
+ <show_in_website>1</show_in_website>
145
+ <show_in_store>1</show_in_store>
146
+ </heading_global>
147
+ <precision translate="label comment">
148
+ <label>Precision</label>
149
+ <comment>Number of decimal (e.g. 0, 1, 2). Default: 0</comment>
150
+ <frontend_type>text</frontend_type>
151
+ <sort_order>310</sort_order>
152
+ <show_in_default>1</show_in_default>
153
+ <show_in_website>1</show_in_website>
154
+ <show_in_store>1</show_in_store>
155
+ </precision>
156
+ <cutzerodecimal translate="label comment">
157
+ <label>Cut Zero Decimals</label>
158
+ <comment>If Yes price will be 99 instead of 99.00, but 99.99 if price 99.99</comment>
159
+ <frontend_type>select</frontend_type>
160
+ <source_model>adminhtml/system_config_source_yesno</source_model>
161
+ <sort_order>320</sort_order>
162
+ <show_in_default>1</show_in_default>
163
+ <show_in_website>1</show_in_website>
164
+ <show_in_store>1</show_in_store>
165
+ </cutzerodecimal>
166
+
167
+ <cutzerodecimal_suffix translate="label comment">
168
+ <label>Replaces Cuted Zero Decimals</label>
169
+ <comment>Used only if Cut Zero Decimals = Yes, default ",-"</comment>
170
+ <frontend_type>text</frontend_type>
171
+ <sort_order>325</sort_order>
172
+ <show_in_default>1</show_in_default>
173
+ <show_in_website>1</show_in_website>
174
+ <show_in_store>1</show_in_store>
175
+ </cutzerodecimal_suffix>
176
+
177
+ <position translate="label">
178
+ <label>Symbol position</label>
179
+ <frontend_type>select</frontend_type>
180
+ <source_model>currencymanager/typeposition</source_model>
181
+ <sort_order>330</sort_order>
182
+ <show_in_default>1</show_in_default>
183
+ <show_in_website>1</show_in_website>
184
+ <show_in_store>1</show_in_store>
185
+ </position>
186
+ <display translate="label comment">
187
+ <label>Currency symbol use</label>
188
+ <comment>e.g. Symbol = Ls, Short name = LVL, Name = Latvian Lats</comment>
189
+ <frontend_type>select</frontend_type>
190
+ <source_model>currencymanager/typesymboluse</source_model>
191
+ <sort_order>340</sort_order>
192
+ <show_in_default>1</show_in_default>
193
+ <show_in_website>1</show_in_website>
194
+ <show_in_store>1</show_in_store>
195
+ </display>
196
+
197
+ <heading_specific translate="label">
198
+ <label>Currency options (for specific currency)</label>
199
+ <frontend_model>currencymanager/adminhtml_heading</frontend_model>
200
+ <sort_order>400</sort_order>
201
+ <show_in_default>1</show_in_default>
202
+ <show_in_website>1</show_in_website>
203
+ <show_in_store>1</show_in_store>
204
+ </heading_specific>
205
+ <symbolreplace translate="label">
206
+ <label>Currency specific options</label>
207
+ <frontend_type>select</frontend_type>
208
+ <frontend_model>currencymanager/adminhtml_symbolreplace</frontend_model>
209
+ <backend_model>adminhtml/system_config_backend_serialized</backend_model>
210
+ <sort_order>410</sort_order>
211
+ <show_in_default>1</show_in_default>
212
+ <show_in_website>1</show_in_website>
213
+ <show_in_store>1</show_in_store>
214
+ </symbolreplace>
215
+ </fields>
216
+ </general>
217
+ </groups>
218
+ </currencymanager>
219
+ </sections>
220
+ </config>
app/code/community/ET/ET_CurrencyManager_ChangeLog.txt CHANGED
@@ -1,61 +1,84 @@
1
- =====================================
2
- This file describes changes between versions of module ET_CurrencyManager for Magento.
3
-
4
- Legend:
5
- * bug fix
6
- + added functionality
7
- - removed functionality
8
-
9
- =====================================
10
- TODO:
11
- + Добавить возможность менять/Add the ability to change:
12
- group symbol (разделитель тысяч/thousands separator)
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.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
-
25
- ver. 0.2.4 (28/11/2011)
26
- * fixed bug for displaying price instead zero text in configurable products when total price is zero
27
-
28
- ver. 0.2.3 (29/09/2011)
29
- * fixed bug for displaying 2 different currencies in checkout
30
- * fixed bug for displaying negative precision using javascript
31
- * added type="text/javascript" for scrypt tag (w3c validation is ok now)
32
-
33
- ver. 0.2.2 (17/08/2011)
34
- + Replace zero decimals with suffix. Example: display 49,- instead of 49.00 or 49, but 49.99 remains unchanged.
35
- + Enable/Disable price rounding (precision parameter) on product input\edit page
36
- * small bug fixes
37
-
38
- ver. 0.2.1 (22/07/2011)
39
- * Fixed skipping currency formatting for admin dashboard
40
-
41
- ver. 0.2.0
42
- + restyled configuration
43
- + added abilty to set currency specific options (all, not only symbol replace/ Actual for multi currency stores without store views).
44
- + added ability to disable precision change for checkout process (exclude chekout)
45
- + added ability to replace zero prices with any string. Example: instead 0.00 display FREE
46
- * changed Cut Zero Decimal algoritm (now it's work fine with any currency precision, not only precision=2)
47
-
48
- ver. 0.1.5
49
- + Added ability to cut zero decimals if it = 0. (price == floor(price))
50
-
51
- ver. 0.1.4
52
- * Added support for dynamic prices (Bundled, Configurable, Simple with custom options).
53
-
54
- ver. 0.1.2
55
- * Added separate configurations for enable/disable module for frontend and admin.
56
-
57
- ver. 0.1.1
58
- * repacking for Magento Connect
59
-
60
- ver. 0.1.0
61
- + stable release
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ =====================================
2
+ This file describes changes between versions of module ET_CurrencyManager for Magento.
3
+
4
+ Legend:
5
+ * bug fix
6
+ + added functionality
7
+ - removed functionality
8
+
9
+ =====================================
10
+ TODO:
11
+ + Добавить возможность менять/Add the ability to change:
12
+ group symbol (разделитель тысяч/thousands separator)
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. 1.0.0 (31/08/2012)
20
+ + Changed license type from AFL to ETWS Free License v1
21
+ + Refactored code for Magento standards
22
+ + Added link to extension settings in Currency Options Section
23
+ + Added additional information about extension support in settings section
24
+ + Added default values for specific currency section
25
+ * Some errors fixed
26
+
27
+ ver. 0.3.0 (19/08/2012)
28
+ + Added custom events for currency conversion
29
+ + Added phpUnit tests (beta version)
30
+ * Fixed problem with -0
31
+ * Fixed problem displaying 0 with positive precisions (some times displayed 0 instead of 0.00 for precision 2)
32
+
33
+ ver. 0.2.9 (17/04/2012)
34
+ * fixed rounding for JS with negative precision
35
+
36
+ ver. 0.2.8 (23/02/2012)
37
+ * fixed rounding for JS (bug was when rounding 9.9999999 or 9.00000001)
38
+
39
+ ver. 0.2.7 (06/02/2012)
40
+ * fixed param initialisations for JS (bug was for multicurrency stores)
41
+
42
+ ver. 0.2.6 (23/01/2012)
43
+ * fixed bug in function, which replaces zero decimals with custom suffix (for currency without currency symbol)
44
+
45
+ ver. 0.2.5 (20/01/2012)
46
+ * fixed bug in function, which replaces zero decimals with custom suffix (it was only in locales, where group separator is unbreakable whitespace - chr160)
47
+
48
+ ver. 0.2.4 (28/11/2011)
49
+ * fixed bug for displaying price instead zero text in configurable products when total price is zero
50
+
51
+ ver. 0.2.3 (29/09/2011)
52
+ * fixed bug for displaying 2 different currencies in checkout
53
+ * fixed bug for displaying negative precision using javascript
54
+ * added type="text/javascript" for scrypt tag (w3c validation is ok now)
55
+
56
+ ver. 0.2.2 (17/08/2011)
57
+ + Replace zero decimals with suffix. Example: display 49,- instead of 49.00 or 49, but 49.99 remains unchanged.
58
+ + Enable/Disable price rounding (precision parameter) on product input\edit page
59
+ * small bug fixes
60
+
61
+ ver. 0.2.1 (22/07/2011)
62
+ * Fixed skipping currency formatting for admin dashboard
63
+
64
+ ver. 0.2.0
65
+ + restyled configuration
66
+ + added ability to set currency specific options (all, not only symbol replace/ Actual for multi currency stores without store views).
67
+ + added ability to disable precision change for checkout process (exclude checkout)
68
+ + added ability to replace zero prices with any string. Example: instead 0.00 display FREE
69
+ * changed Cut Zero Decimal algorithm (now it's work fine with any currency precision, not only precision=2)
70
+
71
+ ver. 0.1.5
72
+ + Added ability to cut zero decimals if it = 0. (price == floor(price))
73
+
74
+ ver. 0.1.4
75
+ * Added support for dynamic prices (Bundled, Configurable, Simple with custom options).
76
+
77
+ ver. 0.1.2
78
+ * Added separate configurations for enable/disable module for frontend and admin.
79
+
80
+ ver. 0.1.1
81
+ * repacking for Magento Connect
82
+
83
+ ver. 0.1.0
84
+ + stable release
app/code/community/ET/ET_CurrencyManager_Description.txt CHANGED
@@ -1,88 +1,88 @@
1
- ==== Description / Для чего этот модуль? ====
2
-
3
- EN:
4
-
5
- ET Currency Manager lets shop owner manage display of prices on website in simple and convenient way.
6
- With this extension you can:
7
- * Specify number of decimal digits. For price rounding Magento internal algorithm is used. Example: instead of 49.99 you can display 50 or 49.9900.
8
- * Display prices without zero decimals. Example: display 49 instead of 49.00, but 49.99 remains unchanged.
9
- * Replace zero decimals with suffix. Example: display 49,- instead of 49.00 or 49, but 49.99 remains unchanged.
10
- * Specify position of currency symbol: before the price or after. Example: $ 49.99 or 49.99 $
11
- * Specify what to use as currency symbol. Example: nothing, use currency code (EUR, USD), use currency symbol (€, $), use currency name (Euro, US Dollar)
12
- * Change currency symbol to your own (text only). Example: display Money instead of $
13
- * Change zero price to your own text. Example: FREE instead of 0.00
14
- * Use separate settings for every store view
15
- * Use separate settings for every currency
16
- * Enable and disable extension for frontend and admin panel separately
17
- * Disable price rounding on checkout page
18
- * Enable price rounding on product input page
19
-
20
- Important note: this extension changes only currency display, not the price itself. Example: Product's price is 49.99, you can show it's price as 50, but during the payment client will be charged 49.99, because it is the real price.
21
-
22
- Additional note: You can change currency display even without this extension. For this you must change relevant localization files in Zend Framework (/lib/Zend/Locale/Data/*.xml). But in this case you can lose all of your changes while updating Magento.
23
-
24
-
25
-
26
- RU:
27
- Модуль ET Currency Manager позволяет владельцу магазина просто и удобно управлять отображением цены на своём сайте.
28
-
29
-
30
- С помощью модуля вы можете:
31
-
32
- * Указать количество знаков после запятой для отображения цен на сайте (для округления используется встроенный алгоритм Магенто). Пример: вместо 49.99 показывать или 50 или 49.9900
33
- * Отображать цены без "копеек". Пример: Вместо 49.00 показывать 49, но цену 49.99 не изменять.
34
- * Показывать суффикс для цены без "копеек". Вместо 49.00 или 49 показывать 49,- , но цену 49.99 не изменять.
35
- * Указать позицию символа валюты: перед ценой или после. Пример: $ 49.99 или 49.99 $
36
- * Указать, что использовать в качестве символа валюты. Пример: (не использовать; использовать код - EUR, USD; использовать символ - €, $; использовать название - Евро, Американский доллар)
37
- * Заменять символ валюты на свой (только текстовый). Пример: Вместо $ выводить Money.
38
- * Заменять нулевую цену на свой текст. Например: вместо 0.00 выводить БЕСПЛАТНО
39
- * Использовать различные настройки для каждого представления магазина.
40
- * Использовать различные настройки для каждой валюты отдельно.
41
- * Включать и отключать модуль для пользовательской части и панели администрирования независимо друг от друга.
42
- * Отключать округление цены на странице заказа.
43
- * Включать округление цены на странице ввода товара.
44
-
45
- Важно: модуль меняет исключительно отображение валюты, а не саму цену. (Пример: Товар стоит 49.99; Можно показывать цену клиентам как 50; Но при оплате с клиента будет удержано 49.99, так как это реальная стоимость товара).
46
-
47
- Дополнительно: Без этого модуля у вас есть возможность влиять на отображение валюты только редактируя значения в файлах локализации Zend Framework (/lib/Zend/Locale/Data/*.xml). Но при обновлении версии Магенто изменения могут быть утеряны (так как может обновиться Zend Framework).
48
-
49
-
50
- ====Features / Особенности модуля====
51
-
52
- * Open source code (no encryption and obfuscation)
53
- * Code follows Magento development standards
54
- * Extension is available on 2 languages (ru_RU, en_US) and you can easy add your own
55
- * All extension settings are available on admin panel
56
-
57
- * Открытый исходный код
58
- * Код написан придерживаясь принятых стандартов в разработке для Магенто
59
- * Доступен на 2-ух языках (ru_RU, en_US) и легко добавляются новые переводы
60
- * Все настройки модуля доступны в панели администрирования
61
-
62
- ====Version Compatibility / Совместимость версий====
63
- 1.3.х (tested in 1.3.2.4.)
64
- 1.4.x (tested in 1.4.1.1.)
65
- 1.5.x (tested in 1.5.0.1. 1.5.1.0)
66
-
67
- ====Module tags====
68
- price precision, round price, hide decimal, currency symbol, zero price replace
69
-
70
- символ валюты, настройка отображения валюты, валюта, цена, количество знаков после запятой
71
-
72
- ====Установка/Installation====
73
-
74
- * Disable Compiler, if it is enabled (System -> Tools -> Compilation)
75
- * Disable cache, if it is enabled (System -> Cache Management)
76
- * Install the extension (just unpack archive to magento root folder)
77
- * Log off admin panel (Log Out)
78
- * Log into admin panel (enter your login and password)
79
- * Set filter display parameters (System -> Configuration -> Currency Manager)
80
- * Run compilation process and enable cache if needed
81
-
82
- * Отключите компиляцию, если включена (Система -> Инструменты -> Компиляция)
83
- * Отключите кэш, если включён (Система -> Управление кэшем)
84
- * Установите модуль (распакуйте архив в корневую папку с Магенто)
85
- * Выйдите из панели администрирования (Выйти)
86
- * Войдите в панель администрирования (введите логин/пароль)
87
- * Настройте параметры отображения фильтра (Система -> Конфигурация -> Currency Manager)
88
- * Если необходимо запустите процесс компиляции и включите кэш
1
+ ==== Description / Для чего этот модуль? ====
2
+
3
+ EN:
4
+
5
+ ET Currency Manager lets shop owner manage display of prices on website in simple and convenient way.
6
+ With this extension you can:
7
+ * Specify number of decimal digits. For price rounding Magento internal algorithm is used. Example: instead of 49.99 you can display 50 or 49.9900.
8
+ * Display prices without zero decimals. Example: display 49 instead of 49.00, but 49.99 remains unchanged.
9
+ * Replace zero decimals with suffix. Example: display 49,- instead of 49.00 or 49, but 49.99 remains unchanged.
10
+ * Specify position of currency symbol: before the price or after. Example: $ 49.99 or 49.99 $
11
+ * Specify what to use as currency symbol. Example: nothing, use currency code (EUR, USD), use currency symbol (€, $), use currency name (Euro, US Dollar)
12
+ * Change currency symbol to your own (text only). Example: display Money instead of $
13
+ * Change zero price to your own text. Example: FREE instead of 0.00
14
+ * Use separate settings for every store view
15
+ * Use separate settings for every currency
16
+ * Enable and disable extension for frontend and admin panel separately
17
+ * Disable price rounding on checkout page
18
+ * Enable price rounding on product input page
19
+
20
+ Important note: this extension changes only currency display, not the price itself. Example: Product's price is 49.99, you can show it's price as 50, but during the payment client will be charged 49.99, because it is the real price.
21
+
22
+ Additional note: You can change currency display even without this extension. For this you must change relevant localization files in Zend Framework (/lib/Zend/Locale/Data/*.xml). But in this case you can lose all of your changes while updating Magento.
23
+
24
+
25
+
26
+ RU:
27
+ Модуль ET Currency Manager позволяет владельцу магазина просто и удобно управлять отображением цены на своём сайте.
28
+
29
+
30
+ С помощью модуля вы можете:
31
+
32
+ * Указать количество знаков после запятой для отображения цен на сайте (для округления используется встроенный алгоритм Магенто). Пример: вместо 49.99 показывать или 50 или 49.9900
33
+ * Отображать цены без "копеек". Пример: Вместо 49.00 показывать 49, но цену 49.99 не изменять.
34
+ * Показывать суффикс для цены без "копеек". Вместо 49.00 или 49 показывать 49,- , но цену 49.99 не изменять.
35
+ * Указать позицию символа валюты: перед ценой или после. Пример: $ 49.99 или 49.99 $
36
+ * Указать, что использовать в качестве символа валюты. Пример: (не использовать; использовать код - EUR, USD; использовать символ - €, $; использовать название - Евро, Американский доллар)
37
+ * Заменять символ валюты на свой (только текстовый). Пример: Вместо $ выводить Money.
38
+ * Заменять нулевую цену на свой текст. Например: вместо 0.00 выводить БЕСПЛАТНО
39
+ * Использовать различные настройки для каждого представления магазина.
40
+ * Использовать различные настройки для каждой валюты отдельно.
41
+ * Включать и отключать модуль для пользовательской части и панели администрирования независимо друг от друга.
42
+ * Отключать округление цены на странице заказа.
43
+ * Включать округление цены на странице ввода товара.
44
+
45
+ Важно: модуль меняет исключительно отображение валюты, а не саму цену. (Пример: Товар стоит 49.99; Можно показывать цену клиентам как 50; Но при оплате с клиента будет удержано 49.99, так как это реальная стоимость товара).
46
+
47
+ Дополнительно: Без этого модуля у вас есть возможность влиять на отображение валюты только редактируя значения в файлах локализации Zend Framework (/lib/Zend/Locale/Data/*.xml). Но при обновлении версии Магенто изменения могут быть утеряны (так как может обновиться Zend Framework).
48
+
49
+
50
+ ====Features / Особенности модуля====
51
+
52
+ * Open source code (no encryption and obfuscation)
53
+ * Code follows Magento development standards
54
+ * Extension is available on 2 languages (ru_RU, en_US) and you can easy add your own
55
+ * All extension settings are available on admin panel
56
+
57
+ * Открытый исходный код
58
+ * Код написан придерживаясь принятых стандартов в разработке для Магенто
59
+ * Доступен на 2-ух языках (ru_RU, en_US) и легко добавляются новые переводы
60
+ * Все настройки модуля доступны в панели администрирования
61
+
62
+ ====Version Compatibility / Совместимость версий====
63
+ 1.3.х (tested in 1.3.2.4.)
64
+ 1.4.x (tested in 1.4.1.1.)
65
+ 1.5.x (tested in 1.5.0.1. 1.5.1.0)
66
+
67
+ ====Module tags====
68
+ price precision, round price, hide decimal, currency symbol, zero price replace, price format
69
+
70
+ символ валюты, настройка отображения валюты, валюта, цена, количество знаков после запятой
71
+
72
+ ====Установка/Installation====
73
+
74
+ * Disable Compiler, if it is enabled (System -> Tools -> Compilation)
75
+ * Disable cache, if it is enabled (System -> Cache Management)
76
+ * Install the extension (just unpack archive to magento root folder)
77
+ * Log off admin panel (Log Out)
78
+ * Log into admin panel (enter your login and password)
79
+ * Set filter display parameters (System -> Configuration -> Currency Manager)
80
+ * Run compilation process and enable cache if needed
81
+
82
+ * Отключите компиляцию, если включена (Система -> Инструменты -> Компиляция)
83
+ * Отключите кэш, если включён (Система -> Управление кэшем)
84
+ * Установите модуль (распакуйте архив в корневую папку с Магенто)
85
+ * Выйдите из панели администрирования (Выйти)
86
+ * Войдите в панель администрирования (введите логин/пароль)
87
+ * Настройте параметры отображения фильтра (Система -> Конфигурация -> Currency Manager)
88
+ * Если необходимо запустите процесс компиляции и включите кэш
app/code/community/ET/ET_CurrencyManager_LICENSE.txt CHANGED
@@ -1,48 +1,60 @@
1
- http://opensource.org/licenses/afl-3.0.php
2
-
3
- Academic Free License ("AFL") v. 3.0
4
- This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
5
-
6
- Licensed under the Academic Free License version 3.0
7
-
8
- 1) Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
9
-
10
- a) to reproduce the Original Work in copies, either alone or as part of a collective work;
11
-
12
- b) to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
13
-
14
- c) to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
15
-
16
- d) to perform the Original Work publicly; and
17
-
18
- e) to display the Original Work publicly.
19
-
20
- 2) Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
21
-
22
- 3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
23
-
24
- 4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
25
-
26
- 5) External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
27
-
28
- 6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
29
-
30
- 7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
31
-
32
- 8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
33
-
34
- 9) Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
35
-
36
- 10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
37
-
38
- 11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
39
-
40
- 12) Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
41
-
42
- 13) Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
43
-
44
- 14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
45
-
46
- 15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
47
-
48
- 16) Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
 
 
 
 
 
 
 
 
 
 
 
 
1
+ =========en_US============
2
+ ETWS Free License (EFL1)
3
+ shop.etwebsolutions.com/eng/etws-license-free-v1
4
+
5
+ THIS LICENSE AGREEMENT (HEREINAFTER AGREEMENT) IS AN AGREEMENT BETWEEN
6
+ YOU (THE PERSON OR COMPANY WHO IS BEING LICENSED TO USE THE SOFTWARE OR DOCUMENTATION)
7
+ AND ET STUDIO CO.
8
+
9
+ 1. By purchasing the Software you agree with the content of this Agreement
10
+ and agree to use the Software in compliance with this Agreement.
11
+
12
+ 2. You are a user of this Software and ET Studio Co is an owner.
13
+
14
+ 3. You may not sell, resell, sub-license or lease any fragment of the Software or its Documentation to anyone.
15
+
16
+ 4. If you distribute original or changed version of the Software, you must include
17
+ this Agreement without any changes and original version of the Software.
18
+
19
+ 5. We do not and will not bear responsibility for any damages (including any loss of your profit or savings)
20
+ caused to you, your business and your information by use or inability to use this Software.
21
+
22
+ 6. We are not liable for prosecution arising from use of the Software against law or for any illegal use.
23
+
24
+ 7. In case of failure to comply with any condition of this Agreement, your license to use the Software is revoked.
25
+
26
+ 8. Agreement remains effective without any time limits until it is terminated.
27
+
28
+ 9. ET Studio Co reserves the right to change Agreement type for future versions of Software.
29
+
30
+
31
+
32
+ =========ru_RU============
33
+ ETWS Свободная лицензия (EFL1)
34
+ shop.etwebsolutions.com/rus/etws-license-free-v1
35
+
36
+ ЭТО ЛИЦЕНЗИОННОЕ СОГЛАШЕНИЕ (ДАЛЕЕ ЛИЦЕНЗИЯ) ЯВЛЯЕТСЯ СОГЛАШЕНИЕМ МЕЖДУ
37
+ ВАМИ (ФИЗИЧЕСКИМ ИЛИ ЮРИДИЧЕСКИМ ЛИЦОМ, КОТОРОМУ ВЫДАНА ЛИЦЕНЗИЯ НА ИСПОЛЬЗОВАНИЕ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ)
38
+ И КОМПАНИЕЙ ET STUDIO.
39
+
40
+ 1. Используя копию программного обеспечения (ПО) вы соглашаетесь с условиями,
41
+ изложенными в данной лицензии и обязуетесь их соблюдать.
42
+
43
+ 2. Вы являетесь пользователем ПО. Владельцем ПО является компания ET Studio.
44
+
45
+ 3. Вы не имеете права продавать, выдавать подлицензии, сдавать в аренду любую часть данного ПО или Документации
46
+ кому бы то ни было.
47
+
48
+ 4. При распространении оригинальной или изменённой версии данного ПО вы обязаны включить в неё
49
+ данное лицензионное соглашение без внесения изменений и оригинальную версию данного ПО.
50
+
51
+ 5. Мы не несём ответственность за любые причинённые вам, вашему бизнесу или информации убытки и недополученную прибыль,
52
+ связанные с использованием или невозможностью использования данного ПО.
53
+
54
+ 6. Мы не несём ответственность за использование данного ПО в противозаконных целях.
55
+
56
+ 7. В случае нарушения любых пунктов этой лицензии она будет отозвана и вы потеряете право на использование данного ПО.
57
+
58
+ 8. Данная лицензия действует без ограничения по времени, пока не будет отозвана.
59
+
60
+ 9. Компания ET Studio имеет право менять тип лицензии для последующих версий ПО.
app/design/frontend/default/default/layout/et_currencymanager.xml CHANGED
@@ -1,11 +1,10 @@
1
  <?xml version="1.0"?>
2
  <!--
3
  /**
4
- * ET Web Solutions
5
- *
6
  * NOTICE OF LICENSE
7
  *
8
- * This source file is subject to the Academic Free License (AFL 3.0)
 
9
  *
10
  * DISCLAIMER
11
  *
@@ -14,18 +13,18 @@
14
  *
15
  * @category ET
16
  * @package ET_CurrencyManager
17
- * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
18
  * @contacts support@etwebsolutions.com
19
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
- */
21
  -->
22
 
23
  <layout version="0.1.0">
24
- <default>
25
- <reference name="head">
26
- <block ifconfig="currencymanager/general/enabled" type="currencymanager/js" name="currencymanager.js.config" template="et_currencymanager/js.phtml"></block>
27
- <action ifconfig="currencymanager/general/cutzerodecimal" method="addItem"><type>skin_js</type><name>et_currencymanager/et_currencymanager.js</name></action>
28
- <action ifconfig="currencymanager/general/enabled" method="addItem"><type>skin_js</type><name>et_currencymanager/et_currencymanager_round.js</name></action>
29
- </reference>
30
- </default>
31
  </layout>
1
  <?xml version="1.0"?>
2
  <!--
3
  /**
 
 
4
  * NOTICE OF LICENSE
5
  *
6
+ * You may not sell, sub-license, rent or lease
7
+ * any portion of the Software or Documentation to anyone.
8
  *
9
  * DISCLAIMER
10
  *
13
  *
14
  * @category ET
15
  * @package ET_CurrencyManager
16
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
17
  * @contacts support@etwebsolutions.com
18
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
19
+ */
20
  -->
21
 
22
  <layout version="0.1.0">
23
+ <default>
24
+ <reference name="head">
25
+ <block ifconfig="currencymanager/general/enabled" type="currencymanager/js" name="currencymanager.js.config" template="et_currencymanager/js.phtml"></block>
26
+ <action ifconfig="currencymanager/general/cutzerodecimal" method="addItem"><type>skin_js</type><name>et_currencymanager/et_currencymanager.js</name></action>
27
+ <action ifconfig="currencymanager/general/enabled" method="addItem"><type>skin_js</type><name>et_currencymanager/et_currencymanager_round.js</name></action>
28
+ </reference>
29
+ </default>
30
  </layout>
app/design/frontend/default/default/template/et_currencymanager/js.phtml CHANGED
@@ -1,23 +1,22 @@
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) 2011 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
- <script type="text/javascript">
22
- etCurrencyManagerJsConfig=<?php print $this->getJsonConfig();?>
23
- </script>
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_CurrencyManager
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+ ?>
20
+ <script type="text/javascript">
21
+ etCurrencyManagerJsConfig=<?php print $this->getJsonConfig();?>
22
+ </script>
 
app/etc/modules/ET_CurrencyManager.xml CHANGED
@@ -1,11 +1,10 @@
1
  <?xml version="1.0"?>
2
  <!--
3
  /**
4
- * ET Web Solutions
5
- *
6
  * NOTICE OF LICENSE
7
  *
8
- * This source file is subject to the Academic Free License (AFL 3.0)
 
9
  *
10
  * DISCLAIMER
11
  *
@@ -14,17 +13,16 @@
14
  *
15
  * @category ET
16
  * @package ET_CurrencyManager
17
- * @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
18
  * @contacts support@etwebsolutions.com
19
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
- */
21
  -->
22
-
23
  <config>
24
- <modules>
25
- <ET_CurrencyManager>
26
- <active>true</active>
27
- <codePool>community</codePool>
28
- </ET_CurrencyManager>
29
- </modules>
30
  </config>
1
  <?xml version="1.0"?>
2
  <!--
3
  /**
 
 
4
  * NOTICE OF LICENSE
5
  *
6
+ * You may not sell, sub-license, rent or lease
7
+ * any portion of the Software or Documentation to anyone.
8
  *
9
  * DISCLAIMER
10
  *
13
  *
14
  * @category ET
15
  * @package ET_CurrencyManager
16
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
17
  * @contacts support@etwebsolutions.com
18
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
19
+ */
20
  -->
 
21
  <config>
22
+ <modules>
23
+ <ET_CurrencyManager>
24
+ <active>true</active>
25
+ <codePool>community</codePool>
26
+ </ET_CurrencyManager>
27
+ </modules>
28
  </config>
app/locale/ru_RU/ET_Currencymanager.csv CHANGED
@@ -1,45 +1,66 @@
1
- "Currency Manager","Currency Manager"
2
- "Remove","Удалить"
3
- "* Select currency","* Выберите валюту"
4
- "Currency Options","Параметры валюты"
5
- "Enabled for Frontend","Включено для пользователей"
6
- "Enabled for Admin","Включено для администраторов"
7
- "Precision","Точность"
8
- "Precision:","Точность:"
9
- "Number of decimal (e.g. 0, 1, 2). Default: 0","Кол-во знаков после запятой (например: 0, 1, 2). По умолчанию: 0"
10
- "Symbol position","Позиция символа"
11
- "Currency symbol use","Обозначение валюты"
12
- "e.g. Symbol = Ls, Short name = LVL, Name = Latvian Lats","Например: Символ = руб., Код = RUB, Наименование = Российский рубль"
13
- "Default","По умолчанию"
14
- "Right","После цены"
15
- "Left","Перед ценой"
16
- "Do not use","не использовать"
17
- "Use symbol","символ"
18
- "Use short name","код"
19
- "Use name","наименование"
20
- "Yes","Да"
21
- "No","Нет"
22
- "Frontend specific options","Параметры для пользовательской части"
23
- "Admin specific options","Параметры для панели администрирования"
24
- "Currency options (global)","Параметры валюты (глобальные)"
25
- "Currency options (for specific currency)","Параметры валюты (для конкретной валюты)"
26
- "Exclude for checkout","Исключение для заказа"
27
- "If Yes - options [Precision] and [Replace Zero Price] will not affect display of prices in checkout.","Если Да - параметры [Точность] и [Заменить нулевые цены] не будут влиять на отображение цены в заказе."
28
- "Cut Zero Decimals","Отбрасывать нули после запятой"
29
- "Cut Zero Decimals:","Отбрасывать нули после запятой:"
30
- "If Yes price will be 99 instead of 99.00, but 99.99 if price 99.99","Если Да цена будет 99 вместо 99.00, но 99.99 при цене 99.99"
31
- "Currency specific options","Параметры для конкретной валюты"
32
- "Select currency:","Выберите валюту:"
33
- "Symbol position:","Позиция символа:"
34
- "Currency symbol use:","Обозначение валюты:"
35
- "Replace symbol to:","Заменить символ на:"
36
- "Replace Zero Price to:","Заменить нулевые цены на:"
37
- "Add currency specific options","Добавить параметры, специфичные для валюты"
38
- "Currency Manager information","Currency Manager информация"
39
- "Support by support@etwebsolutions.com <br /> You can hire our team for any customizations. Contact us at sales@etwebsolutions.com","Поддержка - support@etwebsolutions.com <br /> Вы можете нанять нашу команду для любых работ по Magento. Пишите на sales@etwebsolutions.com"
40
- "Leave empty for disable replace","Оставьте пустым, если не хотите делать замену"
41
- "Leave empty for global value use","Оставьте пустым для использования глобального значения"
42
- "Used only if Cut Zero Decimals = Yes, default "",-""","Используется только при значении Отбрасывать нули после запятой = Да. По умолчанию: "",-"""
43
- "Enable for Inputs","Применять для полей ввода цены"
44
- "Suffix:","Заменить отброшенные нули на значение:"
45
- "Replaces Cuted Zero Decimals","Заменить отброшенные нули на значение"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Currency Manager","Currency Manager"
2
+ "Remove","Удалить"
3
+ "* Select currency","* Выберите валюту"
4
+ "Currency Options","Параметры валюты"
5
+ "Enabled for Frontend","Включено для пользователей"
6
+ "Enabled for Admin","Включено для администраторов"
7
+ "Precision","Точность"
8
+ "Precision:","Точность:"
9
+ "Number of decimal (e.g. 0, 1, 2). Default: 0","Кол-во знаков после запятой (например: 0, 1, 2). По умолчанию: 0"
10
+ "Symbol position","Позиция символа"
11
+ "Currency symbol use","Обозначение валюты"
12
+ "e.g. Symbol = Ls, Short name = LVL, Name = Latvian Lats","Например: Символ = руб., Код = RUB, Наименование = Российский рубль"
13
+ "Default","По умолчанию"
14
+ "Right","После цены"
15
+ "Left","Перед ценой"
16
+ "Do not use","не использовать"
17
+ "Use symbol","символ"
18
+ "Use short name","код"
19
+ "Use name","наименование"
20
+ "Yes","Да"
21
+ "No","Нет"
22
+ "Frontend specific options","Параметры для пользовательской части"
23
+ "Admin specific options","Параметры для панели администрирования"
24
+ "Currency options (global)","Параметры валюты (глобальные)"
25
+ "Currency options (for specific currency)","Параметры валюты (для конкретной валюты)"
26
+ "Exclude for checkout","Исключение для заказа"
27
+ "If Yes - options [Precision] and [Replace Zero Price] will not affect display of prices in checkout.","Если Да - параметры [Точность] и [Заменить нулевые цены] не будут влиять на отображение цены в заказе."
28
+ "Cut Zero Decimals","Отбрасывать нули после запятой"
29
+ "Cut Zero Decimals:","Отбрасывать нули после запятой:"
30
+ "If Yes price will be 99 instead of 99.00, but 99.99 if price 99.99","Если Да цена будет 99 вместо 99.00, но 99.99 при цене 99.99"
31
+ "Currency specific options","Параметры для конкретной валюты"
32
+ "Select currency:","Выберите валюту:"
33
+ "Symbol position:","Позиция символа:"
34
+ "Currency symbol use:","Обозначение валюты:"
35
+ "Replace symbol to:","Заменить символ на:"
36
+ "Replace Zero Price to:","Заменить нулевые цены на:"
37
+ "Add currency specific options","Добавить параметры, специфичные для валюты"
38
+ "Currency Manager information","Информация о модуле Currency Manager"
39
+ "Support by support@etwebsolutions.com <br /> You can hire our team for any customizations. Contact us at sales@etwebsolutions.com","Поддержка - support@etwebsolutions.com <br /> Вы можете нанять нашу команду для любых работ по Magento. Пишите на sales@etwebsolutions.com"
40
+ "Leave empty for disable replace","Оставьте пустым, если не хотите делать замену"
41
+ "Leave empty for global value use","Оставьте пустым для использования глобального значения"
42
+ "Used only if Cut Zero Decimals = Yes, default "",-""","Используется только при значении Отбрасывать нули после запятой = Да. По умолчанию: "",-"""
43
+ "Enable for Inputs","Применять для полей ввода цены"
44
+ "Suffix:","Заменить отброшенные нули на значение:"
45
+ "Replaces Cuted Zero Decimals","Заменить отброшенные нули на значение"
46
+ "Click here to configure currency additional display options","Перейти к дополнительным настройкам отображения валюты"
47
+
48
+ "Extension:","Модуль:"
49
+ "<strong>%s</strong> (version %s)","<strong>%s</strong> (версия %s)"
50
+ "License:","Лицензия:"
51
+ "Short Description:","Краткое описание:"
52
+ "Documentation:","Документация:"
53
+ "Support:","Поддержка:"
54
+ "Advertisement:","Реклама:"
55
+ "You can see description of extension features and answers to the frequently asked questions on <a href=""%s"" target=""_balnk"">our website</a>.","Описание позможностей модуля и ответы на часто задаваемые вопросы смотрите на <a href=""%s"" target=""_balnk"">нашем сайте</a>."
56
+ "You can hire our team to customize the extension. E-mail us on sales@etwebsolutions.com.<br><br>You can see a list of provided services on <a href=""%s"" target=""_blank"">our website</a>.","Вы можете нанять нашу команду для любых работ по модификации модуля. Пишите на адрес sales@etwebsolutions.com.<br><br>Со списком предоставляемых нами услуг вы можете ознакомиться <a href=""%s"" target=""_blank"">на нашем сайте</a>."
57
+
58
+ "Extension support is available through <a href=""%s"" target=""_blank"">issue tracking system</a>.<br>You can see information freely, but you will have to sign up to open a ticket.<br><br>Please, report all bugs and feature requests that are connected to this extension.<br><br>If by some reason you can not submit a question, bug report or feature request to our ticket system, you can write us an email - support@etwebsolutions.com.","Поддержка модуля осуществляется через <a href=""%s"" target=""_blank"">систему отслеживания заданий</a>.<br>Для создания задачи будет необходимо зарегистрироваться. Для просмотра информации регистрация не требуется.<br><br>Пожалуйста, сообщайте нам о найденных ошибках и о своих пожеланиях в рамках этого модуля.<br><br>Если по каким-либо причинам вы не можете размеситить вопрос/сообщение об ошибке/пожелание в списке задач, то можете написать нам по адресу support@etwebsolutions.com."
59
+ "",""
60
+ "",""
61
+ "",""
62
+ "",""
63
+ "",""
64
+ "",""
65
+ "",""
66
+ "",""
package.xml CHANGED
@@ -1,22 +1,22 @@
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>
8
  <extends/>
9
  <summary>Currency Manager module allow to change in admin currency's display parametrs.</summary>
10
- <description>Currency Manager module allow to change in admin currency's display parametrs:
11
- * symbol
12
- * precision
13
- * symbol position
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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ET_CurrencyManager</name>
4
+ <version>1.0.0</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>
8
  <extends/>
9
  <summary>Currency Manager module allow to change in admin currency's display parametrs.</summary>
10
+ <description>Currency Manager module allow to change in admin currency's display parametrs:&#xD;
11
+ * symbol&#xD;
12
+ * precision&#xD;
13
+ * symbol position&#xD;
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-12</date>
18
+ <time>08:19:38</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="ef84054e143628a119dfbe93ef97e08c"/></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="6f4323bf8cfbb16d807560bc518644de"/><file name="system.xml" hash="9e055baa423482a3e3b3970f3aa9479e"/></dir></dir><file name="ET_CurrencyManager_ChangeLog.txt" hash="a593a207743738208643a01980faa343"/><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>
skin/frontend/default/default/et_currencymanager/et_currencymanager.js CHANGED
@@ -1,15 +1,15 @@
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
+ {
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
  }
skin/frontend/default/default/et_currencymanager/et_currencymanager_round.js CHANGED
@@ -1,90 +1,165 @@
1
- if(typeof(Product)!="undefined"){
2
- Product.Config.prototype=Object.extend(Product.Config.prototype,{
3
- formatPrice: function(price, showSign)
4
- {
5
- var str = '';
6
- price = parseFloat(price);
7
- if(showSign){
8
- if(price<0){
9
- str+= '-';
10
- price = -price;
11
- }
12
- else{
13
- str+= '+';
14
- }
15
- }
16
-
17
- var roundedPrice = (Math.round(price*100)/100).toString();
18
-
19
- if (this.prices && this.prices[roundedPrice]) {
20
- str+= this.prices[roundedPrice];
21
- }
22
- else {
23
- precision=2;
24
- if(typeof(etCurrencyManagerJsConfig.precision)!="undefined")precision=etCurrencyManagerJsConfig.precision;
25
- if(typeof(optionsPrice)!="undefined")
26
- if(typeof(optionsPrice.priceFormat)!="undefined")
27
- precision=optionsPrice.priceFormat.requiredPrecision;
28
- if(typeof(etCurrencyManagerJsConfig.cutzerodecimal)!="undefined")
29
- if(etCurrencyManagerJsConfig.cutzerodecimal!=0)
30
- if(price-parseInt(price)==0){
31
- precision=0;
32
- }
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
- }
45
- return str;
46
- }
47
-
48
-
49
- });
50
- }
51
-
52
-
53
-
54
- try{
55
-
56
- originalFormatCurrency=window.formatCurrency;
57
-
58
- window.formatCurrency= function formatCurrency(price, format, showPlus){
59
- //zeroSymbol
60
- if(typeof(etCurrencyManagerJsConfig)!="undefined"){
61
- if(price==0)if(typeof(etCurrencyManagerJsConfig.zerotext)!="undefined")return etCurrencyManagerJsConfig.zerotext;
62
- }
63
- //cut zero decimal
64
- if(price-parseInt(price)==0)
65
- if(typeof(etCurrencyManagerJsConfig.cutzerodecimal)!="undefined")
66
- if(etCurrencyManagerJsConfig.cutzerodecimal!=0){
67
- format.precision=0;
68
- format.requiredPrecision=0;
69
-
70
- var for_replace = originalFormatCurrency(price, format, showPlus);
71
-
72
-
73
- if(typeof(etCurrencyManagerJsConfig.cutzerodecimal_suffix)!="undefined")
74
- if(etCurrencyManagerJsConfig.cutzerodecimal_suffix.length>0){
75
- return for_replace.replace(price, price+""+etCurrencyManagerJsConfig.cutzerodecimal_suffix);
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
-
85
-
86
- }
87
- }
88
- catch (e){
89
- //do nothing
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
1
+ if (typeof(Product) != "undefined") {
2
+ Product.Config.prototype = Object.extend(Product.Config.prototype, {
3
+ formatPrice:function (price, showSign) {
4
+ var str = '';
5
+ price = parseFloat(price);
6
+ if (showSign) {
7
+ if (price < 0) {
8
+ str += '-';
9
+ price = -price;
10
+ }
11
+ else {
12
+ str += '+';
13
+ }
14
+ }
15
+
16
+ var roundedPrice = (Math.round(price * 100) / 100).toString();
17
+
18
+ if (this.prices && this.prices[roundedPrice]) {
19
+ str += this.prices[roundedPrice];
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
+ }
38
+ if (precision > 0) {
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
+ }
50
+ }
51
+ str += this.priceTemplate.evaluate({price:price});
52
+ }
53
+ }
54
+ return str;
55
+ }
56
+
57
+
58
+ });
59
+ }
60
+
61
+
62
+ 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);
70
+ if (price - Math.round(price) != 0) {
71
+ if (Math.abs(price - Math.round(price)) < 0.00000001) {
72
+ price = 0;
73
+ }
74
+ }
75
+ if (typeof(etCurrencyManagerJsConfig) != "undefined") {
76
+ if (price == 0) {
77
+ if (typeof(etCurrencyManagerJsConfig.zerotext) != "undefined") {
78
+ return etCurrencyManagerJsConfig.zerotext;
79
+ }
80
+ }
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
+ }
97
+ }
98
+ }
99
+
100
+ return formatCurrencyET(price, format, showPlus);
101
+ //if(format.precision<0)format.precision=0;
102
+ //if(format.requiredPrecision<0)format.requiredPrecision=0;
103
+ /*return originalFormatCurrency(price, format, showPlus);*/
104
+
105
+
106
+ }
107
+
108
+
109
+ function formatCurrencyET(price, format, showPlus) {
110
+ var precision = isNaN(format.precision = (format.precision)) ? 2 : format.precision;
111
+ var requiredPrecision = isNaN(format.requiredPrecision = (format.requiredPrecision)) ? 2 : format.requiredPrecision;
112
+
113
+ //precision = (precision > requiredPrecision) ? precision : requiredPrecision;
114
+ //for now we don't need this difference so precision is requiredPrecision
115
+ precision = requiredPrecision;
116
+
117
+ var integerRequired = isNaN(format.integerRequired = Math.abs(format.integerRequired)) ? 1 : format.integerRequired;
118
+
119
+ var decimalSymbol = format.decimalSymbol == undefined ? "," : format.decimalSymbol;
120
+ var groupSymbol = format.groupSymbol == undefined ? "." : format.groupSymbol;
121
+ var groupLength = format.groupLength == undefined ? 3 : format.groupLength;
122
+
123
+ var s = '';
124
+
125
+ if (showPlus == undefined || showPlus == true) {
126
+ s = price < 0 ? "-" : ( showPlus ? "+" : "");
127
+ } else if (showPlus == false) {
128
+ s = '';
129
+ }
130
+
131
+ var i = parseInt(price = Math.abs(+price || 0).toFixed(precision)) + "";
132
+ var pad = (i.length < integerRequired) ? (integerRequired - i.length) : 0;
133
+ while (pad) {
134
+ i = '0' + i;
135
+ pad--;
136
+ }
137
+ j = (j = i.length) > groupLength ? j % groupLength : 0;
138
+ re = new RegExp("(\\d{" + groupLength + "})(?=\\d)", "g");
139
+
140
+ /**
141
+ * replace(/-/, 0) is only for fixing Safari bug which appears
142
+ * when Math.abs(0).toFixed() executed on "0" number.
143
+ * Result is "0.-0" :(
144
+ */
145
+ if (precision < 0) {
146
+ precision = 0;
147
+ }
148
+ var r = (j ? i.substr(0, j) + groupSymbol : "") + i.substr(j).replace(re, "$1" + groupSymbol) + (precision ? decimalSymbol + Math.abs(price - i).toFixed(precision).replace(/-/, 0).slice(2) : "")
149
+ var pattern = '';
150
+ if (format.pattern.indexOf('{sign}') == -1) {
151
+ pattern = s + format.pattern;
152
+ } else {
153
+ pattern = format.pattern.replace('{sign}', s);
154
+ }
155
+
156
+ return pattern.replace('%s', r).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
157
+ }
158
+
159
+ ;
160
+
161
+
162
+ }
163
+ catch (e) {
164
+ //do nothing
165
  }