CodexMedia_SmartSend - Version 1.1.1

Version Notes

Receipted delivery flags

Download this release

Release Info

Developer Codex Media
Extension CodexMedia_SmartSend
Version 1.1.1
Comparing to
See all releases


Code changes from version 1.1.0 to 1.1.1

app/code/local/CodexMedia/SmartSend/Model/Api.php CHANGED
@@ -57,7 +57,7 @@ class CodexMedia_Smartsend_Model_Api extends Mage_Core_Model_Abstract {
57
  private $promotionalCode = '';
58
  private $onlineSellerId = '';
59
 
60
- private $receiptedDelivery = false;
61
 
62
  // Object containing the results of last quote
63
  private $lastQuoteResults;
@@ -180,7 +180,7 @@ class CodexMedia_Smartsend_Model_Api extends Mage_Core_Model_Abstract {
180
  'userType' => array( 'EBAY', 'PROMOTIONAL', 'VIP' ),
181
  'onlineSellerId' => '',
182
  'promotionalCode' => '',
183
- 'receiptedDelivery' => array( true, false ),
184
  'tailLift' => array( 'NONE', 'PICKUP', 'DELIVERY', 'BOTH' ),
185
  'transportAssurance' => ''
186
  );
57
  private $promotionalCode = '';
58
  private $onlineSellerId = '';
59
 
60
+ private $receiptedDelivery = 0;
61
 
62
  // Object containing the results of last quote
63
  private $lastQuoteResults;
180
  'userType' => array( 'EBAY', 'PROMOTIONAL', 'VIP' ),
181
  'onlineSellerId' => '',
182
  'promotionalCode' => '',
183
+ 'receiptedDelivery' => array( 1, 0 ),
184
  'tailLift' => array( 'NONE', 'PICKUP', 'DELIVERY', 'BOTH' ),
185
  'transportAssurance' => ''
186
  );
app/code/local/CodexMedia/SmartSend/Model/Shipping/Carrier/Smartsend.php CHANGED
@@ -64,18 +64,24 @@ class CodexMedia_SmartSend_Model_Shipping_Carrier_SmartSend
64
  $this->suburbTo = $request->getDestCity();
65
  $this->stateTo = $api->getState($this->postcodeTo);
66
 
 
 
 
 
 
67
  // Check is valid town at postcode
68
  if ( !$api->isTownInPostcode( $this->postcodeTo, $this->suburbTo ) )
69
  {
70
  $pcTowns = array();
71
  foreach( $api->getPostcodeSuburbs($this->postcodeTo) as $t )
72
  $pcTowns[] = ucwords(strtolower($t));
73
- $errString = 'Error in shipping calculation: You gave your town as ' . $this->suburbTo . ' for postcode '.$this->postcodeTo.'. Towns at that postcode include: '.
74
  implode( ', ', $pcTowns ).". Return to the 'Shipping Information' tab and enter one of these suburbs.";
75
 
76
- Mage::log( "Error: ".$this->suburbTo.' is not in the town list at '.$this->postcodeTo );
77
  $method = $this->_makeMethod( 'Error in shipping calculation', 10 );
78
  $result->append( $this->_resultError($errString) );
 
79
  return $result;
80
  }
81
 
@@ -163,12 +169,15 @@ class CodexMedia_SmartSend_Model_Shipping_Carrier_SmartSend
163
  $quoteResult = $api->getQuote()->ObtainQuoteResult;
164
 
165
  // Zero means success
166
- if( $quoteResult->StatusCode != 0 )
167
  {
 
 
 
168
  if( $quoteResult->StatusCode == -1 )
169
  {
170
- Mage::log( print_r( $quoteResult, true ) );
171
- $result->append( $this->_resultError( 'ERROR: ' . (string)$quoteResult->StatusMessages->string ));
172
  return $result;
173
  }
174
  return;
64
  $this->suburbTo = $request->getDestCity();
65
  $this->stateTo = $api->getState($this->postcodeTo);
66
 
67
+ if (empty($this->suburbTo)) {
68
+ $this->suburbTo = $api->getFirstTown( $this->postcodeTo );
69
+ Mage::log( 'Filling in '.$this->suburbTo.' as town for postcode '.$this->postcodeTo, null, 'smartsend.log' );
70
+ }
71
+
72
  // Check is valid town at postcode
73
  if ( !$api->isTownInPostcode( $this->postcodeTo, $this->suburbTo ) )
74
  {
75
  $pcTowns = array();
76
  foreach( $api->getPostcodeSuburbs($this->postcodeTo) as $t )
77
  $pcTowns[] = ucwords(strtolower($t));
78
+ $errString = 'Error in shipping calculation: You gave your town as \'' . $this->suburbTo . '\' for postcode '.$this->postcodeTo.'. Towns at that postcode include: '.
79
  implode( ', ', $pcTowns ).". Return to the 'Shipping Information' tab and enter one of these suburbs.";
80
 
81
+ Mage::log( "Error: ".$this->suburbTo.' is not in the town list at '.$this->postcodeTo, null, 'smartsend.log' );
82
  $method = $this->_makeMethod( 'Error in shipping calculation', 10 );
83
  $result->append( $this->_resultError($errString) );
84
+ $result->append( $method );
85
  return $result;
86
  }
87
 
169
  $quoteResult = $api->getQuote()->ObtainQuoteResult;
170
 
171
  // Zero means success
172
+ if ( $quoteResult->StatusCode != 0 && empty( $quoteResult->Quotes->Quote ) )
173
  {
174
+ $returnError = $quoteResult->StatusMessages->string;
175
+ if ( is_array( $returnError ) )
176
+ $returnError = implode( ", ", $returnError );
177
  if( $quoteResult->StatusCode == -1 )
178
  {
179
+ Mage::log( print_r( $quoteResult, true ), null, 'smartsend.log' );
180
+ $result->append( $this->_resultError( 'ERROR: ' . $returnError ));
181
  return $result;
182
  }
183
  return;
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>CodexMedia_SmartSend</name>
4
- <version>1.1.0</version>
5
  <stability>stable</stability>
6
  <license>MPL</license>
7
  <channel>community</channel>
@@ -10,11 +10,11 @@
10
  <description>The Smart Send shipping extension gives your Australian customers a range of instant shipping estimates - from cheapest to fastest.&#xD;
11
  &#xD;
12
  It features transport assurance, receipted delivery options, tail-lift assistance options and best of all - it's free.</description>
13
- <notes>Tested with Magento CE 1.9, and changed to new test server</notes>
14
  <authors><author><name>Codex Media</name><user>spacecat</user><email>paul@codexmedia.com.au</email></author></authors>
15
- <date>2014-05-20</date>
16
- <time>11:17:05</time>
17
- <contents><target name="mage"><dir name="."><file name="smart-send-install.txt" hash=""/></dir></target><target name="magelocal"><dir name="CodexMedia"><dir name="SmartSend"><dir name="Block"><file name="Smartsend.php" hash="f48fb8e47381b74fc0301b9381cfb0c3"/></dir><dir name="Helper"><file name="Data.php" hash="8f3d39008193315f7e7ddb628c35ba30"/><file name="Locations.php" hash="e8736b92eefac8e50794adcc99e5caca"/></dir><dir name="Model"><file name="Api.php" hash="dbe150ae119aa1d9cbd0314f709ab9ea"/><dir name="Mysql4"><file name="Setup.php" hash="d50a4306b6f10add9a6c30f4affde8c9"/></dir><dir name="Shipping"><dir name="Carrier"><file name="Smartsend.php" hash="bfeffb7226a4fd6b12e661a43257f1e5"/><file name="locations.data" hash="85b052477b10deae20a30c5a3a69a3ea"/></dir><dir name="Config"><file name="Types.php" hash="67552843ae114cfdbd6d165b88aafc1d"/></dir></dir><file name="locations.data" hash="3cd0f17601edcd9b16c03963326c3b2e"/></dir><dir name="controllers"><file name="IndexController.php" hash="a29578fb3f674177aace70f53fbb1774"/></dir><dir name="etc"><file name="config.xml" hash="5065b84559285ae031e54ec579de83d2"/><file name="system.xml" hash="2713b9089bfdb62409acbb7c75bf0759"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="smartsend.xml" hash="5b4b9a5db88d0655ccf6f761956b18ee"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CodexMedia_SmartSend.xml" hash="34a04a691e07c04cdb50efbcba356de4"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><extension><name>soap</name><min></min><max></max></extension><extension><name>curl</name><min></min><max></max></extension></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>CodexMedia_SmartSend</name>
4
+ <version>1.1.1</version>
5
  <stability>stable</stability>
6
  <license>MPL</license>
7
  <channel>community</channel>
10
  <description>The Smart Send shipping extension gives your Australian customers a range of instant shipping estimates - from cheapest to fastest.&#xD;
11
  &#xD;
12
  It features transport assurance, receipted delivery options, tail-lift assistance options and best of all - it's free.</description>
13
+ <notes>Receipted delivery flags</notes>
14
  <authors><author><name>Codex Media</name><user>spacecat</user><email>paul@codexmedia.com.au</email></author></authors>
15
+ <date>2014-10-27</date>
16
+ <time>05:28:23</time>
17
+ <contents><target name="mage"><dir name="."><file name="smart-send-install.txt" hash=""/></dir></target><target name="magelocal"><dir name="CodexMedia"><dir name="SmartSend"><dir name="Block"><file name="Smartsend.php" hash="f48fb8e47381b74fc0301b9381cfb0c3"/></dir><dir name="Helper"><file name="Data.php" hash="8f3d39008193315f7e7ddb628c35ba30"/><file name="Locations.php" hash="e8736b92eefac8e50794adcc99e5caca"/></dir><dir name="Model"><file name="Api.php" hash="33a72112758b6369dbfb846dd4cf4010"/><dir name="Mysql4"><file name="Setup.php" hash="d50a4306b6f10add9a6c30f4affde8c9"/></dir><dir name="Shipping"><dir name="Carrier"><file name="Smartsend.php" hash="90f7ef29edb603d2407968ece8a43897"/><file name="locations.data" hash="85b052477b10deae20a30c5a3a69a3ea"/></dir><dir name="Config"><file name="Types.php" hash="67552843ae114cfdbd6d165b88aafc1d"/></dir></dir><file name="locations.data" hash="3cd0f17601edcd9b16c03963326c3b2e"/></dir><dir name="controllers"><file name="IndexController.php" hash="a29578fb3f674177aace70f53fbb1774"/></dir><dir name="etc"><file name="config.xml" hash="5065b84559285ae031e54ec579de83d2"/><file name="system.xml" hash="2713b9089bfdb62409acbb7c75bf0759"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="smartsend.xml" hash="5b4b9a5db88d0655ccf6f761956b18ee"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CodexMedia_SmartSend.xml" hash="34a04a691e07c04cdb50efbcba356de4"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><extension><name>soap</name><min></min><max></max></extension><extension><name>curl</name><min></min><max></max></extension></required></dependencies>
20
  </package>