Auctane_ShipStation - Version 1.3.45

Version Notes

Official release.



Compatibility with php running as cgi, allows exporting base or store price.

Download this release

Release Info

Developer Classy Llama
Extension Auctane_ShipStation
Version 1.3.45
Comparing to
See all releases


Code changes from version 1.3.42 to 1.3.45

app/code/community/Auctane/Api/Model/Action/Export.php CHANGED
@@ -83,7 +83,13 @@ class Auctane_Api_Model_Action_Export
83
  $xml->startElement('Orders');
84
  $xml->writeAttribute('pages', $orders->getLastPageNumber());
85
  foreach ($orders as $order) {
86
- $this->_writeOrder($order, $xml, $storeId);
 
 
 
 
 
 
87
  }
88
  $xml->startElement('Query');
89
  $xml->writeCdata($orders->getSelectSql());
@@ -157,7 +163,12 @@ class Auctane_Api_Model_Action_Export
157
 
158
  /* @var $item Mage_Sales_Model_Order_Item */
159
  foreach ($order->getItemsCollection($helper->getIncludedProductTypes()) as $item) {
160
- $isBundle = 0;
 
 
 
 
 
161
  //Check for the parent bundle item type
162
  $parentItem = $this->_getOrderItemParent($item);
163
  if ($parentItem->getProductType() === 'bundle') {
@@ -171,14 +182,24 @@ class Auctane_Api_Model_Action_Export
171
  }
172
 
173
  $intImportDiscount = Mage::getStoreConfig('auctaneapi/general/import_discounts');
174
- if ($intImportDiscount != 2) { // Import Discount is true
 
 
175
  $discounts = array();
 
176
  if ($order->getData('auctaneapi_discounts')) {
177
  $discounts = unserialize($order->getData('auctaneapi_discounts'));
178
  if (is_array($discounts)) {
179
  $aggregated = array();
180
  foreach ($discounts as $key => $discount) {
181
  $keyData = explode('-', $key);
 
 
 
 
 
 
 
182
  if (isset($aggregated[$keyData[0]])) {
183
  $aggregated[$keyData[0]] += $discount;
184
  } else {
@@ -207,7 +228,6 @@ class Auctane_Api_Model_Action_Export
207
  if ($item->getParentItemId() && !$item->getParentItem()) {
208
  $item->setParentItem(Mage::getModel('sales/order_item')->load($item->getParentItemId()));
209
  }
210
-
211
  $exclude = Mage::helper('auctaneapi')->isExcludedProductType($item->getParentItem()->getProductType());
212
  // only inherit if parent has been hidden
213
  if ($item->getParentItem() && ($item->getPrice() == 0.000) && $exclude) {
83
  $xml->startElement('Orders');
84
  $xml->writeAttribute('pages', $orders->getLastPageNumber());
85
  foreach ($orders as $order) {
86
+ // check if shipping info is available with order.
87
+ $orderShipping = $order->getShippingDescription();
88
+ if ($orderShipping) {
89
+ $this->_writeOrder($order, $xml, $storeId);
90
+ } else {
91
+ continue;
92
+ }
93
  }
94
  $xml->startElement('Query');
95
  $xml->writeCdata($orders->getSelectSql());
163
 
164
  /* @var $item Mage_Sales_Model_Order_Item */
165
  foreach ($order->getItemsCollection($helper->getIncludedProductTypes()) as $item) {
166
+ // skip the virtual products.
167
+ $isVirtual = $item->getIsVirtual();
168
+ if ($isVirtual) {
169
+ continue;
170
+ }
171
+ $isBundle = 0;
172
  //Check for the parent bundle item type
173
  $parentItem = $this->_getOrderItemParent($item);
174
  if ($parentItem->getProductType() === 'bundle') {
182
  }
183
 
184
  $intImportDiscount = Mage::getStoreConfig('auctaneapi/general/import_discounts');
185
+ $fltOrderDiscount = $order->getDiscountAmount();
186
+ if ($intImportDiscount != 2 && $fltOrderDiscount != 0.0000) {
187
+ // Import Discount is true
188
  $discounts = array();
189
+ $processed = array();
190
  if ($order->getData('auctaneapi_discounts')) {
191
  $discounts = unserialize($order->getData('auctaneapi_discounts'));
192
  if (is_array($discounts)) {
193
  $aggregated = array();
194
  foreach ($discounts as $key => $discount) {
195
  $keyData = explode('-', $key);
196
+ //check the duplication of rule for each item.
197
+ $itemRule = $keyData[0].'-'.$keyData[1];
198
+ if(in_array($itemRule, $processed)) {
199
+ continue;
200
+ } else {
201
+ $processed[] = $itemRule;
202
+ }
203
  if (isset($aggregated[$keyData[0]])) {
204
  $aggregated[$keyData[0]] += $discount;
205
  } else {
228
  if ($item->getParentItemId() && !$item->getParentItem()) {
229
  $item->setParentItem(Mage::getModel('sales/order_item')->load($item->getParentItemId()));
230
  }
 
231
  $exclude = Mage::helper('auctaneapi')->isExcludedProductType($item->getParentItem()->getProductType());
232
  // only inherit if parent has been hidden
233
  if ($item->getParentItem() && ($item->getPrice() == 0.000) && $exclude) {
app/code/community/Auctane/Api/Model/Action/Shipnotify.php CHANGED
@@ -31,7 +31,7 @@ class Auctane_Api_Model_Action_Shipnotify
31
  // Raw XML is POSTed to this stream
32
  $xml = simplexml_load_file('php://input');
33
  // load some objects
34
- $order = $this->_getOrder($xml->OrderNumber);
35
  $qtys = $this->_getOrderItemQtys($xml->Items, $order);
36
  $shipment = $this->_getOrderShipment($order, $qtys);
37
 
@@ -157,10 +157,17 @@ class Auctane_Api_Model_Action_Shipnotify
157
  continue;
158
  }
159
  // search for item by SKU
160
- list($xmlItem) = $xmlItems->xpath(sprintf('//Item/SKU[text()="%s"]/..', addslashes($item->getSku())));
161
- if ($xmlItem) {
162
- // store quantity by order item ID, not by SKU
163
- $qtys[$item->getId()] = (float) $xmlItem->Quantity;
 
 
 
 
 
 
 
164
  }
165
  }
166
  //Add child products into the shipments
31
  // Raw XML is POSTed to this stream
32
  $xml = simplexml_load_file('php://input');
33
  // load some objects
34
+ $order = $this->_getOrder($xml->OrderID);
35
  $qtys = $this->_getOrderItemQtys($xml->Items, $order);
36
  $shipment = $this->_getOrderShipment($order, $qtys);
37
 
157
  continue;
158
  }
159
  // search for item by SKU
160
+ $sku = addslashes($item->getSku());
161
+ $xmlItemResult = $xmlItems->xpath(
162
+ sprintf('//Item/SKU[text()="%s"]/..', $sku)
163
+ );
164
+ //list($xmlItem) = $xmlItems->xpath(sprintf('//Item/SKU[text()="%s"]/..', addslashes($item->getSku())));
165
+ if (!empty($xmlItemResult)) {
166
+ list($xmlItem) = $xmlItemResult;
167
+ if ($xmlItem) {
168
+ // store quantity by order item ID, not by SKU
169
+ $qtys[$item->getId()] = (float) $xmlItem->Quantity;
170
+ }
171
  }
172
  }
173
  //Add child products into the shipments
app/code/community/Auctane/Api/Model/Observer.php CHANGED
@@ -100,5 +100,22 @@ class Auctane_Api_Model_Observer
100
 
101
  $quote->setAuctaneapiDiscounts(serialize($discounts));
102
  }
103
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  }
100
 
101
  $quote->setAuctaneapiDiscounts(serialize($discounts));
102
  }
103
+
104
+ /**
105
+ * Update the discount from the quote.
106
+ * @param Varien_Event_Observer $observer
107
+ */
108
+ public function salesQuoteSave($observer)
109
+ {
110
+ $quote = $observer->getQuote();
111
+ // check the rule applied to the order.
112
+ $strRuleId = $quote->getAppliedRuleIds();
113
+ if (!$strRuleId || $strRuleId == NULL) {
114
+ // unset if discounts are all ready set.
115
+ $discounts = unserialize($quote->getAuctaneapiDiscounts());
116
+ if ($discounts) {
117
+ $quote->setAuctaneapiDiscounts('');
118
+ }
119
+ }
120
+ }
121
  }
app/code/community/Auctane/Api/etc/config.xml CHANGED
@@ -19,7 +19,7 @@
19
  <config>
20
  <modules>
21
  <Auctane_Api>
22
- <version>1.3.42</version>
23
  </Auctane_Api>
24
  </modules>
25
  <global>
@@ -31,7 +31,15 @@
31
  <method>salesruleProcess</method>
32
  </auctaneapi_salesrule_process>
33
  </observers>
34
- </salesrule_validator_process>
 
 
 
 
 
 
 
 
35
  </events>
36
  <helpers>
37
  <auctaneapi>
19
  <config>
20
  <modules>
21
  <Auctane_Api>
22
+ <version>1.3.45</version>
23
  </Auctane_Api>
24
  </modules>
25
  <global>
31
  <method>salesruleProcess</method>
32
  </auctaneapi_salesrule_process>
33
  </observers>
34
+ </salesrule_validator_process>
35
+ <sales_quote_save_before>
36
+ <observers>
37
+ <auctaneapi_quote_save>
38
+ <class>auctaneapi/observer</class>
39
+ <method>salesQuoteSave</method>
40
+ </auctaneapi_quote_save>
41
+ </observers>
42
+ </sales_quote_save_before>
43
  </events>
44
  <helpers>
45
  <auctaneapi>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Auctane_ShipStation</name>
4
- <version>1.3.42</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
@@ -12,9 +12,9 @@
12
  &amp;amp;amp;amp;amp;amp;amp;#xD;&amp;amp;amp;amp;amp;amp;#xD;&amp;amp;amp;amp;amp;#xD;&amp;amp;amp;amp;#xD;&amp;amp;amp;#xD;&amp;amp;#xD;&amp;#xD;&#xD;
13
  Compatibility with php running as cgi, allows exporting base or store price.</notes>
14
  <authors><author><name>Classy Llama</name><user>classyllama</user><email>info@classyllama.com</email></author></authors>
15
- <date>2016-02-05</date>
16
- <time>12:09:26</time>
17
- <contents><target name="mageetc"><dir name="modules"><file name="Auctane_Api.xml" hash="a95e2ff4d2c0c0e9dbd33fa50d1fdff8"/></dir></target><target name="magecommunity"><dir name="Auctane"><dir name="Api"><file name="CHANGELOG.txt" hash="ac302cdb9f343e0ec036b7a846294235"/><dir name="Helper"><file name="Data.php" hash="cf9c04c83f3bacb3c2a78aad2a53a81c"/></dir><file name="LICENSE.html" hash="caf0a79ffb5e4719f9f4de286f253a61"/><file name="LICENSE.txt" hash="34410d4f566fdc33f094525a2d9865fa"/><file name="LICENSE_AFL.txt" hash="0e3cb8112c018920eee7a316a2a69103"/><dir name="Model"><dir name="Action"><file name="Export.php" hash="68436b0ceb2b2e7abf107808922826aa"/><file name="Shipnotify.php" hash="f512dfb8c5cde4e3fa15da7e29b4499e"/></dir><file name="Observer.php" hash="60445facb51142a030ea9944872fa98a"/><dir name="Server"><file name="Adapter.php" hash="cbdb6c050722cf96bb0e424a3e4dc327"/></dir><dir name="System"><dir name="Source"><dir name="Config"><file name="Customattributes.php" hash="b8b4ea3c5c349e872de93c1dbfcc4171"/><file name="Import.php" hash="bed3f5935efde27705589afc448d5dd4"/><file name="Prices.php" hash="203d324934d8cfe0776a0ce764dc118d"/></dir></dir></dir></dir><dir name="controllers"><file name="AuctaneController.php" hash="ae73284a10d84540591b4ff9ad0814dd"/></dir><dir name="etc"><file name="api.xml" hash="41c92fc762da05e68b19f0eaf3100260"/><file name="config.xml" hash="30628807c0db9c3d8b306089affe9a30"/><file name="system.xml" hash="098b6f441ea56ca687fc1bf9f90d2d56"/></dir><dir name="sql"><dir name="auctaneapi_setup"><file name="mysql4-install-1.3.11.php" hash="17aa8f981f75f1e1d62e8dbdde2f950d"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="auctaneapi"><dir name="css"><file name="master.css" hash="0b35fa9797b3bd868b3725a85d4347af"/></dir><dir name="images"><file name="auctaneapi.png" hash="294d531f2f4f6dd85bdccd124a3057f6"/><file name="btn_bl.png" hash="093ac74aedfd1dd0addbfac3a19ced95"/><file name="header.png" hash="9228dfeb910aa6f3141d40966a6dba32"/><file name="tabs_span_bg.gif" hash="bcabd4fea0d67b181f21779564c2284b"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="auctaneapi.xml" hash="a6fe62d8258e423bee3a129165c0d313"/></dir></dir></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Auctane_ShipStation</name>
4
+ <version>1.3.45</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
12
  &amp;amp;amp;amp;amp;amp;amp;#xD;&amp;amp;amp;amp;amp;amp;#xD;&amp;amp;amp;amp;amp;#xD;&amp;amp;amp;amp;#xD;&amp;amp;amp;#xD;&amp;amp;#xD;&amp;#xD;&#xD;
13
  Compatibility with php running as cgi, allows exporting base or store price.</notes>
14
  <authors><author><name>Classy Llama</name><user>classyllama</user><email>info@classyllama.com</email></author></authors>
15
+ <date>2016-06-14</date>
16
+ <time>10:21:34</time>
17
+ <contents><target name="mageetc"><dir name="modules"><file name="Auctane_Api.xml" hash="a95e2ff4d2c0c0e9dbd33fa50d1fdff8"/></dir></target><target name="magecommunity"><dir name="Auctane"><dir name="Api"><file name="CHANGELOG.txt" hash="ac302cdb9f343e0ec036b7a846294235"/><dir name="Helper"><file name="Data.php" hash="cf9c04c83f3bacb3c2a78aad2a53a81c"/></dir><file name="LICENSE.html" hash="caf0a79ffb5e4719f9f4de286f253a61"/><file name="LICENSE.txt" hash="34410d4f566fdc33f094525a2d9865fa"/><file name="LICENSE_AFL.txt" hash="0e3cb8112c018920eee7a316a2a69103"/><dir name="Model"><dir name="Action"><file name="Export.php" hash="dd4521afd67eb5a616b4d337187e200e"/><file name="Shipnotify.php" hash="496a7fbeef43854480c06ac50d4eeeef"/></dir><file name="Observer.php" hash="e16263badac8fbd55aa2cb6a9ee5c537"/><dir name="Server"><file name="Adapter.php" hash="cbdb6c050722cf96bb0e424a3e4dc327"/></dir><dir name="System"><dir name="Source"><dir name="Config"><file name="Customattributes.php" hash="b8b4ea3c5c349e872de93c1dbfcc4171"/><file name="Import.php" hash="bed3f5935efde27705589afc448d5dd4"/><file name="Prices.php" hash="203d324934d8cfe0776a0ce764dc118d"/></dir></dir></dir></dir><dir name="controllers"><file name="AuctaneController.php" hash="ae73284a10d84540591b4ff9ad0814dd"/></dir><dir name="etc"><file name="api.xml" hash="41c92fc762da05e68b19f0eaf3100260"/><file name="config.xml" hash="1d78b9df47f5a535aa044b4d6c926df1"/><file name="system.xml" hash="098b6f441ea56ca687fc1bf9f90d2d56"/></dir><dir name="sql"><dir name="auctaneapi_setup"><file name="mysql4-install-1.3.11.php" hash="17aa8f981f75f1e1d62e8dbdde2f950d"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="auctaneapi"><dir name="css"><file name="master.css" hash="0b35fa9797b3bd868b3725a85d4347af"/></dir><dir name="images"><file name="auctaneapi.png" hash="294d531f2f4f6dd85bdccd124a3057f6"/><file name="btn_bl.png" hash="093ac74aedfd1dd0addbfac3a19ced95"/><file name="header.png" hash="9228dfeb910aa6f3141d40966a6dba32"/><file name="tabs_span_bg.gif" hash="bcabd4fea0d67b181f21779564c2284b"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="auctaneapi.xml" hash="a6fe62d8258e423bee3a129165c0d313"/></dir></dir></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>