ShipHero - Version 1.0.1.0

Version Notes

- Added categories rest endpoint to get all frontend attributes
- Added order attributes to the order endpoints and webhooks

Download this release

Release Info

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


Code changes from version 1.0.0.18 to 1.0.1.0

app/code/community/ShipHero/CategoriesExtApi/Model/Api2/Categories.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ShipHero_CategoriesExtApi_Model_Api2_Categories extends Mage_Api2_Model_Resource
4
+ {
5
+
6
+ }
app/code/community/ShipHero/CategoriesExtApi/Model/Api2/Categories/Rest/Admin/V1.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ShipHero_CategoriesExtApi_Model_Api2_Categories_Rest_Admin_V1 extends ShipHero_CategoriesExtApi_Model_Api2_Categories
4
+ {
5
+ protected function _retrieveCollection()
6
+ {
7
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')->addFieldToFilter('is_visible_on_front', 1);
8
+ $attributeArray = array();
9
+
10
+ foreach($attributes as $attribute){
11
+ $attributeArray[] = array(
12
+ 'label' => $attribute->getData('frontend_label'),
13
+ 'value' => $attribute->getData('attribute_code')
14
+ );
15
+ }
16
+ return $attributeArray;
17
+ }
18
+ }
app/code/community/ShipHero/CategoriesExtApi/etc/api2.xml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <api2>
4
+ <resources>
5
+ <categoriesextapi translate="title" module="ShipHero_CategoriesEXtApi">
6
+ <group>catalogextapi</group>
7
+ <title>Categories</title>
8
+ <model>categoriesextapi/api2_categories</model>
9
+ <sort_order>10</sort_order>
10
+ <privileges>
11
+ <admin>
12
+ <retrieve>1</retrieve>
13
+ </admin>
14
+ </privileges>
15
+ <attributes>
16
+ <category_id>Category ID</category_id>
17
+ <name>Name</name>
18
+ <parent_id>Category Parent ID</parent_id>
19
+ <child_id>Category Child List</child_id>
20
+ <active>Active</active>
21
+ <level>Level</level>
22
+ <position>Position</position>
23
+ <label>Label</label>
24
+ <value>Value</value>
25
+ </attributes>
26
+ <routes>
27
+ <route_collection>
28
+ <route>/shiphero/categories</route>
29
+ <action_type>collection</action_type>
30
+ </route_collection>
31
+ </routes>
32
+ <versions>1</versions>
33
+ </categoriesextapi>
34
+ </resources>
35
+ </api2>
36
+ </config>
app/code/community/ShipHero/CategoriesExtApi/etc/config.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <ShipHero_CategoriesExtApi>
5
+ <version>0.1.0</version>
6
+ </ShipHero_CategoriesExtApi>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <categoriesextapi>
11
+ <class>ShipHero_CategoriesExtApi_Model</class>
12
+ </categoriesextapi>
13
+ </models>
14
+ </global>
15
+ </config>
app/code/community/ShipHero/SalesExtApi/Model/Api2/Order/Rest/Admin/V1.php CHANGED
@@ -64,15 +64,20 @@ class ShipHero_SalesExtApi_Model_Api2_Order_Rest_Admin_V1 extends Mage_Sales_Mod
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'))
72
  {
73
  $attribute_value = $product->getAttributeText($a);
74
  if(!empty($attribute_value))
75
- $p_name .= ' / ' . $attribute_value;
 
 
 
 
76
  }
77
  }
78
 
@@ -80,6 +85,7 @@ class ShipHero_SalesExtApi_Model_Api2_Order_Rest_Admin_V1 extends Mage_Sales_Mod
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']);
64
  $product = Mage::getModel('catalog/product')->load($product_id);
65
  $p = $product->getData();
66
  $p_name = $item['name'];
67
+ $attribute_output = array();
68
  // error_log(print_r($p,1));
69
 
70
  foreach($allAttributeCodes as $a)
71
  {
72
+ if(array_key_exists($a, $p))
73
  {
74
  $attribute_value = $product->getAttributeText($a);
75
  if(!empty($attribute_value))
76
+ {
77
+ $attribute_output[] = array('label' => $a, 'value' => $attribute_value);
78
+ if($a == 'color' || $a == 'size')
79
+ $p_name .= ' / ' . $attribute_value;
80
+ }
81
  }
82
  }
83
 
85
  $items[$key]['type_id'] = $p['type_id'];
86
  $items[$key]['sku'] = $ordersData[$orderId]['temp_item_array'][$item['item_id']]['original_sku'];
87
  $items[$key]['custom_options'] = $ordersData[$orderId]['temp_item_array'][$item['item_id']]['options'];
88
+ $items[$key]['attributes'] = $attribute_output;
89
  }
90
  $ordersData[$orderId]['order_items'] = $items;
91
  unset($ordersData[$orderId]['temp_item_array']);
app/code/community/ShipHero/WebHooks/Model/OrderObserver.php CHANGED
@@ -3,6 +3,7 @@
3
  class ShipHero_WebHooks_Model_OrderObserver
4
  {
5
  protected $url = 'http://api.shiphe.ro/api/api2/magento/webhooks/';
 
6
 
7
  /**
8
  * Constructor
@@ -99,7 +100,8 @@ class ShipHero_WebHooks_Model_OrderObserver
99
  'adjusted_name' => $p_name,
100
  'qty_shipped' => $item['qty_shipped'],
101
  'type_id' => $product->getTypeID(),
102
- 'custom_options' => $customOptions
 
103
  );
104
  }
105
 
@@ -217,11 +219,15 @@ class ShipHero_WebHooks_Model_OrderObserver
217
  $p = $product->debug();
218
  foreach($p as $key => $val)
219
  {
220
- if(in_array($key, $allAttributecodes) && ($key == 'color' || $key == 'size'))
221
  {
222
  $attribute_value = $product->getAttributeText($key);
223
  if(!empty($attribute_value))
224
- $p_name .= ' / ' . $attribute_value;
 
 
 
 
225
  }
226
  }
227
  return $p_name;
3
  class ShipHero_WebHooks_Model_OrderObserver
4
  {
5
  protected $url = 'http://api.shiphe.ro/api/api2/magento/webhooks/';
6
+ protected $attribute_output = array();
7
 
8
  /**
9
  * Constructor
100
  'adjusted_name' => $p_name,
101
  'qty_shipped' => $item['qty_shipped'],
102
  'type_id' => $product->getTypeID(),
103
+ 'custom_options' => $customOptions,
104
+ 'attributes' => $this->attribute_output
105
  );
106
  }
107
 
219
  $p = $product->debug();
220
  foreach($p as $key => $val)
221
  {
222
+ if(in_array($key, $allAttributecodes))
223
  {
224
  $attribute_value = $product->getAttributeText($key);
225
  if(!empty($attribute_value))
226
+ {
227
+ $this->attribute_output[] = array('label' => $key, 'value' => $attribute_value);
228
+ if($key == 'color' || $key == 'size')
229
+ $p_name .= ' / ' . $attribute_value;
230
+ }
231
  }
232
  }
233
  return $p_name;
app/etc/modules/ShipHero.xml CHANGED
@@ -17,6 +17,10 @@
17
  <active>true</active>
18
  <codePool>community</codePool>
19
  </ShipHero_PaymentExtApi>
 
 
 
 
20
  <ShipHero_WebHooks>
21
  <active>true</active>
22
  <codePool>community</codePool>
17
  <active>true</active>
18
  <codePool>community</codePool>
19
  </ShipHero_PaymentExtApi>
20
+ <ShipHero_CategoriesExtApi>
21
+ <active>true</active>
22
+ <codePool>community</codePool>
23
+ </ShipHero_CategoriesExtApi>
24
  <ShipHero_WebHooks>
25
  <active>true</active>
26
  <codePool>community</codePool>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ShipHero</name>
4
- <version>1.0.0.18</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 table prefixes for webhooks</notes>
 
44
  <authors><author><name>Fareed Hosein</name><user>shipherollc</user><email>roger@shiphero.com</email></author></authors>
45
- <date>2015-02-17</date>
46
- <time>22:36:41</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="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="ca22f301af50c7986d8b1b96e8e4a8e5"/><file name="ProductObserver.php" hash="c6da509d06a30fb18f32b2004a1d8893"/><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></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.1.0</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 categories rest endpoint to get all frontend attributes&#xD;
44
+ - Added order attributes to the order endpoints and webhooks</notes>
45
  <authors><author><name>Fareed Hosein</name><user>shipherollc</user><email>roger@shiphero.com</email></author></authors>
46
+ <date>2015-02-26</date>
47
+ <time>15:53:46</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="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="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="f854b791ca9b3556e5f04371620ef11a"/></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="908557c39551bf04f9212b3109a6c588"/><file name="ProductObserver.php" hash="c6da509d06a30fb18f32b2004a1d8893"/><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></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></target><target name="mageetc"><dir name="modules"><file name="ShipHero.xml" hash="f6f6ffa93e8158fa631eb960d8872d46"/></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>