Version Notes
stable release
Download this release
Release Info
Developer | Magento Core Team |
Extension | ET_CurrencyManager |
Version | 1.2.4 |
Comparing to | |
See all releases |
Code changes from version 1.2.3 to 1.2.4
- app/code/community/ET/CurrencyManager/Helper/Data.php +273 -273
- app/code/community/ET/CurrencyManager/Helper/Tax1810.php +3 -3
- app/code/community/ET/CurrencyManager/etc/config.xml +212 -212
- app/code/community/ET/CurrencyManager/etc/system.xml +1 -1
- app/locale/ru_RU/ET_Currencymanager.csv +0 -1
- js/et/currencymanager/et_currencymanager_round.js +243 -243
- package.xml +4 -4
app/code/community/ET/CurrencyManager/Helper/Data.php
CHANGED
@@ -1,274 +1,274 @@
|
|
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_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 |
-
$options = array();
|
93 |
-
$optionsAdvanced = array();
|
94 |
-
$storeId = Mage::app()->getStore()->getStoreId();
|
95 |
-
if ($this->isEnabled()) {
|
96 |
-
$notCheckout = !($config['excludecheckout'] & $this->isInOrder());
|
97 |
-
$this->_getGeneralOptions($config, $options, $optionsAdvanced, $notCheckout);
|
98 |
-
|
99 |
-
// formatting symbols from admin, preparing to use. Maybe can do better :)
|
100 |
-
// если в админке будут внесены
|
101 |
-
// несколько значений для одной валюты,
|
102 |
-
// то использоваться будет только одна
|
103 |
-
if (isset($config['symbolreplace'])) {
|
104 |
-
$this->_collectCurrencyOptions($config, $currency, $notCheckout, $options, $optionsAdvanced);
|
105 |
-
}
|
106 |
-
} // end NOT ENABLED
|
107 |
-
|
108 |
-
$this->_options[$storeId][$currency] = $options;
|
109 |
-
$this->_optionsadvanced[$storeId][$currency] = $optionsAdvanced;
|
110 |
-
if (!isset($this->_options[$storeId]["default"])) {
|
111 |
-
$this->_options[$storeId]["default"] = $options;
|
112 |
-
$this->_optionsadvanced[$storeId]["default"] = $optionsAdvanced;
|
113 |
-
}
|
114 |
-
|
115 |
-
return $this;
|
116 |
-
}
|
117 |
-
|
118 |
-
protected function _getGeneralOptions($config, &$options, &$optionsAdvanced, $notCheckout)
|
119 |
-
{
|
120 |
-
if ($notCheckout) {
|
121 |
-
if (isset($config['precision'])) { // precision must be in range -1 .. 30
|
122 |
-
$options['precision'] = min(30, max(-1, (int)$config['precision']));
|
123 |
-
}
|
124 |
-
|
125 |
-
if (isset($config['zerotext'])) {
|
126 |
-
$optionsAdvanced['zerotext'] = $config['zerotext'];
|
127 |
-
}
|
128 |
-
}
|
129 |
-
|
130 |
-
if (isset($config['position'])) {
|
131 |
-
$options['position'] = (int)$config['position'];
|
132 |
-
}
|
133 |
-
if (isset($config['display'])) {
|
134 |
-
$options['display'] = (int)$config['display'];
|
135 |
-
}
|
136 |
-
|
137 |
-
|
138 |
-
if (isset($config['input_admin'])) {
|
139 |
-
if ($config['input_admin'] > 0) {
|
140 |
-
$optionsAdvanced['input_admin'] = (int)$config['input_admin'];
|
141 |
-
}
|
142 |
-
}
|
143 |
-
|
144 |
-
$optionsAdvanced['excludecheckout'] = $config['excludecheckout'];
|
145 |
-
$optionsAdvanced['cutzerodecimal'] = $config['cutzerodecimal'];
|
146 |
-
$optionsAdvanced['cutzerodecimal_suffix'] = isset($config['cutzerodecimal_suffix']) ?
|
147 |
-
$config['cutzerodecimal_suffix'] : "";
|
148 |
-
$optionsAdvanced['min_decimal_count'] = isset($config['min_decimal_count']) ?
|
149 |
-
$config['min_decimal_count'] : "2";
|
150 |
-
}
|
151 |
-
|
152 |
-
protected function _collectCurrencyOptions($config, $currency, $notCheckout, &$options, &$optionsAdvanced)
|
153 |
-
{
|
154 |
-
$symbolReplace = $this->_unsetSymbolReplace($config);
|
155 |
-
|
156 |
-
if (count($symbolReplace['currency']) > 0) {
|
157 |
-
$tmpOptions = array();
|
158 |
-
$tmpOptionsAdvanced = array();
|
159 |
-
|
160 |
-
$tmpOptionsAdvanced['cutzerodecimal'] = $this->_getCurrencyOption(
|
161 |
-
$currency, $symbolReplace, 'cutzerodecimal', true
|
162 |
-
);
|
163 |
-
|
164 |
-
if (isset($symbolReplace['cutzerodecimal_suffix'])) {
|
165 |
-
$tmpOptionsAdvanced["cutzerodecimal_suffix"] = $this->_getCurrencyOption(
|
166 |
-
$currency, $symbolReplace, 'cutzerodecimal_suffix'
|
167 |
-
);
|
168 |
-
}
|
169 |
-
|
170 |
-
if (isset($symbolReplace['min_decimal_count'])) {
|
171 |
-
$tmpOptionsAdvanced["min_decimal_count"] = $this->_getCurrencyOption(
|
172 |
-
$currency, $symbolReplace, 'min_decimal_count'
|
173 |
-
);
|
174 |
-
}
|
175 |
-
|
176 |
-
|
177 |
-
$tmpOptions['position'] = $this->_getCurrencyOption($currency, $symbolReplace, 'position', true);
|
178 |
-
$tmpOptions['display'] = $this->_getCurrencyOption($currency, $symbolReplace, 'display', true);
|
179 |
-
$tmpOptions['symbol'] = $this->_getCurrencyOption($currency, $symbolReplace, 'symbol');
|
180 |
-
|
181 |
-
if ($notCheckout) {
|
182 |
-
$tmpOptionsAdvanced['zerotext'] = $this->_getCurrencyOption($currency, $symbolReplace, 'zerotext');
|
183 |
-
|
184 |
-
$precision = $this->_getCurrencyOption($currency, $symbolReplace, 'precision', true);
|
185 |
-
if ($precision !== false) {
|
186 |
-
$tmpOptions['precision'] = min(30, max(-1, $precision));
|
187 |
-
}
|
188 |
-
}
|
189 |
-
|
190 |
-
foreach ($tmpOptions as $option => $value) {
|
191 |
-
if ($value !== false) {
|
192 |
-
$options[$option] = $value;
|
193 |
-
}
|
194 |
-
}
|
195 |
-
|
196 |
-
foreach ($tmpOptionsAdvanced as $option => $value) {
|
197 |
-
if ($value !== false) {
|
198 |
-
$optionsAdvanced[$option] = $value;
|
199 |
-
}
|
200 |
-
}
|
201 |
-
|
202 |
-
}
|
203 |
-
}
|
204 |
-
|
205 |
-
/**
|
206 |
-
* To check where price is used
|
207 |
-
* in some cases default values for precision and zerotext should be used
|
208 |
-
* for sales/checkout in frontend
|
209 |
-
* for admin AND sales_order*
|
210 |
-
*
|
211 |
-
* @return bool
|
212 |
-
*/
|
213 |
-
public function isInOrder()
|
214 |
-
{
|
215 |
-
$moduleName = Mage::app()->getRequest()->getModuleName();
|
216 |
-
$controllerName = Mage::app()->getRequest()->getControllerName();
|
217 |
-
|
218 |
-
$orderModules = array('sales', 'checkout');
|
219 |
-
$modifiedOrderModules = array(
|
220 |
-
'order_modules' => new Varien_Object(array('module_names'=>$orderModules)),
|
221 |
-
);
|
222 |
-
|
223 |
-
Mage::dispatchEvent('et_currencymanager_checking_is_in_order_before', $modifiedOrderModules);
|
224 |
-
|
225 |
-
$orderModules = $modifiedOrderModules['order_modules']->getData('module_names');
|
226 |
-
|
227 |
-
return ((in_array($moduleName, $orderModules))
|
228 |
-
|| (
|
229 |
-
($moduleName == 'admin') && (strpos($controllerName, 'sales_order') !== false)
|
230 |
-
));
|
231 |
-
}
|
232 |
-
|
233 |
-
protected function _unsetSymbolReplace($config)
|
234 |
-
{
|
235 |
-
if (!is_array($config['symbolreplace'])) {
|
236 |
-
$symbolReplace = unserialize($config['symbolreplace']);
|
237 |
-
foreach (array_keys($symbolReplace['currency']) as $symbolReplaceKey) {
|
238 |
-
if (strlen(trim($symbolReplace['currency'][$symbolReplaceKey])) == 0) {
|
239 |
-
unset($symbolReplace['currency'][$symbolReplaceKey]);
|
240 |
-
unset($symbolReplace['precision'][$symbolReplaceKey]);
|
241 |
-
unset($symbolReplace['min_decimal_count'][$symbolReplaceKey]);
|
242 |
-
unset($symbolReplace['cutzerodecimal'][$symbolReplaceKey]);
|
243 |
-
unset($symbolReplace['cutzerodecimal_suffix'][$symbolReplaceKey]);
|
244 |
-
unset($symbolReplace['position'][$symbolReplaceKey]);
|
245 |
-
unset($symbolReplace['display'][$symbolReplaceKey]);
|
246 |
-
unset($symbolReplace['symbol'][$symbolReplaceKey]);
|
247 |
-
unset($symbolReplace['zerotext'][$symbolReplaceKey]);
|
248 |
-
}
|
249 |
-
}
|
250 |
-
return $symbolReplace;
|
251 |
-
}
|
252 |
-
return false;
|
253 |
-
}
|
254 |
-
|
255 |
-
public function resetOptions()
|
256 |
-
{
|
257 |
-
$this->_options = array();
|
258 |
-
$this->_optionsadvanced = array();
|
259 |
-
}
|
260 |
-
|
261 |
-
protected function _getCurrencyOption($currency, $symbolReplace, $option, $int = false)
|
262 |
-
{
|
263 |
-
$configSubData = array_combine($symbolReplace['currency'], $symbolReplace[$option]);
|
264 |
-
if (array_key_exists($currency, $configSubData)) {
|
265 |
-
$value = $configSubData[$currency];
|
266 |
-
if ($value === "") {
|
267 |
-
return false;
|
268 |
-
}
|
269 |
-
return ($int) ? (int)$value : $value;
|
270 |
-
}
|
271 |
-
return false;
|
272 |
-
}
|
273 |
-
|
274 |
}
|
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_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 |
+
$options = array();
|
93 |
+
$optionsAdvanced = array();
|
94 |
+
$storeId = Mage::app()->getStore()->getStoreId();
|
95 |
+
if ($this->isEnabled()) {
|
96 |
+
$notCheckout = !($config['excludecheckout'] & $this->isInOrder());
|
97 |
+
$this->_getGeneralOptions($config, $options, $optionsAdvanced, $notCheckout);
|
98 |
+
|
99 |
+
// formatting symbols from admin, preparing to use. Maybe can do better :)
|
100 |
+
// если в админке будут внесены
|
101 |
+
// несколько значений для одной валюты,
|
102 |
+
// то использоваться будет только одна
|
103 |
+
if (isset($config['symbolreplace'])) {
|
104 |
+
$this->_collectCurrencyOptions($config, $currency, $notCheckout, $options, $optionsAdvanced);
|
105 |
+
}
|
106 |
+
} // end NOT ENABLED
|
107 |
+
|
108 |
+
$this->_options[$storeId][$currency] = $options;
|
109 |
+
$this->_optionsadvanced[$storeId][$currency] = $optionsAdvanced;
|
110 |
+
if (!isset($this->_options[$storeId]["default"])) {
|
111 |
+
$this->_options[$storeId]["default"] = $options;
|
112 |
+
$this->_optionsadvanced[$storeId]["default"] = $optionsAdvanced;
|
113 |
+
}
|
114 |
+
|
115 |
+
return $this;
|
116 |
+
}
|
117 |
+
|
118 |
+
protected function _getGeneralOptions($config, &$options, &$optionsAdvanced, $notCheckout)
|
119 |
+
{
|
120 |
+
if ($notCheckout) {
|
121 |
+
if (isset($config['precision'])) { // precision must be in range -1 .. 30
|
122 |
+
$options['precision'] = min(30, max(-1, (int)$config['precision']));
|
123 |
+
}
|
124 |
+
|
125 |
+
if (isset($config['zerotext'])) {
|
126 |
+
$optionsAdvanced['zerotext'] = $config['zerotext'];
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
if (isset($config['position'])) {
|
131 |
+
$options['position'] = (int)$config['position'];
|
132 |
+
}
|
133 |
+
if (isset($config['display'])) {
|
134 |
+
$options['display'] = (int)$config['display'];
|
135 |
+
}
|
136 |
+
|
137 |
+
|
138 |
+
if (isset($config['input_admin'])) {
|
139 |
+
if ($config['input_admin'] > 0) {
|
140 |
+
$optionsAdvanced['input_admin'] = (int)$config['input_admin'];
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
$optionsAdvanced['excludecheckout'] = $config['excludecheckout'];
|
145 |
+
$optionsAdvanced['cutzerodecimal'] = $config['cutzerodecimal'];
|
146 |
+
$optionsAdvanced['cutzerodecimal_suffix'] = isset($config['cutzerodecimal_suffix']) ?
|
147 |
+
$config['cutzerodecimal_suffix'] : "";
|
148 |
+
$optionsAdvanced['min_decimal_count'] = isset($config['min_decimal_count']) ?
|
149 |
+
$config['min_decimal_count'] : "2";
|
150 |
+
}
|
151 |
+
|
152 |
+
protected function _collectCurrencyOptions($config, $currency, $notCheckout, &$options, &$optionsAdvanced)
|
153 |
+
{
|
154 |
+
$symbolReplace = $this->_unsetSymbolReplace($config);
|
155 |
+
|
156 |
+
if (count($symbolReplace['currency']) > 0) {
|
157 |
+
$tmpOptions = array();
|
158 |
+
$tmpOptionsAdvanced = array();
|
159 |
+
|
160 |
+
$tmpOptionsAdvanced['cutzerodecimal'] = $this->_getCurrencyOption(
|
161 |
+
$currency, $symbolReplace, 'cutzerodecimal', true
|
162 |
+
);
|
163 |
+
|
164 |
+
if (isset($symbolReplace['cutzerodecimal_suffix'])) {
|
165 |
+
$tmpOptionsAdvanced["cutzerodecimal_suffix"] = $this->_getCurrencyOption(
|
166 |
+
$currency, $symbolReplace, 'cutzerodecimal_suffix'
|
167 |
+
);
|
168 |
+
}
|
169 |
+
|
170 |
+
if (isset($symbolReplace['min_decimal_count'])) {
|
171 |
+
$tmpOptionsAdvanced["min_decimal_count"] = $this->_getCurrencyOption(
|
172 |
+
$currency, $symbolReplace, 'min_decimal_count'
|
173 |
+
);
|
174 |
+
}
|
175 |
+
|
176 |
+
|
177 |
+
$tmpOptions['position'] = $this->_getCurrencyOption($currency, $symbolReplace, 'position', true);
|
178 |
+
$tmpOptions['display'] = $this->_getCurrencyOption($currency, $symbolReplace, 'display', true);
|
179 |
+
$tmpOptions['symbol'] = $this->_getCurrencyOption($currency, $symbolReplace, 'symbol');
|
180 |
+
|
181 |
+
if ($notCheckout) {
|
182 |
+
$tmpOptionsAdvanced['zerotext'] = $this->_getCurrencyOption($currency, $symbolReplace, 'zerotext');
|
183 |
+
|
184 |
+
$precision = $this->_getCurrencyOption($currency, $symbolReplace, 'precision', true);
|
185 |
+
if ($precision !== false) {
|
186 |
+
$tmpOptions['precision'] = min(30, max(-1, $precision));
|
187 |
+
}
|
188 |
+
}
|
189 |
+
|
190 |
+
foreach ($tmpOptions as $option => $value) {
|
191 |
+
if ($value !== false) {
|
192 |
+
$options[$option] = $value;
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
foreach ($tmpOptionsAdvanced as $option => $value) {
|
197 |
+
if ($value !== false) {
|
198 |
+
$optionsAdvanced[$option] = $value;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* To check where price is used
|
207 |
+
* in some cases default values for precision and zerotext should be used
|
208 |
+
* for sales/checkout in frontend
|
209 |
+
* for admin AND sales_order*
|
210 |
+
*
|
211 |
+
* @return bool
|
212 |
+
*/
|
213 |
+
public function isInOrder()
|
214 |
+
{
|
215 |
+
$moduleName = Mage::app()->getRequest()->getModuleName();
|
216 |
+
$controllerName = Mage::app()->getRequest()->getControllerName();
|
217 |
+
|
218 |
+
$orderModules = array('sales', 'checkout', 'paypal');
|
219 |
+
$modifiedOrderModules = array(
|
220 |
+
'order_modules' => new Varien_Object(array('module_names'=>$orderModules)),
|
221 |
+
);
|
222 |
+
|
223 |
+
Mage::dispatchEvent('et_currencymanager_checking_is_in_order_before', $modifiedOrderModules);
|
224 |
+
|
225 |
+
$orderModules = $modifiedOrderModules['order_modules']->getData('module_names');
|
226 |
+
|
227 |
+
return ((in_array($moduleName, $orderModules))
|
228 |
+
|| (
|
229 |
+
($moduleName == 'admin') && (strpos($controllerName, 'sales_order') !== false)
|
230 |
+
));
|
231 |
+
}
|
232 |
+
|
233 |
+
protected function _unsetSymbolReplace($config)
|
234 |
+
{
|
235 |
+
if (!is_array($config['symbolreplace'])) {
|
236 |
+
$symbolReplace = unserialize($config['symbolreplace']);
|
237 |
+
foreach (array_keys($symbolReplace['currency']) as $symbolReplaceKey) {
|
238 |
+
if (strlen(trim($symbolReplace['currency'][$symbolReplaceKey])) == 0) {
|
239 |
+
unset($symbolReplace['currency'][$symbolReplaceKey]);
|
240 |
+
unset($symbolReplace['precision'][$symbolReplaceKey]);
|
241 |
+
unset($symbolReplace['min_decimal_count'][$symbolReplaceKey]);
|
242 |
+
unset($symbolReplace['cutzerodecimal'][$symbolReplaceKey]);
|
243 |
+
unset($symbolReplace['cutzerodecimal_suffix'][$symbolReplaceKey]);
|
244 |
+
unset($symbolReplace['position'][$symbolReplaceKey]);
|
245 |
+
unset($symbolReplace['display'][$symbolReplaceKey]);
|
246 |
+
unset($symbolReplace['symbol'][$symbolReplaceKey]);
|
247 |
+
unset($symbolReplace['zerotext'][$symbolReplaceKey]);
|
248 |
+
}
|
249 |
+
}
|
250 |
+
return $symbolReplace;
|
251 |
+
}
|
252 |
+
return false;
|
253 |
+
}
|
254 |
+
|
255 |
+
public function resetOptions()
|
256 |
+
{
|
257 |
+
$this->_options = array();
|
258 |
+
$this->_optionsadvanced = array();
|
259 |
+
}
|
260 |
+
|
261 |
+
protected function _getCurrencyOption($currency, $symbolReplace, $option, $int = false)
|
262 |
+
{
|
263 |
+
$configSubData = array_combine($symbolReplace['currency'], $symbolReplace[$option]);
|
264 |
+
if (array_key_exists($currency, $configSubData)) {
|
265 |
+
$value = $configSubData[$currency];
|
266 |
+
if ($value === "") {
|
267 |
+
return false;
|
268 |
+
}
|
269 |
+
return ($int) ? (int)$value : $value;
|
270 |
+
}
|
271 |
+
return false;
|
272 |
+
}
|
273 |
+
|
274 |
}
|
app/code/community/ET/CurrencyManager/Helper/Tax1810.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* NOTICE OF LICENSE
|
4 |
*
|
@@ -16,7 +17,6 @@
|
|
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_Tax1810 extends Mage_Tax_Helper_Data
|
21 |
{
|
22 |
|
@@ -34,8 +34,8 @@ class ET_CurrencyManager_Helper_Tax1810 extends Mage_Tax_Helper_Data
|
|
34 |
* @return float
|
35 |
*/
|
36 |
public function getPrice($product, $price, $includingTax = null, $shippingAddress = null, $billingAddress = null,
|
37 |
-
|
38 |
-
{
|
39 |
if (!$price) {
|
40 |
return $price;
|
41 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* NOTICE OF LICENSE
|
5 |
*
|
17 |
* @contacts support@etwebsolutions.com
|
18 |
* @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
|
19 |
*/
|
|
|
20 |
class ET_CurrencyManager_Helper_Tax1810 extends Mage_Tax_Helper_Data
|
21 |
{
|
22 |
|
34 |
* @return float
|
35 |
*/
|
36 |
public function getPrice($product, $price, $includingTax = null, $shippingAddress = null, $billingAddress = null,
|
37 |
+
$ctc = null, $store = null, $priceIncludesTax = null, $roundPrice = true
|
38 |
+
) {
|
39 |
if (!$price) {
|
40 |
return $price;
|
41 |
}
|
app/code/community/ET/CurrencyManager/etc/config.xml
CHANGED
@@ -1,212 +1,212 @@
|
|
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.2.
|
26 |
-
<descr>
|
27 |
-
<ru_RU><![CDATA[Модуль позволяет владельцу магазина просто и удобно управлять отображением цены: указывать свой символ валюты, количество знаков после запятой, позицию символа и др.]]>
|
28 |
-
</ru_RU>
|
29 |
-
<en_US><![CDATA[Currency Manager lets shop owner manage price display in an easy and convenient way: show custom currency symbol, change its position, change number of decimals and etc.]]>
|
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 |
-
<!--tax>
|
58 |
-
<rewrite>
|
59 |
-
<data>ET_CurrencyManager_Helper_Tax</data>
|
60 |
-
</rewrite>
|
61 |
-
</tax-->
|
62 |
-
|
63 |
-
</helpers>
|
64 |
-
<models>
|
65 |
-
<directory>
|
66 |
-
<rewrite>
|
67 |
-
<currency>ET_CurrencyManager_Model_Currency</currency>
|
68 |
-
</rewrite>
|
69 |
-
</directory>
|
70 |
-
|
71 |
-
<core>
|
72 |
-
<rewrite>
|
73 |
-
<locale>ET_CurrencyManager_Model_Locale</locale>
|
74 |
-
<store>ET_CurrencyManager_Model_Store</store>
|
75 |
-
</rewrite>
|
76 |
-
</core>
|
77 |
-
|
78 |
-
<currencymanager>
|
79 |
-
<class>ET_CurrencyManager_Model</class>
|
80 |
-
</currencymanager>
|
81 |
-
</models>
|
82 |
-
<blocks>
|
83 |
-
<currencymanager>
|
84 |
-
<class>ET_CurrencyManager_Block</class>
|
85 |
-
</currencymanager>
|
86 |
-
<adminhtml>
|
87 |
-
<rewrite>
|
88 |
-
<catalog_product_helper_form_price>ET_CurrencyManager_Block_Adminhtml_Formprice</catalog_product_helper_form_price>
|
89 |
-
</rewrite>
|
90 |
-
<rewrite>
|
91 |
-
<catalog_product_edit_tab_options_option>ET_CurrencyManager_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Option</catalog_product_edit_tab_options_option>
|
92 |
-
</rewrite>
|
93 |
-
</adminhtml>
|
94 |
-
</blocks>
|
95 |
-
<resources>
|
96 |
-
<currencymanager_setup>
|
97 |
-
<setup>
|
98 |
-
<module>ET_CurrencyManager</module>
|
99 |
-
</setup>
|
100 |
-
<connection>
|
101 |
-
<use>core_setup</use>
|
102 |
-
</connection>
|
103 |
-
</currencymanager_setup>
|
104 |
-
<currencymanager_write>
|
105 |
-
<connection>
|
106 |
-
<use>core_write</use>
|
107 |
-
</connection>
|
108 |
-
</currencymanager_write>
|
109 |
-
<currencymanager_read>
|
110 |
-
<connection>
|
111 |
-
<use>core_read</use>
|
112 |
-
</connection>
|
113 |
-
</currencymanager_read>
|
114 |
-
</resources>
|
115 |
-
<events>
|
116 |
-
<controller_front_init_before>
|
117 |
-
<observers>
|
118 |
-
<fix_currency_switch_url>
|
119 |
-
<type>model</type>
|
120 |
-
<class>currencymanager/observer</class>
|
121 |
-
<method>fixCurrencySwitchUrl</method>
|
122 |
-
</fix_currency_switch_url>
|
123 |
-
<rewrire_classes_depending_on_version>
|
124 |
-
<type>model</type>
|
125 |
-
<class>currencymanager/observer</class>
|
126 |
-
<method>rewriteClasses</method>
|
127 |
-
</rewrire_classes_depending_on_version>
|
128 |
-
</observers>
|
129 |
-
</controller_front_init_before>
|
130 |
-
</events>
|
131 |
-
</global>
|
132 |
-
|
133 |
-
<default>
|
134 |
-
<currencymanager>
|
135 |
-
<general>
|
136 |
-
<enabled>1</enabled>
|
137 |
-
<excludecheckout>1</excludecheckout>
|
138 |
-
<enabledadm>0</enabledadm>
|
139 |
-
<input_admin>0</input_admin>
|
140 |
-
<cutzerodecimal>0</cutzerodecimal>
|
141 |
-
<cutzerodecimal_suffix>,-</cutzerodecimal_suffix>
|
142 |
-
<precision>0</precision>
|
143 |
-
<position>8</position>
|
144 |
-
<display>2</display>
|
145 |
-
<min_decimal_count>2</min_decimal_count>
|
146 |
-
</general>
|
147 |
-
<additional>
|
148 |
-
<fix_currency_switch_url>0</fix_currency_switch_url>
|
149 |
-
<rewrite_classes>1</rewrite_classes>
|
150 |
-
</additional>
|
151 |
-
</currencymanager>
|
152 |
-
</default>
|
153 |
-
|
154 |
-
|
155 |
-
<frontend>
|
156 |
-
<layout>
|
157 |
-
<updates>
|
158 |
-
<currencymanager>
|
159 |
-
<file>et_currencymanager.xml</file>
|
160 |
-
</currencymanager>
|
161 |
-
</updates>
|
162 |
-
</layout>
|
163 |
-
<routers>
|
164 |
-
<currencymanager>
|
165 |
-
<use>standard</use>
|
166 |
-
<args>
|
167 |
-
<module>ET_CurrencyManager</module>
|
168 |
-
<frontName>currencymanager</frontName>
|
169 |
-
</args>
|
170 |
-
</currencymanager>
|
171 |
-
</routers>
|
172 |
-
</frontend>
|
173 |
-
|
174 |
-
<adminhtml>
|
175 |
-
<acl>
|
176 |
-
<resources>
|
177 |
-
<admin>
|
178 |
-
<children>
|
179 |
-
<system>
|
180 |
-
<children>
|
181 |
-
<config>
|
182 |
-
<children>
|
183 |
-
<currencymanager translate="title" module="currencymanager">
|
184 |
-
<title>ET Currency Manager</title>
|
185 |
-
<sort_order>400</sort_order>
|
186 |
-
</currencymanager>
|
187 |
-
</children>
|
188 |
-
</config>
|
189 |
-
</children>
|
190 |
-
</system>
|
191 |
-
</children>
|
192 |
-
</admin>
|
193 |
-
</resources>
|
194 |
-
</acl>
|
195 |
-
<translate>
|
196 |
-
<modules>
|
197 |
-
<ET_CurrencyManager>
|
198 |
-
<files>
|
199 |
-
<default>ET_Currencymanager.csv</default>
|
200 |
-
</files>
|
201 |
-
</ET_CurrencyManager>
|
202 |
-
</modules>
|
203 |
-
</translate>
|
204 |
-
</adminhtml>
|
205 |
-
<phpunit>
|
206 |
-
<suite>
|
207 |
-
<modules>
|
208 |
-
<ET_CurrencyManager />
|
209 |
-
</modules>
|
210 |
-
</suite>
|
211 |
-
</phpunit>
|
212 |
-
</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.2.4</version>
|
26 |
+
<descr>
|
27 |
+
<ru_RU><![CDATA[Модуль позволяет владельцу магазина просто и удобно управлять отображением цены: указывать свой символ валюты, количество знаков после запятой, позицию символа и др.]]>
|
28 |
+
</ru_RU>
|
29 |
+
<en_US><![CDATA[Currency Manager lets shop owner manage price display in an easy and convenient way: show custom currency symbol, change its position, change number of decimals and etc.]]>
|
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 |
+
<!--tax>
|
58 |
+
<rewrite>
|
59 |
+
<data>ET_CurrencyManager_Helper_Tax</data>
|
60 |
+
</rewrite>
|
61 |
+
</tax-->
|
62 |
+
|
63 |
+
</helpers>
|
64 |
+
<models>
|
65 |
+
<directory>
|
66 |
+
<rewrite>
|
67 |
+
<currency>ET_CurrencyManager_Model_Currency</currency>
|
68 |
+
</rewrite>
|
69 |
+
</directory>
|
70 |
+
|
71 |
+
<core>
|
72 |
+
<rewrite>
|
73 |
+
<locale>ET_CurrencyManager_Model_Locale</locale>
|
74 |
+
<store>ET_CurrencyManager_Model_Store</store>
|
75 |
+
</rewrite>
|
76 |
+
</core>
|
77 |
+
|
78 |
+
<currencymanager>
|
79 |
+
<class>ET_CurrencyManager_Model</class>
|
80 |
+
</currencymanager>
|
81 |
+
</models>
|
82 |
+
<blocks>
|
83 |
+
<currencymanager>
|
84 |
+
<class>ET_CurrencyManager_Block</class>
|
85 |
+
</currencymanager>
|
86 |
+
<adminhtml>
|
87 |
+
<rewrite>
|
88 |
+
<catalog_product_helper_form_price>ET_CurrencyManager_Block_Adminhtml_Formprice</catalog_product_helper_form_price>
|
89 |
+
</rewrite>
|
90 |
+
<rewrite>
|
91 |
+
<catalog_product_edit_tab_options_option>ET_CurrencyManager_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Option</catalog_product_edit_tab_options_option>
|
92 |
+
</rewrite>
|
93 |
+
</adminhtml>
|
94 |
+
</blocks>
|
95 |
+
<resources>
|
96 |
+
<currencymanager_setup>
|
97 |
+
<setup>
|
98 |
+
<module>ET_CurrencyManager</module>
|
99 |
+
</setup>
|
100 |
+
<connection>
|
101 |
+
<use>core_setup</use>
|
102 |
+
</connection>
|
103 |
+
</currencymanager_setup>
|
104 |
+
<currencymanager_write>
|
105 |
+
<connection>
|
106 |
+
<use>core_write</use>
|
107 |
+
</connection>
|
108 |
+
</currencymanager_write>
|
109 |
+
<currencymanager_read>
|
110 |
+
<connection>
|
111 |
+
<use>core_read</use>
|
112 |
+
</connection>
|
113 |
+
</currencymanager_read>
|
114 |
+
</resources>
|
115 |
+
<events>
|
116 |
+
<controller_front_init_before>
|
117 |
+
<observers>
|
118 |
+
<fix_currency_switch_url>
|
119 |
+
<type>model</type>
|
120 |
+
<class>currencymanager/observer</class>
|
121 |
+
<method>fixCurrencySwitchUrl</method>
|
122 |
+
</fix_currency_switch_url>
|
123 |
+
<rewrire_classes_depending_on_version>
|
124 |
+
<type>model</type>
|
125 |
+
<class>currencymanager/observer</class>
|
126 |
+
<method>rewriteClasses</method>
|
127 |
+
</rewrire_classes_depending_on_version>
|
128 |
+
</observers>
|
129 |
+
</controller_front_init_before>
|
130 |
+
</events>
|
131 |
+
</global>
|
132 |
+
|
133 |
+
<default>
|
134 |
+
<currencymanager>
|
135 |
+
<general>
|
136 |
+
<enabled>1</enabled>
|
137 |
+
<excludecheckout>1</excludecheckout>
|
138 |
+
<enabledadm>0</enabledadm>
|
139 |
+
<input_admin>0</input_admin>
|
140 |
+
<cutzerodecimal>0</cutzerodecimal>
|
141 |
+
<cutzerodecimal_suffix>,-</cutzerodecimal_suffix>
|
142 |
+
<precision>0</precision>
|
143 |
+
<position>8</position>
|
144 |
+
<display>2</display>
|
145 |
+
<min_decimal_count>2</min_decimal_count>
|
146 |
+
</general>
|
147 |
+
<additional>
|
148 |
+
<fix_currency_switch_url>0</fix_currency_switch_url>
|
149 |
+
<rewrite_classes>1</rewrite_classes>
|
150 |
+
</additional>
|
151 |
+
</currencymanager>
|
152 |
+
</default>
|
153 |
+
|
154 |
+
|
155 |
+
<frontend>
|
156 |
+
<layout>
|
157 |
+
<updates>
|
158 |
+
<currencymanager>
|
159 |
+
<file>et_currencymanager.xml</file>
|
160 |
+
</currencymanager>
|
161 |
+
</updates>
|
162 |
+
</layout>
|
163 |
+
<routers>
|
164 |
+
<currencymanager>
|
165 |
+
<use>standard</use>
|
166 |
+
<args>
|
167 |
+
<module>ET_CurrencyManager</module>
|
168 |
+
<frontName>currencymanager</frontName>
|
169 |
+
</args>
|
170 |
+
</currencymanager>
|
171 |
+
</routers>
|
172 |
+
</frontend>
|
173 |
+
|
174 |
+
<adminhtml>
|
175 |
+
<acl>
|
176 |
+
<resources>
|
177 |
+
<admin>
|
178 |
+
<children>
|
179 |
+
<system>
|
180 |
+
<children>
|
181 |
+
<config>
|
182 |
+
<children>
|
183 |
+
<currencymanager translate="title" module="currencymanager">
|
184 |
+
<title>ET Currency Manager</title>
|
185 |
+
<sort_order>400</sort_order>
|
186 |
+
</currencymanager>
|
187 |
+
</children>
|
188 |
+
</config>
|
189 |
+
</children>
|
190 |
+
</system>
|
191 |
+
</children>
|
192 |
+
</admin>
|
193 |
+
</resources>
|
194 |
+
</acl>
|
195 |
+
<translate>
|
196 |
+
<modules>
|
197 |
+
<ET_CurrencyManager>
|
198 |
+
<files>
|
199 |
+
<default>ET_Currencymanager.csv</default>
|
200 |
+
</files>
|
201 |
+
</ET_CurrencyManager>
|
202 |
+
</modules>
|
203 |
+
</translate>
|
204 |
+
</adminhtml>
|
205 |
+
<phpunit>
|
206 |
+
<suite>
|
207 |
+
<modules>
|
208 |
+
<ET_CurrencyManager />
|
209 |
+
</modules>
|
210 |
+
</suite>
|
211 |
+
</phpunit>
|
212 |
+
</config>
|
app/code/community/ET/CurrencyManager/etc/system.xml
CHANGED
@@ -165,7 +165,7 @@
|
|
165 |
<cutzerodecimal translate="label comment">
|
166 |
<label>Cut Zero Decimals</label>
|
167 |
<comment>If Yes price will be 99 instead of 99.00, but 99.99 if price 99.99</comment>
|
168 |
-
<comment><![CDATA[
|
169 |
<frontend_type>select</frontend_type>
|
170 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
171 |
<sort_order>320</sort_order>
|
165 |
<cutzerodecimal translate="label comment">
|
166 |
<label>Cut Zero Decimals</label>
|
167 |
<comment>If Yes price will be 99 instead of 99.00, but 99.99 if price 99.99</comment>
|
168 |
+
<comment><![CDATA[Unlike Display Precision, this setting discards only zeroes.<br>Example:<br>99.99 => 99.99<br>99.00 => 99]]></comment>
|
169 |
<frontend_type>select</frontend_type>
|
170 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
171 |
<sort_order>320</sort_order>
|
app/locale/ru_RU/ET_Currencymanager.csv
CHANGED
@@ -55,7 +55,6 @@
|
|
55 |
"Minimum number of digits after the decimal point:","Минимальное кол-во знаков после запятой:"
|
56 |
"Discard zeroes, leaving specified number of them. Cannot be greater than Display Precision setting. Default: 2. Available values: 1, 2, 3, 4.<br>Examples:<br>for value = 0<br> 9.0000 => 9<br> 9.9999 => 9.9999<br> 9.9000 => 9.9<br><br> for value = 2<br> 9.0000 => 9.00<br> 9.9999 => 9.9999<br> 9.9000 => 9.90","Отбросить нули, оставив указанное количество. Не может быть больше параметра Точность отображения. По умолчанию: 2. Доступные значения: 1, 2, 3, 4.<br>Примеры:<br>при значении = 0<br> 9.0000 => 9<br> 9.9999 => 9.9999<br> 9.9000 => 9.9<br><br> при значении = 2<br> 9.0000 => 9.00<br> 9.9999 => 9.9999<br> 9.9000 => 9.90"
|
57 |
"Unlike Display Precision, this setting discards only zeroes.<br>Example:<br>99.99 => 99.99<br>99.00 => 99","В отличии от Точности отображения данная настройка отбрасывает не все символы после запятой, а только нули.<br>Пример:<br>99.99 => 99.99<br>99.00 => 99"
|
58 |
-
|
59 |
"Extension:","Модуль:"
|
60 |
"<strong>%s</strong> (version %s)","<strong>%s</strong> (версия %s)"
|
61 |
"License:","Лицензия:"
|
55 |
"Minimum number of digits after the decimal point:","Минимальное кол-во знаков после запятой:"
|
56 |
"Discard zeroes, leaving specified number of them. Cannot be greater than Display Precision setting. Default: 2. Available values: 1, 2, 3, 4.<br>Examples:<br>for value = 0<br> 9.0000 => 9<br> 9.9999 => 9.9999<br> 9.9000 => 9.9<br><br> for value = 2<br> 9.0000 => 9.00<br> 9.9999 => 9.9999<br> 9.9000 => 9.90","Отбросить нули, оставив указанное количество. Не может быть больше параметра Точность отображения. По умолчанию: 2. Доступные значения: 1, 2, 3, 4.<br>Примеры:<br>при значении = 0<br> 9.0000 => 9<br> 9.9999 => 9.9999<br> 9.9000 => 9.9<br><br> при значении = 2<br> 9.0000 => 9.00<br> 9.9999 => 9.9999<br> 9.9000 => 9.90"
|
57 |
"Unlike Display Precision, this setting discards only zeroes.<br>Example:<br>99.99 => 99.99<br>99.00 => 99","В отличии от Точности отображения данная настройка отбрасывает не все символы после запятой, а только нули.<br>Пример:<br>99.99 => 99.99<br>99.00 => 99"
|
|
|
58 |
"Extension:","Модуль:"
|
59 |
"<strong>%s</strong> (version %s)","<strong>%s</strong> (версия %s)"
|
60 |
"License:","Лицензия:"
|
js/et/currencymanager/et_currencymanager_round.js
CHANGED
@@ -1,243 +1,243 @@
|
|
1 |
-
//flag - we already updated Product.Config
|
2 |
-
var extendProductConfigformatPriceTrigged = false;
|
3 |
-
//calling this function will update Product.Config to our formatPrice
|
4 |
-
|
5 |
-
function extendProductConfigformatPrice() {
|
6 |
-
if (typeof(Product) != "undefined") {
|
7 |
-
if (!extendProductConfigformatPriceTrigged) {
|
8 |
-
extendProductConfigformatPriceTrigged = true;
|
9 |
-
|
10 |
-
Product.Config.prototype = Object.extend(Product.Config.prototype, {
|
11 |
-
formatPrice:function (price, showSign) {
|
12 |
-
var str = '';
|
13 |
-
price = parseFloat(price);
|
14 |
-
if (showSign) {
|
15 |
-
if (price < 0) {
|
16 |
-
str += '-';
|
17 |
-
price = -price;
|
18 |
-
}
|
19 |
-
else {
|
20 |
-
str += '+';
|
21 |
-
}
|
22 |
-
}
|
23 |
-
|
24 |
-
var roundedPrice = (Math.round(price * 100) / 100).toString();
|
25 |
-
|
26 |
-
if (this.prices && this.prices[roundedPrice]) {
|
27 |
-
str += this.prices[roundedPrice];
|
28 |
-
} else {
|
29 |
-
precision = 2;
|
30 |
-
if (typeof(etCurrencyManagerJsConfig) != "undefined") {
|
31 |
-
if (typeof(etCurrencyManagerJsConfig.precision) != "undefined") {
|
32 |
-
precision = etCurrencyManagerJsConfig.precision;
|
33 |
-
}
|
34 |
-
}
|
35 |
-
if (typeof(optionsPrice) != "undefined") {
|
36 |
-
if (typeof(optionsPrice.priceFormat) != "undefined") {
|
37 |
-
precision = optionsPrice.priceFormat.requiredPrecision;
|
38 |
-
}
|
39 |
-
}
|
40 |
-
if (typeof(etCurrencyManagerJsConfig) != "undefined") {
|
41 |
-
if (typeof(etCurrencyManagerJsConfig.cutzerodecimal) != "undefined") {
|
42 |
-
if (etCurrencyManagerJsConfig.cutzerodecimal != 0) {
|
43 |
-
if (price - Math.round(price) == 0) {
|
44 |
-
precision = 0;
|
45 |
-
}
|
46 |
-
}
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
if (typeof(etCurrencyManagerJsConfig) != "undefined") {
|
51 |
-
if (typeof(etCurrencyManagerJsConfig.min_decimal_count) != "undefined") {
|
52 |
-
if (etCurrencyManagerJsConfig.min_decimal_count < precision) {
|
53 |
-
for (var testPrecision = etCurrencyManagerJsConfig.min_decimal_count;
|
54 |
-
testPrecision < precision; testPrecision++) {
|
55 |
-
//abs for 0.00199999999 or 1.1000000000001 fix
|
56 |
-
if (Math.abs(Math.round(price * Math.pow(10, testPrecision))
|
57 |
-
- price * Math.pow(10, testPrecision))<0.0000001) {
|
58 |
-
precision = testPrecision;
|
59 |
-
break;
|
60 |
-
}
|
61 |
-
}
|
62 |
-
}
|
63 |
-
}
|
64 |
-
}
|
65 |
-
|
66 |
-
|
67 |
-
if (precision > 0) {
|
68 |
-
str += this.priceTemplate.evaluate({price:price.toFixed(precision)});
|
69 |
-
}
|
70 |
-
else {
|
71 |
-
price = price.toFixed(0);
|
72 |
-
if (typeof(etCurrencyManagerJsConfig) != "undefined") {
|
73 |
-
if (typeof(etCurrencyManagerJsConfig.cutzerodecimal) != "undefined") {
|
74 |
-
if (etCurrencyManagerJsConfig.cutzerodecimal != 0) {
|
75 |
-
if (typeof(etCurrencyManagerJsConfig.cutzerodecimal_suffix) != "undefined") {
|
76 |
-
if (etCurrencyManagerJsConfig.cutzerodecimal_suffix.length > 0) {
|
77 |
-
price = price + "" + etCurrencyManagerJsConfig.cutzerodecimal_suffix;
|
78 |
-
}
|
79 |
-
}
|
80 |
-
}
|
81 |
-
}
|
82 |
-
}
|
83 |
-
str += this.priceTemplate.evaluate({price:price});
|
84 |
-
}
|
85 |
-
}
|
86 |
-
return str;
|
87 |
-
}
|
88 |
-
});
|
89 |
-
|
90 |
-
if (etCurrencyManagerJsConfig.cutzerodecimal > 0) {
|
91 |
-
Product.OptionsPrice.prototype = Object.extend(Product.OptionsPrice.prototype, {formatPrice:function (price) {
|
92 |
-
var tmpPriceFormat = Object.clone(this.priceFormat);
|
93 |
-
if (price - parseInt(price) == 0) {
|
94 |
-
tmpPriceFormat.precision = 0;
|
95 |
-
tmpPriceFormat.requiredPrecision = 0;
|
96 |
-
}
|
97 |
-
if (tmpPriceFormat.precision < 0) {
|
98 |
-
tmpPriceFormat.precision = 0;
|
99 |
-
}
|
100 |
-
if (tmpPriceFormat.requiredPrecision < 0) {
|
101 |
-
tmpPriceFormat.requiredPrecision = 0;
|
102 |
-
}
|
103 |
-
var price2return = formatCurrency(price, tmpPriceFormat);
|
104 |
-
return price2return;
|
105 |
-
}});
|
106 |
-
}
|
107 |
-
}
|
108 |
-
}
|
109 |
-
}
|
110 |
-
|
111 |
-
extendProductConfigformatPrice();
|
112 |
-
|
113 |
-
try {
|
114 |
-
|
115 |
-
originalFormatCurrency = window.formatCurrency;
|
116 |
-
|
117 |
-
window.formatCurrency = function (price, originalFormat, showPlus) {
|
118 |
-
var format = Object.clone(originalFormat);
|
119 |
-
|
120 |
-
//zeroSymbol
|
121 |
-
//JS round fix
|
122 |
-
price = Math.round(price * Math.pow(10, format.precision)) / Math.pow(10, format.precision);
|
123 |
-
if (price - Math.round(price) != 0) {
|
124 |
-
if (Math.abs(price - Math.round(price)) < 0.00000001) {
|
125 |
-
price = 0;
|
126 |
-
}
|
127 |
-
}
|
128 |
-
if (typeof(etCurrencyManagerJsConfig) != "undefined") {
|
129 |
-
if (price == 0) {
|
130 |
-
if (typeof(etCurrencyManagerJsConfig.zerotext) != "undefined") {
|
131 |
-
return etCurrencyManagerJsConfig.zerotext;
|
132 |
-
}
|
133 |
-
}
|
134 |
-
}
|
135 |
-
//cut zero decimal
|
136 |
-
if (price - Math.round(price) == 0) {
|
137 |
-
if (typeof(etCurrencyManagerJsConfig) != "undefined") {
|
138 |
-
if (typeof(etCurrencyManagerJsConfig.cutzerodecimal) != "undefined") {
|
139 |
-
if (etCurrencyManagerJsConfig.cutzerodecimal != 0) {
|
140 |
-
format.precision = 0;
|
141 |
-
format.requiredPrecision = 0;
|
142 |
-
|
143 |
-
var for_replace = originalFormatCurrency(price, format, showPlus);
|
144 |
-
format.pattern = "%s";
|
145 |
-
var replaced_part = originalFormatCurrency(price, format, showPlus);
|
146 |
-
format.pattern = originalFormat.pattern;
|
147 |
-
if (typeof(etCurrencyManagerJsConfig.cutzerodecimal_suffix) != "undefined") {
|
148 |
-
if (etCurrencyManagerJsConfig.cutzerodecimal_suffix.length > 0) {
|
149 |
-
return for_replace.replace(replaced_part, replaced_part + ""
|
150 |
-
+ etCurrencyManagerJsConfig.cutzerodecimal_suffix);
|
151 |
-
}
|
152 |
-
}
|
153 |
-
}
|
154 |
-
}
|
155 |
-
}
|
156 |
-
}
|
157 |
-
|
158 |
-
if (typeof(etCurrencyManagerJsConfig) != "undefined") {
|
159 |
-
if (typeof(etCurrencyManagerJsConfig.min_decimal_count) != "undefined") {
|
160 |
-
if (etCurrencyManagerJsConfig.min_decimal_count < format.precision) {
|
161 |
-
for (var testPrecision = etCurrencyManagerJsConfig.min_decimal_count;
|
162 |
-
testPrecision < format.precision; testPrecision++) {
|
163 |
-
//abs for 0.00199999999 or 1.1000000000001 fix
|
164 |
-
if (Math.abs(Math.round(price * Math.pow(10, testPrecision))
|
165 |
-
- price * Math.pow(10, testPrecision))<0.0000001) {
|
166 |
-
format.precision = testPrecision;
|
167 |
-
format.requiredPrecision = testPrecision;
|
168 |
-
break;
|
169 |
-
}
|
170 |
-
}
|
171 |
-
}
|
172 |
-
}
|
173 |
-
}
|
174 |
-
|
175 |
-
|
176 |
-
return formatCurrencyET(price, format, showPlus);
|
177 |
-
//if(format.precision<0)format.precision=0;
|
178 |
-
//if(format.requiredPrecision<0)format.requiredPrecision=0;
|
179 |
-
/*return originalFormatCurrency(price, format, showPlus);*/
|
180 |
-
|
181 |
-
|
182 |
-
};
|
183 |
-
|
184 |
-
|
185 |
-
function formatCurrencyET(price, format, showPlus) {
|
186 |
-
var precision = isNaN(format.precision = (format.precision)) ? 2 : format.precision;
|
187 |
-
var requiredPrecision = isNaN(format.requiredPrecision = (format.requiredPrecision)) ? 2 : format.requiredPrecision;
|
188 |
-
|
189 |
-
//precision = (precision > requiredPrecision) ? precision : requiredPrecision;
|
190 |
-
//for now we don't need this difference so precision is requiredPrecision
|
191 |
-
precision = requiredPrecision;
|
192 |
-
|
193 |
-
var integerRequired = isNaN(format.integerRequired = Math.abs(format.integerRequired)) ? 1 : format.integerRequired;
|
194 |
-
|
195 |
-
var decimalSymbol = format.decimalSymbol == undefined ? "," : format.decimalSymbol;
|
196 |
-
var groupSymbol = format.groupSymbol == undefined ? "." : format.groupSymbol;
|
197 |
-
var groupLength = format.groupLength == undefined ? 3 : format.groupLength;
|
198 |
-
|
199 |
-
var s = '';
|
200 |
-
|
201 |
-
if (showPlus == undefined || showPlus == true) {
|
202 |
-
s = price < 0 ? "-" : ( showPlus ? "+" : "");
|
203 |
-
} else if (showPlus == false) {
|
204 |
-
s = '';
|
205 |
-
}
|
206 |
-
|
207 |
-
var i = parseInt(price = Math.abs(+price || 0).toFixed(precision)) + "";
|
208 |
-
var pad = (i.length < integerRequired) ? (integerRequired - i.length) : 0;
|
209 |
-
while (pad) {
|
210 |
-
i = '0' + i;
|
211 |
-
pad--;
|
212 |
-
}
|
213 |
-
j = (j = i.length) > groupLength ? j % groupLength : 0;
|
214 |
-
re = new RegExp("(\\d{" + groupLength + "})(?=\\d)", "g");
|
215 |
-
|
216 |
-
/**
|
217 |
-
* replace(/-/, 0) is only for fixing Safari bug which appears
|
218 |
-
* when Math.abs(0).toFixed() executed on "0" number.
|
219 |
-
* Result is "0.-0" :(
|
220 |
-
*/
|
221 |
-
if (precision < 0) {
|
222 |
-
precision = 0;
|
223 |
-
}
|
224 |
-
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) : "")
|
225 |
-
var pattern = '';
|
226 |
-
if (format.pattern.indexOf('{sign}') == -1) {
|
227 |
-
pattern = s + format.pattern;
|
228 |
-
} else {
|
229 |
-
pattern = format.pattern.replace('{sign}', s);
|
230 |
-
}
|
231 |
-
|
232 |
-
return pattern.replace('%s', r).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
|
233 |
-
}
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
}
|
239 |
-
catch (e) {
|
240 |
-
//do nothing
|
241 |
-
}
|
242 |
-
|
243 |
-
|
1 |
+
//flag - we already updated Product.Config
|
2 |
+
var extendProductConfigformatPriceTrigged = false;
|
3 |
+
//calling this function will update Product.Config to our formatPrice
|
4 |
+
|
5 |
+
function extendProductConfigformatPrice() {
|
6 |
+
if (typeof(Product) != "undefined") {
|
7 |
+
if (!extendProductConfigformatPriceTrigged) {
|
8 |
+
extendProductConfigformatPriceTrigged = true;
|
9 |
+
|
10 |
+
Product.Config.prototype = Object.extend(Product.Config.prototype, {
|
11 |
+
formatPrice:function (price, showSign) {
|
12 |
+
var str = '';
|
13 |
+
price = parseFloat(price);
|
14 |
+
if (showSign) {
|
15 |
+
if (price < 0) {
|
16 |
+
str += '-';
|
17 |
+
price = -price;
|
18 |
+
}
|
19 |
+
else {
|
20 |
+
str += '+';
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
var roundedPrice = (Math.round(price * 100) / 100).toString();
|
25 |
+
|
26 |
+
if (this.prices && this.prices[roundedPrice]) {
|
27 |
+
str += this.prices[roundedPrice];
|
28 |
+
} else {
|
29 |
+
precision = 2;
|
30 |
+
if (typeof(etCurrencyManagerJsConfig) != "undefined") {
|
31 |
+
if (typeof(etCurrencyManagerJsConfig.precision) != "undefined") {
|
32 |
+
precision = etCurrencyManagerJsConfig.precision;
|
33 |
+
}
|
34 |
+
}
|
35 |
+
if (typeof(optionsPrice) != "undefined") {
|
36 |
+
if (typeof(optionsPrice.priceFormat) != "undefined") {
|
37 |
+
precision = optionsPrice.priceFormat.requiredPrecision;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
if (typeof(etCurrencyManagerJsConfig) != "undefined") {
|
41 |
+
if (typeof(etCurrencyManagerJsConfig.cutzerodecimal) != "undefined") {
|
42 |
+
if (etCurrencyManagerJsConfig.cutzerodecimal != 0) {
|
43 |
+
if (price - Math.round(price) == 0) {
|
44 |
+
precision = 0;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
if (typeof(etCurrencyManagerJsConfig) != "undefined") {
|
51 |
+
if (typeof(etCurrencyManagerJsConfig.min_decimal_count) != "undefined") {
|
52 |
+
if (etCurrencyManagerJsConfig.min_decimal_count < precision) {
|
53 |
+
for (var testPrecision = etCurrencyManagerJsConfig.min_decimal_count;
|
54 |
+
testPrecision < precision; testPrecision++) {
|
55 |
+
//abs for 0.00199999999 or 1.1000000000001 fix
|
56 |
+
if (Math.abs(Math.round(price * Math.pow(10, testPrecision))
|
57 |
+
- price * Math.pow(10, testPrecision))<0.0000001) {
|
58 |
+
precision = testPrecision;
|
59 |
+
break;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
+
if (precision > 0) {
|
68 |
+
str += this.priceTemplate.evaluate({price:price.toFixed(precision)});
|
69 |
+
}
|
70 |
+
else {
|
71 |
+
price = price.toFixed(0);
|
72 |
+
if (typeof(etCurrencyManagerJsConfig) != "undefined") {
|
73 |
+
if (typeof(etCurrencyManagerJsConfig.cutzerodecimal) != "undefined") {
|
74 |
+
if (etCurrencyManagerJsConfig.cutzerodecimal != 0) {
|
75 |
+
if (typeof(etCurrencyManagerJsConfig.cutzerodecimal_suffix) != "undefined") {
|
76 |
+
if (etCurrencyManagerJsConfig.cutzerodecimal_suffix.length > 0) {
|
77 |
+
price = price + "" + etCurrencyManagerJsConfig.cutzerodecimal_suffix;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
str += this.priceTemplate.evaluate({price:price});
|
84 |
+
}
|
85 |
+
}
|
86 |
+
return str;
|
87 |
+
}
|
88 |
+
});
|
89 |
+
|
90 |
+
if (etCurrencyManagerJsConfig.cutzerodecimal > 0) {
|
91 |
+
Product.OptionsPrice.prototype = Object.extend(Product.OptionsPrice.prototype, {formatPrice:function (price) {
|
92 |
+
var tmpPriceFormat = Object.clone(this.priceFormat);
|
93 |
+
if (price - parseInt(price) == 0) {
|
94 |
+
tmpPriceFormat.precision = 0;
|
95 |
+
tmpPriceFormat.requiredPrecision = 0;
|
96 |
+
}
|
97 |
+
if (tmpPriceFormat.precision < 0) {
|
98 |
+
tmpPriceFormat.precision = 0;
|
99 |
+
}
|
100 |
+
if (tmpPriceFormat.requiredPrecision < 0) {
|
101 |
+
tmpPriceFormat.requiredPrecision = 0;
|
102 |
+
}
|
103 |
+
var price2return = formatCurrency(price, tmpPriceFormat);
|
104 |
+
return price2return;
|
105 |
+
}});
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
extendProductConfigformatPrice();
|
112 |
+
|
113 |
+
try {
|
114 |
+
|
115 |
+
originalFormatCurrency = window.formatCurrency;
|
116 |
+
|
117 |
+
window.formatCurrency = function (price, originalFormat, showPlus) {
|
118 |
+
var format = Object.clone(originalFormat);
|
119 |
+
|
120 |
+
//zeroSymbol
|
121 |
+
//JS round fix
|
122 |
+
price = Math.round(price * Math.pow(10, format.precision)) / Math.pow(10, format.precision);
|
123 |
+
if (price - Math.round(price) != 0) {
|
124 |
+
if (Math.abs(price - Math.round(price)) < 0.00000001) {
|
125 |
+
price = 0;
|
126 |
+
}
|
127 |
+
}
|
128 |
+
if (typeof(etCurrencyManagerJsConfig) != "undefined") {
|
129 |
+
if (price == 0) {
|
130 |
+
if (typeof(etCurrencyManagerJsConfig.zerotext) != "undefined") {
|
131 |
+
return etCurrencyManagerJsConfig.zerotext;
|
132 |
+
}
|
133 |
+
}
|
134 |
+
}
|
135 |
+
//cut zero decimal
|
136 |
+
if (price - Math.round(price) == 0) {
|
137 |
+
if (typeof(etCurrencyManagerJsConfig) != "undefined") {
|
138 |
+
if (typeof(etCurrencyManagerJsConfig.cutzerodecimal) != "undefined") {
|
139 |
+
if (etCurrencyManagerJsConfig.cutzerodecimal != 0) {
|
140 |
+
format.precision = 0;
|
141 |
+
format.requiredPrecision = 0;
|
142 |
+
|
143 |
+
var for_replace = originalFormatCurrency(price, format, showPlus);
|
144 |
+
format.pattern = "%s";
|
145 |
+
var replaced_part = originalFormatCurrency(price, format, showPlus);
|
146 |
+
format.pattern = originalFormat.pattern;
|
147 |
+
if (typeof(etCurrencyManagerJsConfig.cutzerodecimal_suffix) != "undefined") {
|
148 |
+
if (etCurrencyManagerJsConfig.cutzerodecimal_suffix.length > 0) {
|
149 |
+
return for_replace.replace(replaced_part, replaced_part + ""
|
150 |
+
+ etCurrencyManagerJsConfig.cutzerodecimal_suffix);
|
151 |
+
}
|
152 |
+
}
|
153 |
+
}
|
154 |
+
}
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
if (typeof(etCurrencyManagerJsConfig) != "undefined") {
|
159 |
+
if (typeof(etCurrencyManagerJsConfig.min_decimal_count) != "undefined") {
|
160 |
+
if (etCurrencyManagerJsConfig.min_decimal_count < format.precision) {
|
161 |
+
for (var testPrecision = etCurrencyManagerJsConfig.min_decimal_count;
|
162 |
+
testPrecision < format.precision; testPrecision++) {
|
163 |
+
//abs for 0.00199999999 or 1.1000000000001 fix
|
164 |
+
if (Math.abs(Math.round(price * Math.pow(10, testPrecision))
|
165 |
+
- price * Math.pow(10, testPrecision))<0.0000001) {
|
166 |
+
format.precision = testPrecision;
|
167 |
+
format.requiredPrecision = testPrecision;
|
168 |
+
break;
|
169 |
+
}
|
170 |
+
}
|
171 |
+
}
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
|
176 |
+
return formatCurrencyET(price, format, showPlus);
|
177 |
+
//if(format.precision<0)format.precision=0;
|
178 |
+
//if(format.requiredPrecision<0)format.requiredPrecision=0;
|
179 |
+
/*return originalFormatCurrency(price, format, showPlus);*/
|
180 |
+
|
181 |
+
|
182 |
+
};
|
183 |
+
|
184 |
+
|
185 |
+
function formatCurrencyET(price, format, showPlus) {
|
186 |
+
var precision = isNaN(format.precision = (format.precision)) ? 2 : format.precision;
|
187 |
+
var requiredPrecision = isNaN(format.requiredPrecision = (format.requiredPrecision)) ? 2 : format.requiredPrecision;
|
188 |
+
|
189 |
+
//precision = (precision > requiredPrecision) ? precision : requiredPrecision;
|
190 |
+
//for now we don't need this difference so precision is requiredPrecision
|
191 |
+
precision = requiredPrecision;
|
192 |
+
|
193 |
+
var integerRequired = isNaN(format.integerRequired = Math.abs(format.integerRequired)) ? 1 : format.integerRequired;
|
194 |
+
|
195 |
+
var decimalSymbol = format.decimalSymbol == undefined ? "," : format.decimalSymbol;
|
196 |
+
var groupSymbol = format.groupSymbol == undefined ? "." : format.groupSymbol;
|
197 |
+
var groupLength = format.groupLength == undefined ? 3 : format.groupLength;
|
198 |
+
|
199 |
+
var s = '';
|
200 |
+
|
201 |
+
if (showPlus == undefined || showPlus == true) {
|
202 |
+
s = price < 0 ? "-" : ( showPlus ? "+" : "");
|
203 |
+
} else if (showPlus == false) {
|
204 |
+
s = '';
|
205 |
+
}
|
206 |
+
|
207 |
+
var i = parseInt(price = Math.abs(+price || 0).toFixed(precision)) + "";
|
208 |
+
var pad = (i.length < integerRequired) ? (integerRequired - i.length) : 0;
|
209 |
+
while (pad) {
|
210 |
+
i = '0' + i;
|
211 |
+
pad--;
|
212 |
+
}
|
213 |
+
j = (j = i.length) > groupLength ? j % groupLength : 0;
|
214 |
+
re = new RegExp("(\\d{" + groupLength + "})(?=\\d)", "g");
|
215 |
+
|
216 |
+
/**
|
217 |
+
* replace(/-/, 0) is only for fixing Safari bug which appears
|
218 |
+
* when Math.abs(0).toFixed() executed on "0" number.
|
219 |
+
* Result is "0.-0" :(
|
220 |
+
*/
|
221 |
+
if (precision < 0) {
|
222 |
+
precision = 0;
|
223 |
+
}
|
224 |
+
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) : "")
|
225 |
+
var pattern = '';
|
226 |
+
if (format.pattern.indexOf('{sign}') == -1) {
|
227 |
+
pattern = s + format.pattern;
|
228 |
+
} else {
|
229 |
+
pattern = format.pattern.replace('{sign}', s);
|
230 |
+
}
|
231 |
+
|
232 |
+
return pattern.replace('%s', r).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
|
233 |
+
}
|
234 |
+
|
235 |
+
|
236 |
+
|
237 |
+
|
238 |
+
}
|
239 |
+
catch (e) {
|
240 |
+
//do nothing
|
241 |
+
}
|
242 |
+
|
243 |
+
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ET_CurrencyManager</name>
|
4 |
-
<version>1.2.
|
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>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>_Currency Manager lets shop owner manage price display in an easy and convenient way: show custom currency symbol, change its position, change number of decimals and etc._</description>
|
11 |
<notes>stable release</notes>
|
12 |
<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>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="ET"><dir name="CurrencyManager"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><dir name="Options"><file name="Option.php" hash="3c8ebb1d4539a0cad43a247336c2ed2b"/></dir></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Linktooptions.php" hash="254eef26e1ae0edecc76a31541b244ae"/></dir></dir></dir></dir><file name="Formprice.php" hash="787bb8c6466fd5b58edff9119aeca6f0"/><file name="Heading.php" hash="0282201202dfbe3c2a9a7f0e3016bbd4"/><file name="Support.php" hash="990d30043688b410cf545cfeb3bcebd1"/><file name="Symbolreplace.php" hash="7d27f592da6f550c4c06b582600e54b9"/></dir><file name="Js.php" hash="086a2b3e70400c840615fd499ab5883e"/></dir><dir name="Helper"><file name="Data.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ET_CurrencyManager</name>
|
4 |
+
<version>1.2.4</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>
|
10 |
<description>_Currency Manager lets shop owner manage price display in an easy and convenient way: show custom currency symbol, change its position, change number of decimals and etc._</description>
|
11 |
<notes>stable release</notes>
|
12 |
<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>
|
13 |
+
<date>2015-02-16</date>
|
14 |
+
<time>12:28:49</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="ET"><dir name="CurrencyManager"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><dir name="Options"><file name="Option.php" hash="3c8ebb1d4539a0cad43a247336c2ed2b"/></dir></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Linktooptions.php" hash="254eef26e1ae0edecc76a31541b244ae"/></dir></dir></dir></dir><file name="Formprice.php" hash="787bb8c6466fd5b58edff9119aeca6f0"/><file name="Heading.php" hash="0282201202dfbe3c2a9a7f0e3016bbd4"/><file name="Support.php" hash="990d30043688b410cf545cfeb3bcebd1"/><file name="Symbolreplace.php" hash="7d27f592da6f550c4c06b582600e54b9"/></dir><file name="Js.php" hash="086a2b3e70400c840615fd499ab5883e"/></dir><dir name="Helper"><file name="Data.php" hash="fe8b786351a7f27fec7b11eac0ef4eb3"/><file name="Tax.php" hash="c3515cfc58e77804da9764a3a7c45e46"/><file name="Tax1810.php" hash="b0aaa6fbe2f3ee324b2a7fd3702f8200"/><file name="Url.php" hash="c955b5c25a971c10042d7d027ac92973"/></dir><dir name="Model"><file name="Currency.php" hash="362d5636797c5645e8080474de67d816"/><file name="Locale.php" hash="5f4d8d523f8d7a351f5afc952cdc9dd5"/><file name="Observer.php" hash="425ba0e028c55beca2e881280af01b63"/><file name="Store.php" hash="c3a70572e760588338f94e7300d1b2cf"/><file name="Typeposition.php" hash="9132477fac1f0bc56be36e18613ff23c"/><file name="Typesymboluse.php" hash="50b7bdd60eb040007f1b8f5bd9486b19"/></dir><dir name="controllers"><file name="CurrencyController.php" hash="854266bb77f94e5265ada83073a60cd1"/></dir><dir name="etc"><file name="config.xml" hash="fbdf18ee6512c6dde0097fee3ce1ebb3"/><file name="system.xml" hash="65fec8f8c28b4e870c217af16a5775ce"/></dir></dir></dir></target><target name="magelocale"><dir name="ru_RU"><file name="ET_Currencymanager.csv" hash="fd3d8ccd11ff2e65f03120e468e22a0a"/></dir><dir name="en_US"><file name="ET_Currencymanager.csv" hash="551008a104f6f1090500cdb05c90acd2"/></dir><dir name="fr_FR"><file name="ET_Currencymanager.csv" hash="ade2537df9d7dad795a62449434d022a"/></dir></target><target name="mageetc"><dir name="modules"><file name="ET_CurrencyManager.xml" hash="58495e7d1f538b0c987fd13fe75e56b5"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="et_currencymanager.xml" hash="162b9d35532260a71a90978800f19537"/></dir><dir name="template"><dir name="et_currencymanager"><file name="js.phtml" hash="573fd947d24f4d29fb25f7206da409c5"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="et"><dir name="currencymanager"><file name="et_currencymanager_round.js" hash="afdaf4c9b6128c3a8b3d922bf5b2ad78"/></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|