Chapagain_AutoCurrency - Version 0.1.8

Version Notes

Added Enable/Disable configuration settings

Download this release

Release Info

Developer Mukesh Chapagain
Extension Chapagain_AutoCurrency
Version 0.1.8
Comparing to
See all releases


Code changes from version 0.1.7 to 0.1.8

app/code/community/Chapagain/AutoCurrency/Helper/Data.php CHANGED
@@ -27,13 +27,18 @@ class Chapagain_AutoCurrency_Helper_Data extends Mage_Core_Helper_Abstract
27
  return $geoIp;
28
  }
29
 
 
 
 
 
 
30
  /**
31
  * Get IP Address
32
  *
33
  * @return string
34
  */
35
  public function getIpAddress()
36
- {
37
  return $_SERVER['REMOTE_ADDR'];
38
  }
39
  }
27
  return $geoIp;
28
  }
29
 
30
+ public function isEnabled()
31
+ {
32
+ return Mage::getStoreConfig('catalog/autocurrency/enable_disable');
33
+ }
34
+
35
  /**
36
  * Get IP Address
37
  *
38
  * @return string
39
  */
40
  public function getIpAddress()
41
+ {
42
  return $_SERVER['REMOTE_ADDR'];
43
  }
44
  }
app/code/community/Chapagain/AutoCurrency/Model/Store.php CHANGED
@@ -19,9 +19,12 @@ class Chapagain_AutoCurrency_Model_Store extends Mage_Core_Model_Store
19
  */
20
  public function getDefaultCurrencyCode()
21
  {
22
- $result = $this->getConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_DEFAULT);
23
-
24
- return $this->getCurrencyCodeByIp($result);
 
 
 
25
  }
26
 
27
  /**
19
  */
20
  public function getDefaultCurrencyCode()
21
  {
22
+ if (Mage::helper('autocurrency')->isEnabled()) {
23
+ $result = $this->getConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_DEFAULT);
24
+ return $this->getCurrencyCodeByIp($result);
25
+ } else {
26
+ return parent::getDefaultCurrencyCode();
27
+ }
28
  }
29
 
30
  /**
app/code/community/Chapagain/AutoCurrency/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Chapagain_AutoCurrency>
5
- <version>0.1.7</version>
6
  </Chapagain_AutoCurrency>
7
  </modules>
8
  <global>
@@ -19,4 +19,11 @@
19
  </autocurrency>
20
  </helpers>
21
  </global>
 
 
 
 
 
 
 
22
  </config>
2
  <config>
3
  <modules>
4
  <Chapagain_AutoCurrency>
5
+ <version>0.1.8</version>
6
  </Chapagain_AutoCurrency>
7
  </modules>
8
  <global>
19
  </autocurrency>
20
  </helpers>
21
  </global>
22
+ <default>
23
+ <catalog>
24
+ <autocurrency>
25
+ <enable_disable>1</enable_disable>
26
+ </autocurrency>
27
+ </catalog>
28
+ </default>
29
  </config>
app/code/community/Chapagain/AutoCurrency/etc/system.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <sections>
4
+ <catalog translate="label">
5
+ <groups>
6
+ <autocurrency translate="label" module="autocurrency">
7
+ <label>Auto Currency</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>10</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <enable_disable translate="label comment">
15
+ <label>Enable/Disable</label>
16
+ <comment>Enable/Disable extension</comment>
17
+ <frontend_type>select</frontend_type>
18
+ <source_model>adminhtml/system_config_source_yesno</source_model>
19
+ <sort_order>10</sort_order>
20
+ <show_in_default>1</show_in_default>
21
+ <show_in_website>1</show_in_website>
22
+ <show_in_store>1</show_in_store>
23
+ </enable_disable>
24
+ </fields>
25
+ </autocurrency>
26
+ </groups>
27
+ </catalog>
28
+ </sections>
29
+ </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Chapagain_AutoCurrency</name>
4
- <version>0.1.7</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
@@ -18,11 +18,11 @@ Features:-&#xD;
18
  Easy to install and use&#xD;
19
  100% Free&#xD;
20
  100% Open Source</description>
21
- <notes>Fixed issue of module not working for some countries. Updated geoip.inc file.</notes>
22
  <authors><author><name>Mukesh Chapagain</name><user>chapagain</user><email>mukesh.chapagain@gmail.com</email></author></authors>
23
  <date>2013-10-20</date>
24
- <time>08:41:20</time>
25
- <contents><target name="magecommunity"><dir name="Chapagain"><dir name="AutoCurrency"><dir name="Helper"><file name="Data.php" hash="6649b9ad502d88f9755d35df1a7ea0ee"/></dir><dir name="Model"><file name="Store.php" hash="36deac5b59fcbebfc92519348cab50ae"/></dir><dir name="etc"><file name="config.xml" hash="e0699238986f2a1d8bd666020bed5488"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Chapagain_AutoCurrency.xml" hash="dd65769f686b4c12011f5d09e18249ff"/></dir></target><target name="mage"><dir name="var"><dir name="geoip"><file name="GeoIP.dat" hash="9533bdd7c9705ad2bec16dba59ce092f"/><file name="geoip.inc" hash="f2e497053c5d7dbd39431d14a87b2b27"/></dir></dir></target></contents>
26
  <compatible/>
27
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
28
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Chapagain_AutoCurrency</name>
4
+ <version>0.1.8</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
18
  Easy to install and use&#xD;
19
  100% Free&#xD;
20
  100% Open Source</description>
21
+ <notes>Added Enable/Disable configuration settings</notes>
22
  <authors><author><name>Mukesh Chapagain</name><user>chapagain</user><email>mukesh.chapagain@gmail.com</email></author></authors>
23
  <date>2013-10-20</date>
24
+ <time>09:52:47</time>
25
+ <contents><target name="magecommunity"><dir name="Chapagain"><dir name="AutoCurrency"><dir name="Helper"><file name="Data.php" hash="9ae32ce80508d03b79fd462228c7d2ee"/></dir><dir name="Model"><file name="Store.php" hash="f4ccbef38b82b6a9b27093da2ce660e4"/></dir><dir name="etc"><file name="config.xml" hash="24126724a925be6c88e20464a9f34c60"/><file name="system.xml" hash="a12f96c133b48970b97a1edbfe82e102"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Chapagain_AutoCurrency.xml" hash="dd65769f686b4c12011f5d09e18249ff"/></dir></target><target name="mage"><dir name="var"><dir name="geoip"><file name="GeoIP.dat" hash="9533bdd7c9705ad2bec16dba59ce092f"/><file name="geoip.inc" hash="f2e497053c5d7dbd39431d14a87b2b27"/></dir></dir></target></contents>
26
  <compatible/>
27
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
28
  </package>