SKUIQ - Version 1.2.4

Version Notes

Improved credit Memo functionality
Improved Sales tracking

Download this release

Release Info

Developer Boutiika Labs
Extension SKUIQ
Version 1.2.4
Comparing to
See all releases


Code changes from version 1.2.3 to 1.2.4

app/code/local/Skuiq/.DS_Store ADDED
Binary file
app/code/local/Skuiq/LogProductUpdate/.DS_Store ADDED
Binary file
app/code/local/Skuiq/LogProductUpdate/Model/Observer.php CHANGED
@@ -1,10 +1,4 @@
1
  <?php
2
- /**
3
- * Our class name should follow the directory structure of
4
- * our Observer.php model, starting from the namespace,
5
- * replacing directory separators with underscores.
6
- * i.e. app/code/local/Skuiq/LogProductUpdate/Model/Observer.php
7
- */
8
  class Skuiq_LogProductUpdate_Model_Observer
9
  {
10
  public function logUpdate(Varien_Event_Observer $observer)
@@ -45,7 +39,6 @@ class Skuiq_LogProductUpdate_Model_Observer
45
  $childArray[$i]["childID"] = $cID;
46
  $childArray[$i]["quantity"] = $qty;
47
  Mage::log(" QTY IS {$qty} for Child ID {$cID}", null, 'product-updates.txt');
48
- //$childArray = array_merge($childArray, $tmpArray);
49
  $i++;
50
  }
51
  Mage::log((array_values($childArray)), null, 'product-updates.txt');
@@ -61,7 +54,6 @@ class Skuiq_LogProductUpdate_Model_Observer
61
  }
62
  }
63
 
64
- // Called if a sale is cancelled
65
  public function stockChange(Varien_Event_Observer $observer)
66
  {
67
  $base_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
@@ -85,32 +77,43 @@ class Skuiq_LogProductUpdate_Model_Observer
85
  }
86
  }
87
 
88
- // Called if a credit memo is created to cancel a sale
89
  public function refundOrderInventory(Varien_Event_Observer $observer)
90
  {
91
- $base_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
92
- $uri = "https://api.skuiq.com/magento/webhooks/cancel_order";
93
 
94
- $creditmemo = $observer->getEvent()->getCreditmemo();
95
- $items = array();
96
- foreach ($creditmemo->getAllItems() as $item) {
97
- $qty = $item->getQty();
98
- $product_id = $item->getProductId();
99
- $return = $item->getBackToStock();
100
- $incrementId = $creditmemo->getIncrementId();
 
 
 
 
 
 
 
 
 
 
 
 
101
 
102
- if ($return == 1) {
103
- Mage::log(" Stock Change - Credit Memo - Quantity:{$qty} Product ID:{$product} Return: {$return}", null, 'product-updates.txt');
104
- $product["children"] = "";
105
- $_item = Mage::getModel('catalog/product')->load($product_id);
106
- $json = Mage::helper('core')->jsonEncode($_item);
107
- $client = new Zend_Http_Client($uri);
108
- $client->setHeaders('Content-type', 'application/json');
109
- $client->setParameterPost('base_url', $base_url);
110
- $client->setParameterPost('product', $json);
111
- $client->setParameterPost('reason', 'credit_memo');
112
- $response = $client->request('POST');
113
- }
114
  }
 
115
  }
116
  }
1
  <?php
 
 
 
 
 
 
2
  class Skuiq_LogProductUpdate_Model_Observer
3
  {
4
  public function logUpdate(Varien_Event_Observer $observer)
39
  $childArray[$i]["childID"] = $cID;
40
  $childArray[$i]["quantity"] = $qty;
41
  Mage::log(" QTY IS {$qty} for Child ID {$cID}", null, 'product-updates.txt');
 
42
  $i++;
43
  }
44
  Mage::log((array_values($childArray)), null, 'product-updates.txt');
54
  }
55
  }
56
 
 
57
  public function stockChange(Varien_Event_Observer $observer)
58
  {
59
  $base_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
77
  }
78
  }
79
 
 
80
  public function refundOrderInventory(Varien_Event_Observer $observer)
81
  {
82
+ $base_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
83
+ $uri = "https://api.skuiq.com/magento/webhooks/cancel_order";
84
 
85
+ $creditmemo = $observer->getEvent()->getCreditmemo();
86
+
87
+ $cr_uri = "https://api.skuiq.com/magento/webhooks/credit_memo";
88
+ $cr_memo_id = $creditmemo->getIncrementId();
89
+ Mage::log(" Credit Memo ID:{$cr_memo_id}", null, 'product-updates.txt');
90
+
91
+ $cr_client = new Zend_Http_Client($uri);
92
+ $cr_client->setHeaders('Content-type', 'application/json');
93
+ $cr_client->setParameterPost('base_url', $base_url);
94
+ $cr_client->setParameterPost('credit_memo_id', $cr_memo_id);
95
+ $response = $cr_client->request('POST');
96
+
97
+
98
+ $items = array();
99
+ foreach ($creditmemo->getAllItems() as $item) {
100
+ $qty = $item->getQty();
101
+ $product_id = $item->getProductId();
102
+ $return = $item->getBackToStock();
103
+ $incrementId = $creditmemo->getIncrementId();
104
 
105
+ if ($return == 1) {
106
+ Mage::log(" Stock Change - Credit Memo - Quantity:{$qty} Product ID:{$product} Return: {$return}", null, 'product-updates.txt');
107
+ $product["children"] = "";
108
+ $_item = Mage::getModel('catalog/product')->load($product_id);
109
+ $json = Mage::helper('core')->jsonEncode($_item);
110
+ $client = new Zend_Http_Client($uri);
111
+ $client->setHeaders('Content-type', 'application/json');
112
+ $client->setParameterPost('base_url', $base_url);
113
+ $client->setParameterPost('product', $json);
114
+ $client->setParameterPost('reason', 'credit_memo');
115
+ $response = $client->request('POST');
 
116
  }
117
+ }
118
  }
119
  }
app/code/local/Skuiq/SendSaleInfo/Model/Observer.php CHANGED
@@ -1,10 +1,6 @@
1
  <?php
2
  class Skuiq_SendSaleInfo_Model_Observer
3
  {
4
- /**
5
- * Magento passes a Varien_Event_Observer object as
6
- * the first parameter of dispatched events.
7
- */
8
  public function sendSale(Varien_Event_Observer $observer)
9
  {
10
  Mage::log("THIS IS A SALE been updated", null, 'product-updates.txt');
@@ -16,18 +12,14 @@ class Skuiq_SendSaleInfo_Model_Observer
16
  $incrementId = $order->getIncrementId();
17
  $ordered_items = $order->getAllItems();
18
  $shippingAddress = $order->getShippingAddress();
19
- //$items = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
20
-
21
  foreach($ordered_items as $i):
22
- //$item_sku = $i->getProductId();
23
- //$items = $i;
24
- //Mage::log("{$item_sku}. INFO", null, 'orders.txt');
25
  $ordered_items = Mage::helper('core')->jsonEncode($i);
26
  $item[] = $ordered_items;
27
  endforeach;
28
 
29
  $json_order = Mage::helper('core')->jsonEncode($order);
30
- $json_order_items = $item; //Mage::helper('core')->jsonEncode($item);
31
  $json_ship_add = Mage::helper('core')->jsonEncode($shippingAddress);
32
 
33
  $client->setHeaders('Content-type', 'application/json');
@@ -55,8 +47,25 @@ class Skuiq_SendSaleInfo_Model_Observer
55
  }
56
  };
57
  $shipId = serialize($tracknums);
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  $client->setHeaders('Content-type', 'application/json');
 
 
 
 
 
60
  $client->setParameterPost('order_id', $last_orderid);
61
  $client->setParameterPost('status', $order_status);
62
  $client->setParameterPost('tracking', $shipId);
1
  <?php
2
  class Skuiq_SendSaleInfo_Model_Observer
3
  {
 
 
 
 
4
  public function sendSale(Varien_Event_Observer $observer)
5
  {
6
  Mage::log("THIS IS A SALE been updated", null, 'product-updates.txt');
12
  $incrementId = $order->getIncrementId();
13
  $ordered_items = $order->getAllItems();
14
  $shippingAddress = $order->getShippingAddress();
15
+
 
16
  foreach($ordered_items as $i):
 
 
 
17
  $ordered_items = Mage::helper('core')->jsonEncode($i);
18
  $item[] = $ordered_items;
19
  endforeach;
20
 
21
  $json_order = Mage::helper('core')->jsonEncode($order);
22
+ $json_order_items = $item;
23
  $json_ship_add = Mage::helper('core')->jsonEncode($shippingAddress);
24
 
25
  $client->setHeaders('Content-type', 'application/json');
47
  }
48
  };
49
  $shipId = serialize($tracknums);
50
+
51
+ $ordered_items = $order->getAllItems();
52
+ foreach($ordered_items as $i):
53
+ $ordered_items = Mage::helper('core')->jsonEncode($i);
54
+ $item[] = $ordered_items;
55
+ endforeach;
56
+ $shippingAddress = $order->getShippingAddress();
57
+
58
+
59
+ $json_order = Mage::helper('core')->jsonEncode($order);
60
+ $json_order_items = $item;
61
+ $json_ship_add = Mage::helper('core')->jsonEncode($shippingAddress);
62
 
63
  $client->setHeaders('Content-type', 'application/json');
64
+ $client->setParameterPost('base_url', $base_url);
65
+ $client->setParameterPost('order', $json_order);
66
+ $client->setParameterPost('items', $json_order_items);
67
+ $client->setParameterPost('ship_add', $json_ship_add);
68
+
69
  $client->setParameterPost('order_id', $last_orderid);
70
  $client->setParameterPost('status', $order_status);
71
  $client->setParameterPost('tracking', $shipId);
app/code/local/Skuiq/SimpleConfigRelation/.DS_Store ADDED
Binary file
package.xml CHANGED
@@ -1,18 +1,19 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>SKUIQ</name>
4
- <version>1.2.3</version>
5
  <stability>stable</stability>
6
  <license>Open</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Allows sync of products and sales from Magento to SKU IQ</summary>
10
  <description>Allows sync of products and sales from Magento to SKU IQ</description>
11
- <notes>Additional code to improve functionality of adding children to configurable products</notes>
 
12
  <authors><author><name>Boutiika Labs</name><user>SKUIQ</user><email>dev@skuiq.com</email></author></authors>
13
- <date>2015-03-24</date>
14
- <time>03:34:20</time>
15
- <contents><target name="magelocal"><dir name="Skuiq"><dir name="LogProductUpdate"><dir name="Model"><file name="Observer.php" hash="b21325c560e161e8522c7cdcdd3fb289"/></dir><dir name="etc"><file name="config.xml" hash="362ccb945d56d0e09bc64bdec4d7b2e8"/></dir></dir><dir name="SendSaleInfo"><dir name="Model"><file name="Observer.php" hash="dbc07f52c96bd3831e875df0135ea60a"/></dir><dir name="etc"><file name="config.xml" hash="9499133489324d19dc03c2a8f7a95e3e"/></dir></dir><dir name="SimpleConfigRelation"><dir name="Helper"><file name="Data.php" hash="3ef946f780001355f51a05c238c14886"/></dir><dir name="Model"><file name="Api.php" hash="89df86ac4009ebbb5c16f0da051e423a"/></dir><dir name="etc"><file name="api.xml" hash="4cc6bbf973cd7d7af47c6ea14af1e927"/><file name="config.xml" hash="1e37ab2f32d83b47ada846be90083f2a"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Skuiq_LogProductUpdate.xml" hash="6dbf41f8fd94ccccdd630f978a85b9ac"/><file name="Skuiq_SendSaleInfo.xml" hash="111d7a25f091d22b0ee6da65c3a8c58b"/><file name="Skuiq_SimpleConfigRelation.xml" hash="1a7141d7f82993c75e5e40e7a7df4ded"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.0.0</min><max>5.6.2</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>SKUIQ</name>
4
+ <version>1.2.4</version>
5
  <stability>stable</stability>
6
  <license>Open</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Allows sync of products and sales from Magento to SKU IQ</summary>
10
  <description>Allows sync of products and sales from Magento to SKU IQ</description>
11
+ <notes>Improved credit Memo functionality&#xD;
12
+ Improved Sales tracking</notes>
13
  <authors><author><name>Boutiika Labs</name><user>SKUIQ</user><email>dev@skuiq.com</email></author></authors>
14
+ <date>2015-05-08</date>
15
+ <time>14:07:00</time>
16
+ <contents><target name="magelocal"><dir name="Skuiq"><dir name="LogProductUpdate"><dir name="Model"><file name="Observer.php" hash="4139bef98f261ecd807d8bdb2e25ea2d"/></dir><dir name="etc"><file name="config.xml" hash="362ccb945d56d0e09bc64bdec4d7b2e8"/></dir><file name=".DS_Store" hash="5c077e7e7765c52ee6bd8ea1883d84d5"/></dir><dir name="SendSaleInfo"><dir name="Model"><file name="Observer.php" hash="d09cf09a101c3eb5e3342125714f6141"/></dir><dir name="etc"><file name="config.xml" hash="9499133489324d19dc03c2a8f7a95e3e"/></dir></dir><dir name="SimpleConfigRelation"><dir name="Helper"><file name="Data.php" hash="3ef946f780001355f51a05c238c14886"/></dir><dir name="Model"><file name="Api.php" hash="89df86ac4009ebbb5c16f0da051e423a"/></dir><dir name="etc"><file name="api.xml" hash="4cc6bbf973cd7d7af47c6ea14af1e927"/><file name="config.xml" hash="1e37ab2f32d83b47ada846be90083f2a"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="a6a932afdb7ee0835203a6b123a2c898"/></dir></target><target name="mageetc"><dir name="modules"><file name="Skuiq_LogProductUpdate.xml" hash="6dbf41f8fd94ccccdd630f978a85b9ac"/><file name="Skuiq_SendSaleInfo.xml" hash="111d7a25f091d22b0ee6da65c3a8c58b"/><file name="Skuiq_SimpleConfigRelation.xml" hash="1a7141d7f82993c75e5e40e7a7df4ded"/></dir></target></contents>
17
  <compatible/>
18
  <dependencies><required><php><min>5.0.0</min><max>5.6.2</max></php></required></dependencies>
19
  </package>