ShipHero - Version 1.0.2.4

Version Notes

- Added fallback to billing address if shipping address is not available

Download this release

Release Info

Developer Fareed Hosein
Extension ShipHero
Version 1.0.2.4
Comparing to
See all releases


Code changes from version 1.0.2.3 to 1.0.2.4

app/code/community/ShipHero/ShipmentExtApi/Model/Api2/Shipment/Rest/Admin/V1.php CHANGED
@@ -38,8 +38,8 @@ class ShipHero_ShipmentExtApi_Model_Api2_Shipment_Rest_Admin_V1 extends ShipHero
38
  */
39
  protected function _create(array $data)
40
  {
41
- error_log("In create shipment");
42
- error_log(print_r($data,1));
43
  if(empty($data['order_id']))
44
  {
45
  $this->_critical(self::RESOURCE_REQUEST_DATA_INVALID);
@@ -49,7 +49,6 @@ class ShipHero_ShipmentExtApi_Model_Api2_Shipment_Rest_Admin_V1 extends ShipHero
49
  $order = Mage::getModel('sales/order')->load($orderId);
50
 
51
  if($order['status'] == 'complete') $this->_errorMessage("The order is already complete.", Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
52
- error_log("After Status: " . $order["status"]);
53
 
54
  /**
55
  * Provide the Shipment Tracking Number,
@@ -62,7 +61,6 @@ class ShipHero_ShipmentExtApi_Model_Api2_Shipment_Rest_Admin_V1 extends ShipHero
62
  */
63
  $customerEmailComments = 'Shipment Submitted by ShipHero App.';
64
  if ($order->canShip()) {
65
- error_log("Can Ship");
66
  try {
67
  // $shipment = Mage::getModel('sales/service_order', $order)
68
  // ->prepareShipment($this->_getItemQtys($order, $data['line_items']));
@@ -113,12 +111,11 @@ class ShipHero_ShipmentExtApi_Model_Api2_Shipment_Rest_Admin_V1 extends ShipHero
113
  $this->_saveOrder($order, $customerEmailComments);
114
 
115
  } catch (Exception $e) {
116
- error_log("Top level error");
117
- error_log($e->getMessage());
118
  $this->_errorMessage($e->getMessage(), Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
119
  }
120
  }
121
- error_log("Can't Ship");
122
 
123
  }
124
 
@@ -152,7 +149,6 @@ class ShipHero_ShipmentExtApi_Model_Api2_Shipment_Rest_Admin_V1 extends ShipHero
152
  $orderQty = (int)$_eachItem->getQtyOrdered();
153
  $shippedQty = (int)$_eachItem->getQtyShipped();
154
  $remainingQty = $orderQty - $shippedQty;
155
- error_log('ParentId: ' . $_eachItem->getParentItemId() . ', ItemId: ' . $_eachItem->getId());
156
 
157
  if ($_eachItem->getParentItemId()) {
158
  $lineItemQty = (int)$lineItems[$_eachItem->getParentItemId()];
@@ -184,8 +180,8 @@ class ShipHero_ShipmentExtApi_Model_Api2_Shipment_Rest_Admin_V1 extends ShipHero
184
  ->save();
185
 
186
  $emailSentStatus = $shipment->getData('email_sent');
187
- error_log('Email Check');
188
- error_log($customerEmailComments . ', ' . $emailSentStatus);
189
  if (!is_null($customerEmailComments) && !$emailSentStatus) {
190
  try {
191
  $emailed = $shipment->sendEmail(true, $customerEmailComments);
38
  */
39
  protected function _create(array $data)
40
  {
41
+ // error_log("In create shipment");
42
+ // error_log(print_r($data,1));
43
  if(empty($data['order_id']))
44
  {
45
  $this->_critical(self::RESOURCE_REQUEST_DATA_INVALID);
49
  $order = Mage::getModel('sales/order')->load($orderId);
50
 
51
  if($order['status'] == 'complete') $this->_errorMessage("The order is already complete.", Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
 
52
 
53
  /**
54
  * Provide the Shipment Tracking Number,
61
  */
62
  $customerEmailComments = 'Shipment Submitted by ShipHero App.';
63
  if ($order->canShip()) {
 
64
  try {
65
  // $shipment = Mage::getModel('sales/service_order', $order)
66
  // ->prepareShipment($this->_getItemQtys($order, $data['line_items']));
111
  $this->_saveOrder($order, $customerEmailComments);
112
 
113
  } catch (Exception $e) {
114
+ // error_log("Top level error");
115
+ // error_log($e->getMessage());
116
  $this->_errorMessage($e->getMessage(), Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
117
  }
118
  }
 
119
 
120
  }
121
 
149
  $orderQty = (int)$_eachItem->getQtyOrdered();
150
  $shippedQty = (int)$_eachItem->getQtyShipped();
151
  $remainingQty = $orderQty - $shippedQty;
 
152
 
153
  if ($_eachItem->getParentItemId()) {
154
  $lineItemQty = (int)$lineItems[$_eachItem->getParentItemId()];
180
  ->save();
181
 
182
  $emailSentStatus = $shipment->getData('email_sent');
183
+ // error_log('Email Check');
184
+ // error_log($customerEmailComments . ', ' . $emailSentStatus);
185
  if (!is_null($customerEmailComments) && !$emailSentStatus) {
186
  try {
187
  $emailed = $shipment->sendEmail(true, $customerEmailComments);
app/code/community/ShipHero/WebHooks/Model/OrderObserver.php CHANGED
@@ -70,7 +70,12 @@ class ShipHero_WebHooks_Model_OrderObserver
70
  }
71
  $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
72
  $billingAddress = $order->getBillingAddress()->getData();
73
- $shippingAddress = $order->getShippingAddress()->getData();
 
 
 
 
 
74
  //$items = $order->getAllVisibleItems();
75
  $items = Mage::getResourceModel('sales/order_item_collection')->addFieldToFilter('order_id',array('eq'=>$order->getID()));
76
  $payment = $order->getPayment()->getMethodInstance()->getCode();
70
  }
71
  $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
72
  $billingAddress = $order->getBillingAddress()->getData();
73
+ $shippingAddress = $billingAddress;
74
+ try{
75
+ $shippingAddress = $order->getShippingAddress()->getData();
76
+ } catch (Exception $e) {
77
+ // Just move on
78
+ }
79
  //$items = $order->getAllVisibleItems();
80
  $items = Mage::getResourceModel('sales/order_item_collection')->addFieldToFilter('order_id',array('eq'=>$order->getID()));
81
  $payment = $order->getPayment()->getMethodInstance()->getCode();
app/code/community/ShipHero/WebHooks/Model/ProductObserver.php CHANGED
@@ -191,7 +191,7 @@ class ShipHero_WebHooks_Model_ProductObserver
191
  if ($status != 200)
192
  {
193
  // Write a new line to var/log/shiphero-webhook-observers.log
194
- $error_msg = "Call to URL $url failed with status $status, response $json_response, curl_error " . curl_error($curl) . ", curl_errno " . curl_errno($curl);
195
  Mage::log(
196
  "ProductObserverError: " . $error_msg,
197
  null,
191
  if ($status != 200)
192
  {
193
  // Write a new line to var/log/shiphero-webhook-observers.log
194
+ $error_msg = "Call to URL $url failed with status $status, response $json_response, curl_error " . curl_error($curl) . ", culr_errno " . curl_errno($curl);
195
  Mage::log(
196
  "ProductObserverError: " . $error_msg,
197
  null,
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ShipHero</name>
4
- <version>1.0.2.3</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
@@ -40,11 +40,11 @@ You can see the status of the order in real time and the history of the order in
40
  &lt;p&gt;Please do! Contact us at 1-(877) 671-6011 or &lt;a href="mailto:hello@shiphero.com"&gt;hello@shiphero.com&lt;/a&gt;&lt;/p&gt;&#xD;
41
  &#xD;
42
  &lt;p /&gt;Want to know more about ShipHero? &lt;a href="http://www.ShipHero.com"&gt;Watch video of ShipHero in action, and learn about the full set of features.&lt;/a&gt;</description>
43
- <notes>- Added support for bundled products</notes>
44
  <authors><author><name>Fareed Hosein</name><user>shipherollc</user><email>roger@shiphero.com</email></author></authors>
45
- <date>2015-10-27</date>
46
- <time>19:03:08</time>
47
- <contents><target name="magecommunity"><dir name="ShipHero"><dir name="CatalogExtApi"><dir name="Model"><dir name="Api2"><dir name="Product"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="aea540bb3df759fa5abf4cb2f26e3410"/></dir><file name=".DS_Store" hash="82133767cb30f899e06a57a6c0215a3d"/></dir></dir></dir></dir><dir name="etc"><file name="api2.xml" hash="a84153a82d1ca4b37909cb836fb0df78"/><file name="config.xml" hash="75fca57d73d1909bfb92a0b4116c3b24"/></dir></dir><dir name="CategoriesExtApi"><dir name="Model"><dir name="Api2"><dir name="Categories"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="1b2132443dacf2e8b7bab5e7aef17765"/></dir></dir></dir><file name="Categories.php" hash="a3e20a32e745bf4360019bd18a77cb3d"/></dir></dir><dir name="etc"><file name="api2.xml" hash="3ecd699dcd137862f6b92bc963b3556f"/><file name="config.xml" hash="286f5304b1db4bffe69238ea661af011"/></dir></dir><dir name="PaymentExtApi"><dir name="Model"><dir name="Api2"><dir name="Payment"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="6c19fbeb1dac8d2a7ef586689d09b860"/></dir></dir></dir><file name="Payment.php" hash="dd379bf5c286b0924111db0a8fadd658"/></dir></dir><dir name="etc"><file name="api2.xml" hash="792e6b7c9f17b551cb327267427ac128"/><file name="config.xml" hash="3a0e38693d058eb48521a4325b761b2e"/></dir></dir><dir name="SalesExtApi"><dir name="Model"><dir name="Api2"><dir name="Order"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="47fef23fc8176831f9798040368e7c52"/></dir></dir></dir></dir></dir><dir name="etc"><file name="api2.xml" hash="7fd3830df03511ab3fd8923e9bf490dc"/><file name="config.xml" hash="a0817be74340d9f9e12861993e5ee2c9"/></dir></dir><dir name="ShipmentExtApi"><dir name="Model"><dir name="Api2"><dir name="Shipment"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="68e0e5e494a9b4ee7ebd4a8bb8d509fb"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir></dir><file name="Shipment.php" hash="8a804aecde89f00f4d013253e8526cfb"/></dir></dir><dir name="etc"><file name="api2.xml" hash="84d7bb1a150b5b94f0797403ef656f45"/><file name="config.xml" hash="6bcba4e8b893bb78eadfb6038fa01927"/></dir></dir><dir name="WebHooks"><dir name="Model"><file name="OrderObserver.php" hash="96627cdd17999e56a4a66719f9327219"/><file name="ProductObserver.php" hash="7cb05ac0b3e892b22731b2220da8b97f"/><dir name="Resource"><file name="Setup.php" hash="428887c1ea6151a293d3d4b633963bce"/></dir></dir><dir name="etc"><file name="config.xml" hash="e5e8d6595e85311f3617f63b813e8e35"/><dir name="webapi"><file name="acl.xml" hash="444730c8892d9a14c169b6cd96da1cdd"/></dir></dir><dir name="sql"><dir name="shiphero_setup"><file name="install-0.1.0.php" hash="b793368264d3637cb831dd1ec2dbbeae"/></dir></dir><file name=".DS_Store" hash="5877fb6bf8ef0d0b1ae94df92d07d4cb"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></target><target name="mageetc"><dir name="modules"><file name="ShipHero.xml" hash="f6f6ffa93e8158fa631eb960d8872d46"/></dir></target></contents>
48
  <compatible/>
49
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7.0</min><max>2.0.0</max></package></required></dependencies>
50
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ShipHero</name>
4
+ <version>1.0.2.4</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
40
  &lt;p&gt;Please do! Contact us at 1-(877) 671-6011 or &lt;a href="mailto:hello@shiphero.com"&gt;hello@shiphero.com&lt;/a&gt;&lt;/p&gt;&#xD;
41
  &#xD;
42
  &lt;p /&gt;Want to know more about ShipHero? &lt;a href="http://www.ShipHero.com"&gt;Watch video of ShipHero in action, and learn about the full set of features.&lt;/a&gt;</description>
43
+ <notes>- Added fallback to billing address if shipping address is not available</notes>
44
  <authors><author><name>Fareed Hosein</name><user>shipherollc</user><email>roger@shiphero.com</email></author></authors>
45
+ <date>2015-11-17</date>
46
+ <time>14:50:30</time>
47
+ <contents><target name="magecommunity"><dir name="ShipHero"><dir name="CatalogExtApi"><dir name="Model"><dir name="Api2"><dir name="Product"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="aea540bb3df759fa5abf4cb2f26e3410"/></dir><file name=".DS_Store" hash="82133767cb30f899e06a57a6c0215a3d"/></dir></dir></dir></dir><dir name="etc"><file name="api2.xml" hash="a84153a82d1ca4b37909cb836fb0df78"/><file name="config.xml" hash="75fca57d73d1909bfb92a0b4116c3b24"/></dir></dir><dir name="CategoriesExtApi"><dir name="Model"><dir name="Api2"><dir name="Categories"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="1b2132443dacf2e8b7bab5e7aef17765"/></dir></dir></dir><file name="Categories.php" hash="a3e20a32e745bf4360019bd18a77cb3d"/></dir></dir><dir name="etc"><file name="api2.xml" hash="3ecd699dcd137862f6b92bc963b3556f"/><file name="config.xml" hash="286f5304b1db4bffe69238ea661af011"/></dir></dir><dir name="PaymentExtApi"><dir name="Model"><dir name="Api2"><dir name="Payment"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="6c19fbeb1dac8d2a7ef586689d09b860"/></dir></dir></dir><file name="Payment.php" hash="dd379bf5c286b0924111db0a8fadd658"/></dir></dir><dir name="etc"><file name="api2.xml" hash="792e6b7c9f17b551cb327267427ac128"/><file name="config.xml" hash="3a0e38693d058eb48521a4325b761b2e"/></dir></dir><dir name="SalesExtApi"><dir name="Model"><dir name="Api2"><dir name="Order"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="47fef23fc8176831f9798040368e7c52"/></dir></dir></dir></dir></dir><dir name="etc"><file name="api2.xml" hash="7fd3830df03511ab3fd8923e9bf490dc"/><file name="config.xml" hash="a0817be74340d9f9e12861993e5ee2c9"/></dir></dir><dir name="ShipmentExtApi"><dir name="Model"><dir name="Api2"><dir name="Shipment"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="d323d2a89541af731a32c0e143342703"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir></dir><file name="Shipment.php" hash="8a804aecde89f00f4d013253e8526cfb"/></dir></dir><dir name="etc"><file name="api2.xml" hash="84d7bb1a150b5b94f0797403ef656f45"/><file name="config.xml" hash="6bcba4e8b893bb78eadfb6038fa01927"/></dir></dir><dir name="WebHooks"><dir name="Model"><file name="OrderObserver.php" hash="685cefda2fc623d26563a59de92e1c54"/><file name="ProductObserver.php" hash="f6f547beefff73a438ab85c11b200d58"/><dir name="Resource"><file name="Setup.php" hash="428887c1ea6151a293d3d4b633963bce"/></dir></dir><dir name="etc"><file name="config.xml" hash="e5e8d6595e85311f3617f63b813e8e35"/><dir name="webapi"><file name="acl.xml" hash="444730c8892d9a14c169b6cd96da1cdd"/></dir></dir><dir name="sql"><dir name="shiphero_setup"><file name="install-0.1.0.php" hash="b793368264d3637cb831dd1ec2dbbeae"/></dir></dir><file name=".DS_Store" hash="5877fb6bf8ef0d0b1ae94df92d07d4cb"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></target><target name="mageetc"><dir name="modules"><file name="ShipHero.xml" hash="f6f6ffa93e8158fa631eb960d8872d46"/></dir></target></contents>
48
  <compatible/>
49
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7.0</min><max>2.0.0</max></package></required></dependencies>
50
  </package>