Mage_Shipwire - Version 1.2.2

Version Notes

Shipwire Shipping Rating API integrated

1.2.2
- Fixed issue with encoding of rate request

1.2.1
- Fixed issue with ship-to postcode not passing

Download this release

Release Info

Developer Magento Core Team
Extension Mage_Shipwire
Version 1.2.2
Comparing to
See all releases


Code changes from version 1.2.1 to 1.2.2

app/code/local/Shipwire/Shipping/Model/Carrier/ShippingMethod.php CHANGED
@@ -99,32 +99,35 @@ class Shipwire_Shipping_Model_Carrier_ShippingMethod extends Mage_Shipping_Model
99
  if (count($items) > 0) {
100
  foreach ($items as $item) {
101
  $item_xml .= '<Item num="' . $num++ . '">';
102
- $item_xml .= '<Code>' . htmlentities($item->sku) . '</Code>';
103
- $item_xml .= '<Quantity>' . htmlentities($item->qty) . '</Quantity>';
104
  $item_xml .= '</Item>';
105
  }
106
  }
107
 
108
  $xml = '
109
- <RateRequest>
110
- <EmailAddress><![CDATA[' . $account_email . ']]></EmailAddress>
111
- <Password><![CDATA[' . $account_password . ']]></Password>
112
- <Source>Magento Rating Module 1.2.0a</Source>
113
- <Order id="quote123">
114
- <Warehouse>00</Warehouse>
115
- <AddressInfo type="ship">
116
- <Address1><![CDATA[' . htmlentities($address_street1) . ']]></Address1>
117
- <Address2><![CDATA[' . htmlentities($address_street2) . ']]></Address2>
118
- <City><![CDATA[' . htmlentities($address_city) . ']]></City>
119
- <State><![CDATA[' . htmlentities($address_region) . ']]></State>
120
- <Country><![CDATA[' . htmlentities($address_country) . ']]></Country>
121
- <Zip><![CDATA[' . htmlentities($address_postcode) . ']]></Zip>
122
- </AddressInfo>
123
- ' . $item_xml . '
124
- </Order>
125
- </RateRequest>';
126
-
127
- $xml_request_encoded = ("RateRequestXML=" . $xml);
 
 
 
128
 
129
  $xml_submit_url = "https://api.shipwire.com/exec/RateServices.php";
130
 
@@ -185,7 +188,7 @@ class Shipwire_Shipping_Model_Carrier_ShippingMethod extends Mage_Shipping_Model
185
  $lb = count($method);
186
  $lc = count($cost);
187
 
188
- if($la = $lb = $lc){
189
  foreach($code as $index => $value){
190
  if (in_array($value, $supportedServices)) {
191
  $rateResult[] = array("code" => $code[$index],
@@ -212,4 +215,14 @@ class Shipwire_Shipping_Model_Carrier_ShippingMethod extends Mage_Shipping_Model
212
  $warnings = array();
213
  }
214
 
 
 
 
 
 
 
 
 
 
 
215
  }
99
  if (count($items) > 0) {
100
  foreach ($items as $item) {
101
  $item_xml .= '<Item num="' . $num++ . '">';
102
+ $item_xml .= '<Code>' . $item->sku . '</Code>';
103
+ $item_xml .= '<Quantity>' . $item->qty . '</Quantity>';
104
  $item_xml .= '</Item>';
105
  }
106
  }
107
 
108
  $xml = '
109
+
110
+ <?xml version="1.0" encoding="utf-8"?>
111
+ <!DOCTYPE RateRequest SYSTEM "http://www.shipwire.com/exec/download/RateRequest.dtd">
112
+ <RateRequest>
113
+ <EmailAddress><![CDATA[' . $account_email . ']]></EmailAddress>
114
+ <Password><![CDATA[' . $account_password . ']]></Password>
115
+ <Source>Magento Rating Module 1.2.2</Source>
116
+ <Order id="quote123">
117
+ <Warehouse>00</Warehouse>
118
+ <AddressInfo type="ship">
119
+ <Address1><![CDATA[' . $address_street1 . ']]></Address1>
120
+ <Address2><![CDATA[' . $address_street2 . ']]></Address2>
121
+ <City><![CDATA[' . $address_city . ']]></City>
122
+ <State><![CDATA[' . $address_region . ']]></State>
123
+ <Country><![CDATA[' . $address_country . ']]></Country>
124
+ <Zip><![CDATA[' . $address_postcode . ']]></Zip>
125
+ </AddressInfo>
126
+ ' . $item_xml . '
127
+ </Order>
128
+ </RateRequest>';
129
+
130
+ $xml_request_encoded = "RateRequestXML=" . urlencode($xml);
131
 
132
  $xml_submit_url = "https://api.shipwire.com/exec/RateServices.php";
133
 
188
  $lb = count($method);
189
  $lc = count($cost);
190
 
191
+ if($la == $lb && $lb == $lc && $la == $lc) {
192
  foreach($code as $index => $value){
193
  if (in_array($value, $supportedServices)) {
194
  $rateResult[] = array("code" => $code[$index],
215
  $warnings = array();
216
  }
217
 
218
+ protected function _xmlEntities($str) {
219
+ if (function_exists('mb_convert_encoding')) {
220
+ $text = mb_convert_encoding($str, 'HTML-ENTITIES', 'auto');
221
+ } else {
222
+ $text = htmlentities($str, ENT_NOQUOTES, 'UTF-8');
223
+ }
224
+
225
+ return $text;
226
+ }
227
+
228
  }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_Shipwire</name>
4
- <version>1.2.1</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>
@@ -10,12 +10,15 @@
10
  <description>Shipwire Rating API shipping method</description>
11
  <notes>Shipwire Shipping Rating API integrated
12
 
 
 
 
13
  1.2.1
14
  - Fixed issue with ship-to postcode not passing</notes>
15
  <authors><author><name>Shipwire</name><user>auto-converted</user><email>magento-dev@shipwire.com</email></author></authors>
16
- <date>2011-01-06</date>
17
- <time>04:30:31</time>
18
- <contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Shipwire_Shipping.xml" hash="89ae766499a54d75ac436f50efc2496c"/></dir></dir></dir></target><target name="magelocal"><dir name="Shipwire"><dir name="Shipping"><dir name="etc"><file name="config.xml" hash="1f073aae242b24b08032b22abf6c98c4"/><file name="system.xml" hash="0e5b1aafaa66a8d9a855078c76906568"/></dir><dir name="Model"><dir name="Carrier"><file name="Service.php" hash="aaceaced3d084b1130dc7d97c22ba140"/><file name="ShippingMethod.php" hash="9efb7e519cc345b4caf1d65ccc00a4d2"/></dir></dir></dir></dir></target></contents>
19
  <compatible/>
20
  <dependencies/>
21
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_Shipwire</name>
4
+ <version>1.2.2</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>
10
  <description>Shipwire Rating API shipping method</description>
11
  <notes>Shipwire Shipping Rating API integrated
12
 
13
+ 1.2.2
14
+ - Fixed issue with encoding of rate request
15
+
16
  1.2.1
17
  - Fixed issue with ship-to postcode not passing</notes>
18
  <authors><author><name>Shipwire</name><user>auto-converted</user><email>magento-dev@shipwire.com</email></author></authors>
19
+ <date>2011-01-31</date>
20
+ <time>07:17:04</time>
21
+ <contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Shipwire_Shipping.xml" hash="89ae766499a54d75ac436f50efc2496c"/></dir></dir></dir></target><target name="magelocal"><dir name="Shipwire"><dir name="Shipping"><dir name="etc"><file name="config.xml" hash="1f073aae242b24b08032b22abf6c98c4"/><file name="system.xml" hash="0e5b1aafaa66a8d9a855078c76906568"/></dir><dir name="Model"><dir name="Carrier"><file name="Service.php" hash="aaceaced3d084b1130dc7d97c22ba140"/><file name="ShippingMethod.php" hash="9501ccd014daf97c1b1dba52b958380c"/></dir></dir></dir></dir></target></contents>
22
  <compatible/>
23
  <dependencies/>
24
  </package>