ShipHero - Version 1.0.0.16

Version Notes

- Added custom options to order line items output
- Removed error logs

Download this release

Release Info

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


Code changes from version 1.0.0.15 to 1.0.0.16

app/code/community/ShipHero/PaymentExtApi/Model/Api2/Payment/Rest/Admin/V1.php CHANGED
@@ -46,25 +46,25 @@ class ShipHero_PaymentExtApi_Model_Api2_Payment_Rest_Admin_V1 extends ShipHero_P
46
  $orderId = $data['order_id'];
47
  $order = Mage::getModel('sales/order')->load($orderId);
48
 
49
- error_log('In Create Invoice');
50
  if($order['status'] == 'complete') $this->_error("The order is already complete.", Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
51
 
52
  if($order->canInvoice()) {
53
- error_log('Can Invoice:');
54
- error_log($order->canInvoice());
55
  try {
56
  // Generate invoice for this shipment
57
  $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice($this->_getItemQtys($order));
58
  $this->_saveInvoice($invoice, $order);
59
- error_log('Saved Invoice');
60
 
61
  // Finally, Save the Order
62
  $this->_saveOrder($order, $customerEmailComments);
63
- error_log('Saved Order');
64
 
65
  } catch (Exception $e){
66
- error_log('Can Invoice Errors');
67
- error_log($e->getMessage());
68
  $this->_error($e->getMessage(), Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
69
  }
70
  }
46
  $orderId = $data['order_id'];
47
  $order = Mage::getModel('sales/order')->load($orderId);
48
 
49
+ // error_log('In Create Invoice');
50
  if($order['status'] == 'complete') $this->_error("The order is already complete.", Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
51
 
52
  if($order->canInvoice()) {
53
+ // error_log('Can Invoice:');
54
+ // error_log($order->canInvoice());
55
  try {
56
  // Generate invoice for this shipment
57
  $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice($this->_getItemQtys($order));
58
  $this->_saveInvoice($invoice, $order);
59
+ // error_log('Saved Invoice');
60
 
61
  // Finally, Save the Order
62
  $this->_saveOrder($order, $customerEmailComments);
63
+ // error_log('Saved Order');
64
 
65
  } catch (Exception $e){
66
+ // error_log('Can Invoice Errors');
67
+ // error_log($e->getMessage());
68
  $this->_error($e->getMessage(), Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
69
  }
70
  }
app/code/community/ShipHero/SalesExtApi/Model/Api2/Order/Rest/Admin/V1.php CHANGED
@@ -38,7 +38,21 @@ class ShipHero_SalesExtApi_Model_Api2_Order_Rest_Admin_V1 extends Mage_Sales_Mod
38
  foreach ($collection->getItems() as $order) {
39
  $ordersData[$order->getId()] = $order->toArray();
40
  $ordersData[$order->getId()]['total_orders'] = $total_orders;
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
 
42
  if ($ordersData) {
43
  foreach ($this->_getAddresses(array_keys($ordersData)) as $orderId => $addresses) {
44
  $ordersData[$orderId]['addresses'] = $addresses;
@@ -50,7 +64,8 @@ class ShipHero_SalesExtApi_Model_Api2_Order_Rest_Admin_V1 extends Mage_Sales_Mod
50
  $product = Mage::getModel('catalog/product')->load($product_id);
51
  $p = $product->getData();
52
  $p_name = $item['name'];
53
- // error_log(print_r($p,1));
 
54
  foreach($allAttributeCodes as $a)
55
  {
56
  if(array_key_exists($a, $p) && ($a == 'color' || $a == 'size'))
@@ -60,11 +75,16 @@ class ShipHero_SalesExtApi_Model_Api2_Order_Rest_Admin_V1 extends Mage_Sales_Mod
60
  $p_name .= ' / ' . $attribute_value;
61
  }
62
  }
 
63
  $items[$key]['adjusted_name'] = $p_name;
64
  $items[$key]['type_id'] = $p['type_id'];
 
 
65
  }
66
  $ordersData[$orderId]['order_items'] = $items;
 
67
  }
 
68
  foreach ($this->_getComments(array_keys($ordersData)) as $orderId => $comments) {
69
  $ordersData[$orderId]['order_comments'] = $comments;
70
  }
38
  foreach ($collection->getItems() as $order) {
39
  $ordersData[$order->getId()] = $order->toArray();
40
  $ordersData[$order->getId()]['total_orders'] = $total_orders;
41
+
42
+ foreach($order->getAllItems() as $item)
43
+ {
44
+ $product = $item->getProduct()->getData();
45
+ $ordersData[$order->getId()]['temp_item_array'][$item->getId()]['original_sku'] = $product['sku'];
46
+ $ordersData[$order->getId()]['temp_item_array'][$item->getId()]['options'] = array();
47
+
48
+ $options = $item->getProductOptions();
49
+ if(!empty($options['options']))
50
+ {
51
+ $ordersData[$order->getId()]['temp_item_array'][$item->getId()]['options'] = $options['options'];
52
+ }
53
+ }
54
  }
55
+
56
  if ($ordersData) {
57
  foreach ($this->_getAddresses(array_keys($ordersData)) as $orderId => $addresses) {
58
  $ordersData[$orderId]['addresses'] = $addresses;
64
  $product = Mage::getModel('catalog/product')->load($product_id);
65
  $p = $product->getData();
66
  $p_name = $item['name'];
67
+ // error_log(print_r($p,1));
68
+
69
  foreach($allAttributeCodes as $a)
70
  {
71
  if(array_key_exists($a, $p) && ($a == 'color' || $a == 'size'))
75
  $p_name .= ' / ' . $attribute_value;
76
  }
77
  }
78
+
79
  $items[$key]['adjusted_name'] = $p_name;
80
  $items[$key]['type_id'] = $p['type_id'];
81
+ $items[$key]['sku'] = $ordersData[$orderId]['temp_item_array'][$item['item_id']]['original_sku'];
82
+ $items[$key]['custom_options'] = $ordersData[$orderId]['temp_item_array'][$item['item_id']]['options'];
83
  }
84
  $ordersData[$orderId]['order_items'] = $items;
85
+ unset($ordersData[$orderId]['temp_item_array']);
86
  }
87
+
88
  foreach ($this->_getComments(array_keys($ordersData)) as $orderId => $comments) {
89
  $ordersData[$orderId]['order_comments'] = $comments;
90
  }
app/code/community/ShipHero/WebHooks/Model/OrderObserver.php CHANGED
@@ -81,6 +81,16 @@ class ShipHero_WebHooks_Model_OrderObserver
81
  {
82
  $product = Mage::getModel('catalog/product')->load($item['product_id']);
83
  $p_name = $this->_getProductName($product);
 
 
 
 
 
 
 
 
 
 
84
  $orderItems[] = array(
85
  'item_id' => $item['item_id'],
86
  'sku' => $item['sku'],
@@ -88,7 +98,8 @@ class ShipHero_WebHooks_Model_OrderObserver
88
  'price' => $item['price'],
89
  'adjusted_name' => $p_name,
90
  'qty_shipped' => $item['qty_shipped'],
91
- 'type_id' => $product->getTypeID()
 
92
  );
93
  }
94
 
81
  {
82
  $product = Mage::getModel('catalog/product')->load($item['product_id']);
83
  $p_name = $this->_getProductName($product);
84
+ $productData = $item->getProduct()->getData();
85
+ $item['sku'] = $productData['sku'];
86
+ $customOptions = array();
87
+
88
+ $options = $item->getProductOptions();
89
+ if(!empty($options['options']))
90
+ {
91
+ $customOptions = $options['options'];
92
+ }
93
+
94
  $orderItems[] = array(
95
  'item_id' => $item['item_id'],
96
  'sku' => $item['sku'],
98
  'price' => $item['price'],
99
  'adjusted_name' => $p_name,
100
  'qty_shipped' => $item['qty_shipped'],
101
+ 'type_id' => $product->getTypeID(),
102
+ 'custom_options' => $customOptions
103
  );
104
  }
105
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ShipHero</name>
4
- <version>1.0.0.15</version>
5
  <stability>beta</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
@@ -40,11 +40,12 @@ 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>- Fixed on hold status webhook bug</notes>
 
44
  <authors><author><name>Fareed Hosein</name><user>shipherollc</user><email>roger@shiphero.com</email></author></authors>
45
- <date>2015-01-29</date>
46
- <time>04:48:10</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="fa124c3cf7655d6c9efc8172ecfdb8b4"/></dir><file name=".DS_Store" hash="82133767cb30f899e06a57a6c0215a3d"/></dir></dir></dir></dir><dir name="etc"><file name="api2.xml" hash="4bfa96037c915b8da87b87cd48f8c51b"/><file name="config.xml" hash="75fca57d73d1909bfb92a0b4116c3b24"/></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="24f5c3e72b225ad62b674a60213db7f9"/></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="e153e3b2e377e83e86798d332e83b9b9"/></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="3c0d3c01b64f83a2bbd0e443805e7506"/></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="59cdc43b3606252b9c6508ed0b713548"/><file name="ProductObserver.php" hash="df1790c6df7b976d4973f05a2e8c0088"/><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="9bc5e69f5d1a726dc36c95d7e6dae982"/></dir></dir></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></target><target name="mageetc"><dir name="modules"><file name="ShipHero.xml" hash="9ab0798e75362629478abe9a1db7bb6f"/></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.0.16</version>
5
  <stability>beta</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 custom options to order line items output&#xD;
44
+ - Removed error logs</notes>
45
  <authors><author><name>Fareed Hosein</name><user>shipherollc</user><email>roger@shiphero.com</email></author></authors>
46
+ <date>2015-02-11</date>
47
+ <time>02:47:43</time>
48
+ <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="fa124c3cf7655d6c9efc8172ecfdb8b4"/></dir><file name=".DS_Store" hash="82133767cb30f899e06a57a6c0215a3d"/></dir></dir></dir></dir><dir name="etc"><file name="api2.xml" hash="4bfa96037c915b8da87b87cd48f8c51b"/><file name="config.xml" hash="75fca57d73d1909bfb92a0b4116c3b24"/></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="d172248ff949effa3990191c6a037ef3"/></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="60d9b67908552ade74c89eb2a8d83493"/></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="3c0d3c01b64f83a2bbd0e443805e7506"/></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="29fe8f9a744de07c1b8dcceb40e43453"/><file name="ProductObserver.php" hash="df1790c6df7b976d4973f05a2e8c0088"/><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="9bc5e69f5d1a726dc36c95d7e6dae982"/></dir></dir></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></target><target name="mageetc"><dir name="modules"><file name="ShipHero.xml" hash="9ab0798e75362629478abe9a1db7bb6f"/></dir></target></contents>
49
  <compatible/>
50
  <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>
51
  </package>