GeoCurrencyStore - Version 1.1.0

Version Notes

Removed the dependency of allow_url_fopen and managed by curl.
Dynamic for all country.

Download this release

Release Info

Developer Pravin
Extension GeoCurrencyStore
Version 1.1.0
Comparing to
See all releases


Code changes from version 1.0.0 to 1.1.0

app/code/local/Plumtree/GeoCurrencyStore/Model/Store.php CHANGED
@@ -1,16 +1,18 @@
1
  <?php
2
  class Plumtree_GeoCurrencyStore_Model_Store extends Mage_Core_Model_Store
3
  {
4
- public function getDefaultCurrencyCode()
5
  {
6
- //Default Currency
7
- $result = $this->getConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_DEFAULT);
8
-
9
- $myarray = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$_SERVER['REMOTE_ADDR']));
10
- $country = $myarray['geoplugin_countryCode'];
11
-
12
- $currencyCode = $myarray['geoplugin_currencyCode'];
13
-
 
 
14
  $allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
15
 
16
  if(!in_array($currencyCode, $allowedCurrencies)) {
1
  <?php
2
  class Plumtree_GeoCurrencyStore_Model_Store extends Mage_Core_Model_Store
3
  {
4
+ public function getDefaultCurrencyCode()
5
  {
6
+ $result = $this->getConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_DEFAULT);
7
+
8
+ $url = 'http://www.geoplugin.net/php.gp?ip='.$_SERVER['REMOTE_ADDR'];
9
+ $curl = curl_init($url);
10
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
11
+ $data = curl_exec($curl);
12
+ curl_close($curl);
13
+
14
+ $myarray = unserialize($data);
15
+ $currencyCode = $myarray['geoplugin_currencyCode'];
16
  $allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
17
 
18
  if(!in_array($currencyCode, $allowedCurrencies)) {
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>GeoCurrencyStore</name>
4
- <version>1.0.0</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,13 @@ You must have multiple currency enabled on your store.&#xD;
18
  &#xD;
19
  &#xD;
20
  </description>
21
- <notes>currently it is working for USA and Canada</notes>
 
 
22
  <authors><author><name>Pravin</name><user>pravin_bluebird</user><email>pravin@plumtreegroup.net</email></author></authors>
23
- <date>2012-09-19</date>
24
- <time>12:02:48</time>
25
- <contents><target name="magelocal"><dir name="Plumtree"><dir name="GeoCurrencyStore"><dir name="Model"><file name="Store.php" hash="629cfbec8565a2c1dff487639c7b01d8"/><file name="Store.php.LCK" hash="daf465486047727f285b1a2d8d0f375b"/></dir><dir name="etc"><file name="config.xml" hash="6412b1196e06ead64d36151a2772e218"/><file name="config.xml.LCK" hash="daf465486047727f285b1a2d8d0f375b"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Plumtree_GeoCurrencyStore.xml" hash="1d95a3d80f5726331584731b5e2275fb"/></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>GeoCurrencyStore</name>
4
+ <version>1.1.0</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
  &#xD;
19
  &#xD;
20
  </description>
21
+ <notes>Removed the dependency of allow_url_fopen and managed by curl.&#xD;
22
+ Dynamic for all country.&#xD;
23
+ </notes>
24
  <authors><author><name>Pravin</name><user>pravin_bluebird</user><email>pravin@plumtreegroup.net</email></author></authors>
25
+ <date>2012-09-29</date>
26
+ <time>01:23:36</time>
27
+ <contents><target name="magelocal"><dir name="Plumtree"><dir name="GeoCurrencyStore"><dir name="Model"><file name="Store.php" hash="040950f6c91f5480be9a6795f0addf6a"/><file name="Store.php.LCK" hash="daf465486047727f285b1a2d8d0f375b"/></dir><dir name="etc"><file name="config.xml" hash="6412b1196e06ead64d36151a2772e218"/><file name="config.xml.LCK" hash="daf465486047727f285b1a2d8d0f375b"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Plumtree_GeoCurrencyStore.xml" hash="1d95a3d80f5726331584731b5e2275fb"/></dir></target></contents>
28
  <compatible/>
29
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
30
  </package>