wp_price_decimal - Version 1.3.0

Version Notes

~ conf. product price update

Download this release

Release Info

Developer WebAndPeople
Extension wp_price_decimal
Version 1.3.0
Comparing to
See all releases


Code changes from version 1.2.0 to 1.3.0

app/code/community/WP/PriceDecimal/Block/About.php CHANGED
File without changes
app/code/community/WP/PriceDecimal/Helper/Data.php CHANGED
@@ -2,5 +2,23 @@
2
 
3
  class WP_PriceDecimal_Helper_Data extends Mage_Core_Helper_Abstract
4
  {
 
 
 
 
 
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  }
2
 
3
  class WP_PriceDecimal_Helper_Data extends Mage_Core_Helper_Abstract
4
  {
5
+ public static function getParams()
6
+ {
7
+ $config = Mage::getStoreConfig('price_decimal/general');
8
+ $moduleName = Mage::app()->getRequest()->getModuleName();
9
+ $controllerName = Mage::app()->getRequest()->getControllerName();
10
 
11
+ $skeep = !$config['enabled'];
12
+ if ($moduleName == 'checkout' && $config['exclude_cart']) $skeep = true;
13
+ if ($moduleName == 'admin') $skeep = true; // --- if Backand skeep
14
+
15
+ $precision = 0;
16
+ if (isset($config['precision']) && ($config['precision'] + 0) >= 0)
17
+ $precision = $config['precision'] + 0;
18
+
19
+ return array(
20
+ 'skeep' => $skeep,
21
+ 'precision' => $precision,
22
+ );
23
+ }
24
  }
app/code/community/WP/PriceDecimal/Model/Currency.php CHANGED
@@ -11,14 +11,8 @@ class WP_PriceDecimal_Model_Currency extends Mage_Directory_Model_Currency
11
  */
12
  public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
13
  {
14
- $config = Mage::getStoreConfig('price_decimal/general');
15
- $moduleName = Mage::app()->getRequest()->getModuleName();
16
- $controllerName = Mage::app()->getRequest()->getControllerName();
17
- $skeep = false;
18
- if ($moduleName == 'checkout' && $config['exclude_cart']) $skeep = true;
19
- if ($moduleName == 'admin' && $controllerName == 'sales_order_create' && $config['exclude_cart']) $skeep = true;
20
- if (!$config['enabled'] || $skeep) return parent::format($price, $options, $includeContainer, $addBrackets);
21
- $precision = 0; if (isset($config['precision']) && ($config['precision'] + 0) >= 0) $precision = $config['precision'] + 0;
22
- return $this->formatPrecision($price, $precision, $options, $includeContainer, $addBrackets);
23
  }
24
  }
11
  */
12
  public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
13
  {
14
+ $params = Mage::helper('pricedecimal')->getParams();
15
+ if ($params['skeep']) return parent::format($price, $options, $includeContainer, $addBrackets);
16
+ return $this->formatPrecision($price, $params['precision'], $options, $includeContainer, $addBrackets);
 
 
 
 
 
 
17
  }
18
  }
app/code/community/WP/PriceDecimal/Model/Locale.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WP_PriceDecimal_Model_Locale extends Mage_Core_Model_Locale
4
+ {
5
+ /**
6
+ * Functions returns array with price formating info for js function
7
+ * formatCurrency in js/varien/js.js
8
+ *
9
+ * @return array
10
+ */
11
+ public function getJsPriceFormat()
12
+ {
13
+ $result = parent::getJsPriceFormat();
14
+ $params = Mage::helper('pricedecimal')->getParams();
15
+ if (!$params['skeep']) $result['precision'] = $result['requiredPrecision'] = $params['precision'];
16
+ return $result;
17
+ }
18
+ }
app/code/community/WP/PriceDecimal/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <WP_PriceDecimal>
5
- <version>1.2.0</version>
6
  </WP_PriceDecimal>
7
  </modules>
8
  <global>
@@ -17,6 +17,11 @@
17
  <currency>WP_PriceDecimal_Model_Currency</currency>
18
  </rewrite>
19
  </directory>
 
 
 
 
 
20
  </models>
21
  </global>
22
  <adminhtml>
@@ -33,7 +38,7 @@
33
  <children>
34
  <price_decimal translate="title" module="pricedecimal">
35
  <title><![CDATA[Web & People: Price Decimal]]></title>
36
- <sort_order>1000</sort_order>
37
  </price_decimal>
38
  </children>
39
  </config>
@@ -50,7 +55,7 @@
50
  <enabled>1</enabled>
51
  <precision>0</precision>
52
  <exclude_cart>0</exclude_cart>
53
- <version>1.2.0</version>
54
  </general>
55
  </price_decimal>
56
  </default>
2
  <config>
3
  <modules>
4
  <WP_PriceDecimal>
5
+ <version>1.3.0</version>
6
  </WP_PriceDecimal>
7
  </modules>
8
  <global>
17
  <currency>WP_PriceDecimal_Model_Currency</currency>
18
  </rewrite>
19
  </directory>
20
+ <core>
21
+ <rewrite>
22
+ <locale>WP_PriceDecimal_Model_Locale</locale>
23
+ </rewrite>
24
+ </core>
25
  </models>
26
  </global>
27
  <adminhtml>
38
  <children>
39
  <price_decimal translate="title" module="pricedecimal">
40
  <title><![CDATA[Web & People: Price Decimal]]></title>
41
+ <sort_order>2000</sort_order>
42
  </price_decimal>
43
  </children>
44
  </config>
55
  <enabled>1</enabled>
56
  <precision>0</precision>
57
  <exclude_cart>0</exclude_cart>
58
+ <version>1.3.0</version>
59
  </general>
60
  </price_decimal>
61
  </default>
app/code/community/WP/PriceDecimal/etc/system.xml CHANGED
@@ -11,7 +11,7 @@
11
  <label>Price Decimal</label>
12
  <tab>web_and_people</tab>
13
  <frontend_type>text</frontend_type>
14
- <sort_order>100</sort_order>
15
  <show_in_default>1</show_in_default>
16
  <show_in_website>1</show_in_website>
17
  <show_in_store>1</show_in_store>
@@ -53,8 +53,8 @@
53
  <show_in_store>1</show_in_store>
54
  </exclude_cart>
55
  <version translate="label comment">
56
- <label>Current Version</label>
57
- <comment><![CDATA[The current version of the installed extension]]></comment>
58
  <frontend_type>label</frontend_type>
59
  <sort_order>100</sort_order>
60
  <show_in_default>1</show_in_default>
11
  <label>Price Decimal</label>
12
  <tab>web_and_people</tab>
13
  <frontend_type>text</frontend_type>
14
+ <sort_order>200</sort_order>
15
  <show_in_default>1</show_in_default>
16
  <show_in_website>1</show_in_website>
17
  <show_in_store>1</show_in_store>
53
  <show_in_store>1</show_in_store>
54
  </exclude_cart>
55
  <version translate="label comment">
56
+ <label>Extension Release</label>
57
+ <comment/>
58
  <frontend_type>label</frontend_type>
59
  <sort_order>100</sort_order>
60
  <show_in_default>1</show_in_default>
app/etc/modules/WP_PriceDecimal.xml CHANGED
File without changes
package.xml CHANGED
@@ -1,18 +1,68 @@
1
- <?xml version="1.0"?>
2
  <package>
3
- <name>wp_price_decimal</name>
4
- <version>1.2.0</version>
5
- <stability>stable</stability>
6
- <license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
7
- <channel>community</channel>
8
- <extends/>
9
- <summary>Decimal price (WebAndPeople.com)</summary>
10
- <description>Decimal price (WebAndPeople.com)</description>
11
- <notes>~ bugfix: decimal price in backand when Exclude Checkout = yes</notes>
12
- <authors><author><name>WebAndPeople</name><user>auto-converted</user><email>design@webandpeople.com</email></author><author><name>y.gerassimenko</name><user>auto-converted</user><email>y.gerassimenko@webandpeople.com</email></author></authors>
13
- <date>2011-07-31</date>
14
- <time>02:15:02</time>
15
- <contents><target name="mageweb"><dir name="app"><dir name="code"><dir name="community"><dir name="WP"><dir name="PriceDecimal"><dir name="Block"><file name="About.php" hash="5c0719ff5bda0feb45cde267e28b3714"/></dir><dir name="Helper"><file name="Data.php" hash="15bf7377bbd5f631a3437acff9c69d93"/></dir><dir name="Model"><file name="Currency.php" hash="3127adf6b1e2ca9121256ccb252853d7"/></dir><dir name="etc"><file name="config.xml" hash="2f102ab8fc9db2d6db2c33581613d037"/><file name="system.xml" hash="7ab1bf4ba9bb964753363c052de9a70f"/></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="WP_PriceDecimal.xml" hash="9b870760e423ab063bd152305552564c"/></dir></dir></dir></target></contents>
16
- <compatible/>
17
- <dependencies/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  </package>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
  <package>
3
+ <name>wp_price_decimal</name>
4
+ <version>1.3.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Price Decimal (WebAndPeople.com)</summary>
10
+ <description>Price Decimal (WebAndPeople.com)</description>
11
+ <notes>~ conf. product price update</notes>
12
+ <authors>
13
+ <author>
14
+ <name>WebAndPeople</name>
15
+ <user>WebAndPeople</user>
16
+ <email>design@webandpeople.com</email>
17
+ </author>
18
+ <author>
19
+ <name>y.gerassimenko</name>
20
+ <user>ygerassimenko</user>
21
+ <email>y.gerassimenko@webandpeople.com</email>
22
+ </author>
23
+ </authors>
24
+ <date>2011-11-04</date>
25
+ <time>03:02:04</time>
26
+ <contents>
27
+ <target name="mageweb">
28
+ <dir name="app">
29
+ <dir name="code">
30
+ <dir name="community">
31
+ <dir name="WP">
32
+ <dir name="PriceDecimal">
33
+ <dir name="Block">
34
+ <file name="About.php" hash="5c0719ff5bda0feb45cde267e28b3714"/>
35
+ </dir>
36
+ <dir name="Helper">
37
+ <file name="Data.php" hash="aea28646aee55b7a21bb90c52df0b14d"/>
38
+ </dir>
39
+ <dir name="Model">
40
+ <file name="Currency.php" hash="bae33697c942d87dc36ce1cc99a92813"/>
41
+ <file name="Locale.php" hash="d66eb5e2e8b0fc14202f699d94b2c26e"/>
42
+ </dir>
43
+ <dir name="etc">
44
+ <file name="config.xml" hash="0f18e516880b4a9f56c88414a3af0d9f"/>
45
+ <file name="system.xml" hash="527c2e7bb956a0292ac23c497f9fd873"/>
46
+ </dir>
47
+ </dir>
48
+ </dir>
49
+ </dir>
50
+ </dir>
51
+ <dir name="etc">
52
+ <dir name="modules">
53
+ <file name="WP_PriceDecimal.xml" hash="9b870760e423ab063bd152305552564c"/>
54
+ </dir>
55
+ </dir>
56
+ </dir>
57
+ </target>
58
+ </contents>
59
+ <compatible/>
60
+ <dependencies>
61
+ <required>
62
+ <php>
63
+ <min>5.2.0</min>
64
+ <max>6.0.0</max>
65
+ </php>
66
+ </required>
67
+ </dependencies>
68
  </package>