Version Notes
- Added SKU and Price output to custom option properties for oder line items
Download this release
Release Info
| Developer | Fareed Hosein |
| Extension | ShipHero |
| Version | 1.0.1.4 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.1.3 to 1.0.1.4
app/code/community/ShipHero/SalesExtApi/Model/Api2/Order/Rest/Admin/V1.php
CHANGED
|
@@ -41,13 +41,36 @@ class ShipHero_SalesExtApi_Model_Api2_Order_Rest_Admin_V1 extends Mage_Sales_Mod
|
|
| 41 |
|
| 42 |
foreach($order->getAllItems() as $item)
|
| 43 |
{
|
| 44 |
-
$product = $item->getProduct()
|
| 45 |
-
$
|
|
|
|
| 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 |
}
|
|
@@ -65,7 +88,6 @@ class ShipHero_SalesExtApi_Model_Api2_Order_Rest_Admin_V1 extends Mage_Sales_Mod
|
|
| 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 |
{
|
|
@@ -86,6 +108,7 @@ class ShipHero_SalesExtApi_Model_Api2_Order_Rest_Admin_V1 extends Mage_Sales_Mod
|
|
| 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']);
|
| 41 |
|
| 42 |
foreach($order->getAllItems() as $item)
|
| 43 |
{
|
| 44 |
+
$product = $item->getProduct();
|
| 45 |
+
$pData = $product->getData();
|
| 46 |
+
$ordersData[$order->getId()]['temp_item_array'][$item->getId()]['original_sku'] = $pData['sku'];
|
| 47 |
$ordersData[$order->getId()]['temp_item_array'][$item->getId()]['options'] = array();
|
| 48 |
|
| 49 |
$options = $item->getProductOptions();
|
| 50 |
if(!empty($options['options']))
|
| 51 |
{
|
| 52 |
+
// Loop through our options for the ordered item
|
| 53 |
+
foreach($options['options'] as $key => $itemOption)
|
| 54 |
+
{
|
| 55 |
+
// Get product options
|
| 56 |
+
foreach($product->getOptions() as $opt)
|
| 57 |
+
{
|
| 58 |
+
// Get the values for the options
|
| 59 |
+
$opts = $opt->getValues();
|
| 60 |
+
|
| 61 |
+
// Loop through options and extract the values for the selected item's options
|
| 62 |
+
foreach($opts as $o)
|
| 63 |
+
{
|
| 64 |
+
$oData = $o->getData();
|
| 65 |
+
if($itemOption['option_id'] == $oData['option_id'] && $itemOption['print_value'] == $oData['default_title'])
|
| 66 |
+
{
|
| 67 |
+
$options['options'][$key]['sku'] = $oData['sku'];
|
| 68 |
+
$options['options'][$key]['price'] = $oData['price'];
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
$ordersData[$order->getId()]['temp_item_array'][$item->getId()]['options'] = $options['options'];
|
| 75 |
}
|
| 76 |
}
|
| 88 |
$p = $product->getData();
|
| 89 |
$p_name = $item['name'];
|
| 90 |
$attribute_output = array();
|
|
|
|
| 91 |
|
| 92 |
foreach($allAttributeCodes as $a)
|
| 93 |
{
|
| 108 |
$items[$key]['sku'] = $ordersData[$orderId]['temp_item_array'][$item['item_id']]['original_sku'];
|
| 109 |
$items[$key]['custom_options'] = $ordersData[$orderId]['temp_item_array'][$item['item_id']]['options'];
|
| 110 |
$items[$key]['attributes'] = $attribute_output;
|
| 111 |
+
|
| 112 |
}
|
| 113 |
$ordersData[$orderId]['order_items'] = $items;
|
| 114 |
unset($ordersData[$orderId]['temp_item_array']);
|
app/code/community/ShipHero/WebHooks/Model/OrderObserver.php
CHANGED
|
@@ -78,6 +78,7 @@ class ShipHero_WebHooks_Model_OrderObserver
|
|
| 78 |
}
|
| 79 |
|
| 80 |
$orderItems = array();
|
|
|
|
| 81 |
foreach($items as $item)
|
| 82 |
{
|
| 83 |
$this->attribute_output = array();
|
|
@@ -85,10 +86,42 @@ class ShipHero_WebHooks_Model_OrderObserver
|
|
| 85 |
$product->load($item['product_id']);
|
| 86 |
$productData = $item->getProduct()->getData();
|
| 87 |
$options = $item->getProductOptions();
|
|
|
|
| 88 |
if($product->getTypeID() == 'configurable')
|
| 89 |
{
|
| 90 |
$productOptions = $item->getData();
|
| 91 |
$simpleProduct = unserialize($productOptions['product_options']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
$product['name'] = $simpleProduct['simple_name'];
|
| 93 |
$productData['sku'] = $simpleProduct['simple_sku'];
|
| 94 |
$product->load($product->getIdBySku($simpleProduct['simple_sku']));
|
|
@@ -183,7 +216,6 @@ class ShipHero_WebHooks_Model_OrderObserver
|
|
| 183 |
private function _sendData($url, $fields = array())
|
| 184 |
{
|
| 185 |
$content = json_encode($fields);
|
| 186 |
-
|
| 187 |
$curl = curl_init($url);
|
| 188 |
curl_setopt($curl, CURLOPT_HEADER, false);
|
| 189 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
| 78 |
}
|
| 79 |
|
| 80 |
$orderItems = array();
|
| 81 |
+
|
| 82 |
foreach($items as $item)
|
| 83 |
{
|
| 84 |
$this->attribute_output = array();
|
| 86 |
$product->load($item['product_id']);
|
| 87 |
$productData = $item->getProduct()->getData();
|
| 88 |
$options = $item->getProductOptions();
|
| 89 |
+
|
| 90 |
if($product->getTypeID() == 'configurable')
|
| 91 |
{
|
| 92 |
$productOptions = $item->getData();
|
| 93 |
$simpleProduct = unserialize($productOptions['product_options']);
|
| 94 |
+
|
| 95 |
+
// Loop through our options for the ordered item
|
| 96 |
+
foreach($simpleProduct['options'] as $key => $itemOption)
|
| 97 |
+
{
|
| 98 |
+
// Get product options
|
| 99 |
+
foreach($product->getOptions() as $opt)
|
| 100 |
+
{
|
| 101 |
+
// Get the values for the options
|
| 102 |
+
$opts = $opt->getValues();
|
| 103 |
+
|
| 104 |
+
// Loop through options and extract the values for the selected item's options
|
| 105 |
+
foreach($opts as $o)
|
| 106 |
+
{
|
| 107 |
+
$oData = $o->getData();
|
| 108 |
+
// error_log(print_r($itemOption,1));
|
| 109 |
+
// error_log("-----------------------------\n");
|
| 110 |
+
// error_log(print_r($oData,1));
|
| 111 |
+
// error_log("=============================\n");
|
| 112 |
+
// error_log($itemOption['option_id'] . ' = ' . $oData['option_id']);
|
| 113 |
+
// error_log($itemOption['print_value'] . ' = ' . $oData['default_title']);
|
| 114 |
+
if($itemOption['option_id'] == $oData['option_id'] && $itemOption['print_value'] == $oData['default_title'])
|
| 115 |
+
{
|
| 116 |
+
// error_log(print_r($oData,1));
|
| 117 |
+
$simpleProduct['options'][$key]['sku'] = $oData['sku'];
|
| 118 |
+
$simpleProduct['options'][$key]['price'] = $oData['price'];
|
| 119 |
+
}
|
| 120 |
+
// error_log("===========-------------------===========\n\n");
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
$product['name'] = $simpleProduct['simple_name'];
|
| 126 |
$productData['sku'] = $simpleProduct['simple_sku'];
|
| 127 |
$product->load($product->getIdBySku($simpleProduct['simple_sku']));
|
| 216 |
private function _sendData($url, $fields = array())
|
| 217 |
{
|
| 218 |
$content = json_encode($fields);
|
|
|
|
| 219 |
$curl = curl_init($url);
|
| 220 |
curl_setopt($curl, CURLOPT_HEADER, false);
|
| 221 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>ShipHero</name>
|
| 4 |
-
<version>1.0.1.
|
| 5 |
<stability>beta</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 |
<p>Please do! Contact us at 1-(877) 671-6011 or <a href="mailto:hello@shiphero.com">hello@shiphero.com</a></p>
|
| 41 |

|
| 42 |
<p />Want to know more about ShipHero? <a href="http://www.ShipHero.com">Watch video of ShipHero in action, and learn about the full set of features.</a></description>
|
| 43 |
-
<notes>-
|
| 44 |
<authors><author><name>Fareed Hosein</name><user>shipherollc</user><email>roger@shiphero.com</email></author></authors>
|
| 45 |
-
<date>2015-03-
|
| 46 |
-
<time>17:
|
| 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="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="
|
| 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.4</version>
|
| 5 |
<stability>beta</stability>
|
| 6 |
<license>GNU General Public License (GPL)</license>
|
| 7 |
<channel>community</channel>
|
| 40 |
<p>Please do! Contact us at 1-(877) 671-6011 or <a href="mailto:hello@shiphero.com">hello@shiphero.com</a></p>
|
| 41 |

|
| 42 |
<p />Want to know more about ShipHero? <a href="http://www.ShipHero.com">Watch video of ShipHero in action, and learn about the full set of features.</a></description>
|
| 43 |
+
<notes>- Added SKU and Price output to custom option properties for oder line items</notes>
|
| 44 |
<authors><author><name>Fareed Hosein</name><user>shipherollc</user><email>roger@shiphero.com</email></author></authors>
|
| 45 |
+
<date>2015-03-19</date>
|
| 46 |
+
<time>17:18:51</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="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="6dc32a11bbafa30b2de231e99afcd6d1"/></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="0feae5649f1ee7145fb3d5a266e1f2f6"/><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="0fb29f895be961700cdd85e23386a940"/><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>
|
| 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>
|
