4f4e331f92f560de38f6bc2b5501d8cb - Version 1.0.5

Version Notes

- Fixed errors.

Download this release

Release Info

Developer Roman Barbotkin
Extension 4f4e331f92f560de38f6bc2b5501d8cb
Version 1.0.5
Comparing to
See all releases


Code changes from version 1.0.4 to 1.0.5

app/code/local/Send24/Shipping/Model/Carrier.php CHANGED
@@ -18,10 +18,16 @@ class Send24_Shipping_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract
18
 
19
  public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
20
  $result = Mage::getModel('shipping/rate_result');
21
- // Check default currency.
22
- if(Mage::app()->getStore()->getDefaultCurrencyCode() == 'DKK'){
 
 
 
 
23
  // Express.
24
- $result->append($this->_getExpressShippingRate());
 
 
25
  // Countries.
26
  $enable_denmark = $this->getConfigData('enable_denmark');
27
  if($enable_denmark == 1){
@@ -41,7 +47,6 @@ class Send24_Shipping_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract
41
  "Content-Type: application/json"
42
  ));
43
  $send24_countries = json_decode(curl_exec($ch));
44
- $shipping_country_code = Mage::getModel('directory/country')->loadByCode(Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->getCountry());
45
  $is_available = false;
46
  if(!empty($send24_countries['0'])){
47
  foreach ($send24_countries['0'] as $key => $value) {
@@ -61,12 +66,13 @@ class Send24_Shipping_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract
61
  $price_denmark = false;
62
  }
63
  }
64
-
65
  // Destributions.
66
  $active_smartprice = $this->getConfigData('active_smartprice');
67
  if($active_smartprice == 1){
68
- if($price_denmark != false){
69
  $price[] = $price_denmark;
 
 
70
  }
71
  $price[] = $this->getConfigData('active_bring_price');
72
  $price[] = $this->getConfigData('active_dhl_price');
@@ -118,6 +124,24 @@ class Send24_Shipping_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract
118
  return $result;
119
  }
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  public function adminSystemConfigChangedSectionCarriers()
122
  {
123
  $get_model = Mage::getStoreConfig('carriers/send24_shipping/model');
18
 
19
  public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
20
  $result = Mage::getModel('shipping/rate_result');
21
+ $postcode = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->getPostcode();
22
+ $shipping_country_code = Mage::getModel('directory/country')->loadByCode(Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->getCountry());
23
+ $shipping_country_name = $shipping_country_code->getName();
24
+ $country_id = $shipping_country_code->getData('country_id');
25
+ // Check default currency.
26
+ if(Mage::app()->getStore()->getDefaultCurrencyCode() == 'DKK' && $country_id == 'DK'){
27
  // Express.
28
+ if(self::checkonzip($postcode) == 'true'){
29
+ $result->append($this->_getExpressShippingRate());
30
+ }
31
  // Countries.
32
  $enable_denmark = $this->getConfigData('enable_denmark');
33
  if($enable_denmark == 1){
47
  "Content-Type: application/json"
48
  ));
49
  $send24_countries = json_decode(curl_exec($ch));
 
50
  $is_available = false;
51
  if(!empty($send24_countries['0'])){
52
  foreach ($send24_countries['0'] as $key => $value) {
66
  $price_denmark = false;
67
  }
68
  }
 
69
  // Destributions.
70
  $active_smartprice = $this->getConfigData('active_smartprice');
71
  if($active_smartprice == 1){
72
+ if($price_denmark != false && self::checkonzip($postcode) == 'true'){
73
  $price[] = $price_denmark;
74
+ }else{
75
+ $price[] = '';
76
  }
77
  $price[] = $this->getConfigData('active_bring_price');
78
  $price[] = $this->getConfigData('active_dhl_price');
124
  return $result;
125
  }
126
 
127
+ // Check on postcode.
128
+ public function checkonzip($postcode){
129
+ $send24_consumer_key = $this->getConfigData('send24_consumer_key');
130
+ $send24_consumer_secret = $this->getConfigData('send24_consumer_secret');
131
+ $ch = curl_init();
132
+ curl_setopt($ch, CURLOPT_URL, "https://send24.com/wc-api/v3/get_service_area/".$postcode);
133
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
134
+ curl_setopt($ch, CURLOPT_HEADER, FALSE);
135
+ curl_setopt($ch, CURLOPT_USERPWD, $send24_consumer_key . ":" . $send24_consumer_secret);
136
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
137
+ "Content-Type: application/json"
138
+ ));
139
+ $response = curl_exec($ch);
140
+ curl_close($ch);
141
+ return $response;
142
+ }
143
+
144
+
145
  public function adminSystemConfigChangedSectionCarriers()
146
  {
147
  $get_model = Mage::getStoreConfig('carriers/send24_shipping/model');
app/code/local/Send24/Shipping/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Send24_Shipping>
5
- <module>1.0.4</module>
6
  </Send24_Shipping>
7
  </modules>
8
 
2
  <config>
3
  <modules>
4
  <Send24_Shipping>
5
+ <module>1.0.5</module>
6
  </Send24_Shipping>
7
  </modules>
8
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>4f4e331f92f560de38f6bc2b5501d8cb</name>
4
- <version>1.0.4</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
@@ -30,12 +30,11 @@ REQUIRES&#xD;
30
  This plugin requires an account on Send24. You will need to enter your api key in this shipping module to activate it. The account is free of charge and is used to administrate your shipments.&#xD;
31
  Register your free account on Send24.&#xD;
32
  </description>
33
- <notes>- Added Distributors&#xD;
34
- - Added SmartPrice</notes>
35
  <authors><author><name>Roman Barbotkin</name><user>Barbotkin</user><email>barbotkin@bk.ru</email></author></authors>
36
- <date>2016-04-13</date>
37
- <time>08:44:58</time>
38
- <contents><target name="magelocal"><dir name="Send24"><dir name="Shipping"><dir name="Block"><file name="Pickup.php" hash="f177e834828df1e1815f2948550fa990"/></dir><dir name="Model"><file name="Carrier.php" hash="5788b68b031da8d7dac4136323f569e7"/><file name="Distributors.php" hash="c6e43ae0f45c964088defc02d328827e"/><file name="Map.php" hash="82bb37a418fb949ea0b5031397cb86c3"/></dir><dir name="controllers"><file name="AjaxController.php" hash="8ca3c223b28bea631656dfb9729dca9f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="eb4c1e9213ed826c0ddda6faf0a036b8"/><file name="config.xml" hash="8842107ae50a37ad6811ef3e312c812c"/><file name="system.xml" hash="ca5c1fe025b03a78f932ceab9d2c1b89"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Send24_Shipping.xml" hash="c365adcf43a601147514106e32ef524e"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="pickup"><dir name="checkout"><dir name="onepage"><dir name="shipping_method"><file name="send24-available.phtml" hash="702f6e436a80a6a83a30ffd005fd5250"/></dir></dir></dir><file name="send24_pickup.phtml" hash="662f71e3a61e9a76696fc078d79acbc1"/></dir></dir><dir name="layout"><file name="send24_pickup.xml" hash="c6ad18a12688a27737aea4ab17b9f1bd"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="send24_order_tamplate.xml" hash="28484d6562bca02f3202dbd3ea7664e6"/></dir><dir name="template"><dir name="send24"><dir name="sales"><dir name="order"><dir name="view"><file name="custom.phtml" hash="5348e18bd217afe85a6d7000da4f627e"/><file name="info.phtml" hash="7704a122a7741323d32ce1bb3ebe56a1"/><file name="info1_4.phtml" hash="cadf51cf0c34285a56060a89809f3982"/><file name="info1_9.phtml" hash="7704a122a7741323d32ce1bb3ebe56a1"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="send24"><file name="jquery-1.6.4.min.js" hash="9118381924c51c89d9414a311ec9c97f"/><file name="noconflict.js" hash="3179f2255b046d5f2e9a71e365287bef"/><file name="popup.css" hash="34c9994bc7c4508709f612c4a217f51f"/></dir></dir></target></contents>
39
  <compatible/>
40
  <dependencies><required><php><min>5.1.0</min><max>7.0.0</max></php></required></dependencies>
41
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>4f4e331f92f560de38f6bc2b5501d8cb</name>
4
+ <version>1.0.5</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
30
  This plugin requires an account on Send24. You will need to enter your api key in this shipping module to activate it. The account is free of charge and is used to administrate your shipments.&#xD;
31
  Register your free account on Send24.&#xD;
32
  </description>
33
+ <notes>- Fixed errors.</notes>
 
34
  <authors><author><name>Roman Barbotkin</name><user>Barbotkin</user><email>barbotkin@bk.ru</email></author></authors>
35
+ <date>2016-05-01</date>
36
+ <time>00:52:59</time>
37
+ <contents><target name="magelocal"><dir name="Send24"><dir name="Shipping"><dir name="Block"><file name="Pickup.php" hash="f177e834828df1e1815f2948550fa990"/></dir><dir name="Model"><file name="Carrier.php" hash="a031e0ae2d59a980a41087f26d59da09"/><file name="Distributors.php" hash="c6e43ae0f45c964088defc02d328827e"/><file name="Map.php" hash="82bb37a418fb949ea0b5031397cb86c3"/></dir><dir name="controllers"><file name="AjaxController.php" hash="8ca3c223b28bea631656dfb9729dca9f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="eb4c1e9213ed826c0ddda6faf0a036b8"/><file name="config.xml" hash="33b4137ecd4ab64fa31042d11a4ddc96"/><file name="system.xml" hash="ca5c1fe025b03a78f932ceab9d2c1b89"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Send24_Shipping.xml" hash="c365adcf43a601147514106e32ef524e"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="pickup"><dir name="checkout"><dir name="onepage"><dir name="shipping_method"><file name="send24-available.phtml" hash="702f6e436a80a6a83a30ffd005fd5250"/></dir></dir></dir><file name="send24_pickup.phtml" hash="662f71e3a61e9a76696fc078d79acbc1"/></dir></dir><dir name="layout"><file name="send24_pickup.xml" hash="c6ad18a12688a27737aea4ab17b9f1bd"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="send24_order_tamplate.xml" hash="28484d6562bca02f3202dbd3ea7664e6"/></dir><dir name="template"><dir name="send24"><dir name="sales"><dir name="order"><dir name="view"><file name="custom.phtml" hash="5348e18bd217afe85a6d7000da4f627e"/><file name="info.phtml" hash="7704a122a7741323d32ce1bb3ebe56a1"/><file name="info1_4.phtml" hash="cadf51cf0c34285a56060a89809f3982"/><file name="info1_9.phtml" hash="7704a122a7741323d32ce1bb3ebe56a1"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="send24"><file name="jquery-1.6.4.min.js" hash="9118381924c51c89d9414a311ec9c97f"/><file name="noconflict.js" hash="3179f2255b046d5f2e9a71e365287bef"/><file name="popup.css" hash="34c9994bc7c4508709f612c4a217f51f"/></dir></dir></target></contents>
38
  <compatible/>
39
  <dependencies><required><php><min>5.1.0</min><max>7.0.0</max></php></required></dependencies>
40
  </package>