ShipWorks_Multi_Carrier_Shipping_Software - Version 3.10.1

Version Notes

Updated to support Magento Community and Enterprise

Download this release

Release Info

Developer ShipWorks
Extension ShipWorks_Multi_Carrier_Shipping_Software
Version 3.10.1
Comparing to
See all releases


Version 3.10.1

app/code/local/Interapptive/ShipWorks/Helper/Data.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Interapptive_ShipWorks_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+
7
+ }
8
+
9
+
10
+ ?>
app/code/local/Interapptive/ShipWorks/Model/ItemAttributes.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Interapptive_ShipWorks_Model_ItemAttributes
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ $attributes = Mage::getSingleton('eav/config')->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection();
8
+ $attributeArray = array();
9
+
10
+ $attributeArray['None'] = 'None';
11
+
12
+ foreach($attributes as $attribute)
13
+ {
14
+ if($attribute->getFrontendLabel() != '')
15
+ {
16
+ $attributeArray[$attribute->getAttributeCode()] = $attribute->getFrontendLabel();
17
+ }
18
+ }
19
+ return $attributeArray;
20
+ }
21
+
22
+
23
+ }
app/code/local/Interapptive/ShipWorks/Model/Objectmodel/Api.php ADDED
@@ -0,0 +1,958 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ error_reporting(E_ALL);
4
+
5
+ class Interapptive_ShipWorks_Model_ObjectModel_Api extends Mage_Api_Model_Resource_Abstract
6
+ {
7
+ public $output = '';
8
+ public $schemaVersion = "1.0.0";
9
+
10
+ // Tests the Magento version to see if it's greater than or equal to the targetVersion
11
+ function MagentoVersionGreaterOrEqualTo($targetVersion)
12
+ {
13
+ $mageVersion = Mage::getVersion();
14
+
15
+ $currentParts = preg_split('[\.]', $mageVersion);
16
+ $targetParts = preg_split('[\.]', $targetVersion);
17
+
18
+ $i = 0;
19
+ foreach ($currentParts as $currentPart)
20
+ {
21
+ if ($i >= count($targetParts))
22
+ {
23
+ // gotten this far, means that current version of 1.4.0.1 > target version 1.4.0
24
+ return true;
25
+ }
26
+
27
+ $targetPart = $targetParts[$i];
28
+
29
+ // if this iteration's target version part is greater than the magento version part, we're done.
30
+ if ((int)$targetPart > (int)$currentPart)
31
+ {
32
+ return false;
33
+ }
34
+ else if ((int)$targetPart < (int)$currentPart)
35
+ {
36
+ // the magento version part is greater, then we're done
37
+ return true;
38
+ }
39
+
40
+
41
+ // otherwise to this point the two are equal, continue
42
+ $i++;
43
+ }
44
+
45
+ // got this far means the two are equal
46
+ return true;
47
+ }
48
+
49
+
50
+ // Function used to output an error and quit.
51
+ function outputError($code, $error)
52
+ {
53
+ $this->writeStartTag("Error");
54
+ $this->writeElement("Code", $code);
55
+ $this->writeElement("Description", $error);
56
+ $this->writeCloseTag("Error");
57
+ }
58
+
59
+
60
+ // Writes the start xml tag
61
+ public function writeStartTag($tag, $attributes = null)
62
+ {
63
+ $this->output .= '<' . $tag;
64
+
65
+ if ($attributes != null)
66
+ {
67
+ $this->output .= ' ';
68
+
69
+ foreach ($attributes as $name => $attribValue)
70
+ {
71
+ $this->output .= $name. '="'. htmlspecialchars($attribValue). '" ';
72
+ }
73
+ }
74
+
75
+ $this->output .= '>';
76
+ }
77
+
78
+ // write xml documenta declaration
79
+ function writeXmlDeclaration()
80
+ {
81
+ $this->output .= "<?xml version=\"1.0\" standalone=\"yes\" ?>";
82
+ }
83
+
84
+ // write closing xml tag
85
+ function writeCloseTag($tag)
86
+ {
87
+ $this->output .= '</' . $tag . '>';
88
+ }
89
+
90
+ // Output the given tag\value pair
91
+ function writeElement($tag, $value)
92
+ {
93
+ $this->writeStartTag($tag);
94
+ $this->output .= htmlspecialchars($value);
95
+ $this->writeCloseTag($tag);
96
+ }
97
+
98
+ // Outputs the given name/value pair as an xml tag with attributes
99
+ function writeFullElement($tag, $value, $attributes)
100
+ {
101
+ $this->output .= '<'. $tag. ' ';
102
+
103
+ foreach ($attributes as $name => $attribValue)
104
+ {
105
+ $this->output .= $name. '="'. htmlspecialchars($attribValue). '" ';
106
+ }
107
+ $this->output .= '>';
108
+ $this->output .= htmlspecialchars($value);
109
+
110
+ $this->writeCloseTag($tag);
111
+ }
112
+
113
+ // Converts an xml datetime string to sql date time
114
+ function toLocalSqlDate($sqlUtc)
115
+ {
116
+ $pattern = "/^(\d{4})-(\d{2})-(\d{2})\T(\d{2}):(\d{2}):(\d{2})$/i";
117
+
118
+ if (preg_match($pattern, $sqlUtc, $dt))
119
+ {
120
+ $unixUtc = gmmktime($dt[4], $dt[5], $dt[6], $dt[2], $dt[3], $dt[1]);
121
+
122
+ return date("Y-m-d H:i:s", $unixUtc);
123
+ }
124
+
125
+ return $sqlUtc;
126
+ }
127
+
128
+
129
+
130
+ // writes the opening ShipWorks tag
131
+ public function writeShipWorksStart()
132
+ {
133
+ $version = Mage::getModel("ShipWorks/Version")->getModuleVersion();
134
+
135
+ $this->writeStartTag("ShipWorks", array("moduleVersion" => $version, "schemaVersion" => $this->schemaVersion));
136
+ }
137
+
138
+ // gets module capabilities
139
+ public function getModule()
140
+ {
141
+ $this->output = '';
142
+
143
+ $this->writeXmlDeclaration();
144
+ $this->writeShipWorksStart();
145
+
146
+ $this->writeStartTag("Module");
147
+
148
+ $this->writeElement("Platform", "Magento");
149
+ $this->writeElement("Developer", "Interapptive, Inc. (support@interapptive.com)");
150
+
151
+ $this->writeStartTag("Capabilities");
152
+ $this->writeElement("DownloadStrategy", "ByModifiedTime");
153
+ $this->writeFullElement("OnlineCustomerID", "", array("supported" => "true", "dataType" => "numeric"));
154
+ $this->writeFullElement("OnlineStatus", "", array("supported" => "true", "dataType" => "text", "downloadOnly" => "true" ));
155
+ $this->writeFullElement("OnlineShipmentUpdate", "", array("supported" => "false"));
156
+ $this->writeCloseTag("Capabilities");
157
+
158
+ $this->writeCloseTag("Module");
159
+ $this->writeCloseTag("ShipWorks");
160
+
161
+ return $this->output;
162
+ }
163
+
164
+ // Write store data
165
+ public function getStore()
166
+ {
167
+ $this->output = '';
168
+
169
+ // get state name
170
+ $region_model = Mage::getModel('directory/region');
171
+ if (is_object($region_model))
172
+ {
173
+ $state = $region_model->load(Mage::getStoreConfig('shipping/origin/region_id'))->getDefaultName();
174
+ }
175
+
176
+ $name = Mage::getStoreConfig('system/store/name');
177
+ $owner = Mage::getStoreConfig('trans_email/ident_general/name');
178
+ $email = Mage::getStoreConfig('trans_email/ident_general/email');
179
+ $country = Mage::getStoreConfig('shipping/origin/country_id');
180
+ $website = Mage::getURL();
181
+
182
+ $this->writeShipWorksStart();
183
+ $this->writeStartTag("Store");
184
+ $this->writeElement("Name", $name);
185
+ $this->writeElement("CompanyOrOwner", $owner);
186
+ $this->writeElement("Email", $email);
187
+ $this->writeElement("State", $state);
188
+ $this->writeElement("Country", $country);
189
+ $this->writeElement("Website", $website);
190
+ $this->writeCloseTag("Store");
191
+
192
+ $this->writeCloseTag("ShipWorks");
193
+
194
+ return $this->output;
195
+ }
196
+
197
+ // goes from a store Code to its ID
198
+ function StoreIdFromCode($storeCode)
199
+ {
200
+ if ($storeCode == '')
201
+ {
202
+ return Mage::app()->getDefaultStoreView()->getId();
203
+ }
204
+ foreach (Mage::app()->getStores() as $store)
205
+ {
206
+ if ($store->getCode() == $storeCode)
207
+ {
208
+ return $store->getId();
209
+ }
210
+ }
211
+
212
+ return 0;
213
+ }
214
+
215
+
216
+ // Converts a sql data string to xml date format
217
+ function FormatDate($dateSql)
218
+ {
219
+ $pattern = "/^(\d{4})-(\d{2})-(\d{2})\s+(\d{2}):(\d{2}):(\d{2})$/i";
220
+
221
+ if (preg_match($pattern, $dateSql, $dt))
222
+ {
223
+ $dateUnix = mktime($dt[4], $dt[5], $dt[6], $dt[2], $dt[3], $dt[1]);
224
+ return gmdate("Y-m-d\TH:i:s", $dateUnix);
225
+ }
226
+
227
+ return $dateSql;
228
+ }
229
+
230
+ // Write XML for all products for the given order
231
+ function WriteOrderItems($orderItems, $storeCode)
232
+ {
233
+ $storeId = $this->StoreIdFromCode($storeCode);
234
+
235
+ $this->writeStartTag("Items");
236
+
237
+ $parentMap = Array();
238
+
239
+ // go through each item in the collection
240
+ foreach ($orderItems as $item)
241
+ {
242
+ // keep track of item Id and types
243
+ $parentMap[$item->getItemId()] = $item->getProductType();
244
+
245
+ // get the sku
246
+ if ($item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE)
247
+ {
248
+ $sku = $item->getProductOptionByCode('simple_sku');
249
+ }
250
+ else
251
+ {
252
+ $sku = $item->getSku();
253
+ }
254
+
255
+ // weights are handled differently if the item is a bundle or part of a bundle
256
+ $weight = $item->getWeight();
257
+ if ($item->getIsVirtual())
258
+ {
259
+ $weight = 0;
260
+ }
261
+
262
+ if ($item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE)
263
+ {
264
+ $name = $item->getName(). " (bundle)";
265
+ $unitPrice = $this->getCalculationPrice($item);
266
+ }
267
+ else
268
+ {
269
+ $name = $item->getName();
270
+
271
+ // if it's part of a bundle
272
+ if (is_null($item->getParentItemId()))
273
+ {
274
+ $unitPrice = $this->getCalculationPrice($item);
275
+ }
276
+ else
277
+ {
278
+ // need to see if the parent is a bundle or not
279
+ $isBundle = ($parentMap[$item->getParentItemId()] == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE);
280
+ if ($isBundle)
281
+ {
282
+ // it's a bundle member - price and weight come from the bundle definition itself
283
+ $unitPrice = 0;
284
+ $weight = 0;
285
+ }
286
+ else
287
+ {
288
+ // don't even want to include if the parent item is anything but a bundle
289
+ continue;
290
+ }
291
+ }
292
+ }
293
+
294
+ // Magento 1.4+ has Cost
295
+ $unitCost = 0;
296
+ if ($this->MagentoVersionGreaterOrEqualTo('1.4.0') && $item->getBaseCost() > 0)
297
+ {
298
+ $unitCost = $item->getBaseCost();
299
+ }
300
+ else if ($this->MagentoVersionGreaterOrEqualTo('1.3.0'))
301
+ {
302
+ // Magento 1.3 didn't seem to copy Cost to the item from the product
303
+ // fallback to the Cost defined on the product.
304
+
305
+ $product = Mage::getModel('catalog/product');
306
+ $productId = $item->getProductId();
307
+ $product->load($productId);
308
+
309
+ if ($product->getCost() > 0)
310
+ {
311
+ $unitCost = $product->getCost();
312
+ }
313
+ }
314
+
315
+ $product = Mage::getModel('catalog/product');
316
+ $productId = $item->getProductId();
317
+ $product->load($productId);
318
+
319
+
320
+ $this->writeStartTag("Item");
321
+
322
+ $this->writeElement("ItemID", $item->getItemId());
323
+ $this->writeElement("ProductID", $item->getProductId());
324
+
325
+ //Pull Code based on what is set in admin
326
+ if(Mage::getStoreConfig('shipWorksApi/mapping/Code',$storeId) != 'None')
327
+ {
328
+ $codeCode = Mage::getStoreConfig('shipWorksApi/mapping/Code',$storeId);
329
+ $this->writeElement("Code", $product->getData($codeCode));
330
+ }
331
+
332
+ $this->writeElement("SKU", $sku);
333
+ $this->writeElement("Name", $name);
334
+
335
+ //Pull Location based on what is set in admin
336
+ if(Mage::getStoreConfig('shipWorksApi/mapping/Location',$storeId) != 'None')
337
+ {
338
+ $locationCode = Mage::getStoreConfig('shipWorksApi/mapping/Location',$storeId);
339
+ $this->writeElement("Location", $product->getData($locationCode));
340
+ }
341
+
342
+ $this->writeElement("Name", $name);
343
+
344
+ $this->writeElement("Quantity", (int)$item->getQtyOrdered());
345
+ $this->writeElement("UnitPrice", $unitPrice);
346
+ $this->writeElement("UnitCost", $unitCost);
347
+
348
+ if (!$weight)
349
+ {
350
+ $weight = 0;
351
+ }
352
+ $this->writeElement("Weight", $weight);
353
+
354
+
355
+ $this->writeStartTag("Attributes");
356
+
357
+
358
+ //Pull Attributes based on what is set in admin
359
+ $attributeOneCode = Mage::getStoreConfig('shipWorksApi/mapping/AttributeOne',$storeId);
360
+ $attributeTwoCode = Mage::getStoreConfig('shipWorksApi/mapping/AttributeTwo',$storeId);
361
+ $attributeThreeCode = Mage::getStoreConfig('shipWorksApi/mapping/AttributeThree',$storeId);
362
+
363
+ $customAttributesArray = array($attributeOneCode,$attributeTwoCode,$attributeThreeCode);
364
+
365
+ $attributes = Mage::getSingleton('eav/config')->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection()->addFieldToFilter('attribute_code',$customAttributesArray);
366
+
367
+ foreach($attributes as $attribute)
368
+ {
369
+ if($attribute->getFrontendLabel() != '' && $product->getData($attribute->getAttributeCode()) != '')
370
+ {
371
+ $this->writeStartTag("Attribute");
372
+ $this->writeElement("Name", $attribute->getFrontendLabel());
373
+ $this->writeElement("Value", $product->getData($attribute->getAttributeCode()));
374
+ $this->writeCloseTag("Attribute");
375
+ }
376
+ }
377
+
378
+ $opt = $item->getProductOptions();
379
+ if ($item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE)
380
+ {
381
+ if (is_array($opt) &&
382
+ isset($opt['attributes_info']) &&
383
+ is_array($opt['attributes_info']) &&
384
+ is_array($opt['info_buyRequest']) &&
385
+ is_array($opt['info_buyRequest']['super_attribute']))
386
+ {
387
+ $attr_id = $opt['info_buyRequest']['super_attribute'];
388
+ reset($attr_id);
389
+ foreach ($opt['attributes_info'] as $sub)
390
+ {
391
+ $this->writeStartTag("Attribute");
392
+ $this->writeElement("Name", $sub['label']);
393
+ $this->writeElement("Value", $sub['value']);
394
+ $this->writeCloseTag("Attribute");
395
+
396
+ next($attr_id);
397
+ }
398
+ }
399
+ }
400
+
401
+ if (is_array($opt) &&
402
+ isset($opt['options']) &&
403
+ is_array($opt['options']))
404
+ {
405
+ foreach ($opt['options'] as $sub)
406
+ {
407
+ $this->writeStartTag("Attribute");
408
+ $this->writeElement("Name", $sub['label']);
409
+ $this->writeElement("Value", $sub['value']);
410
+ $this->writeCloseTag("Attribute");
411
+ }
412
+ }
413
+
414
+ // Order-item level Gift Messages are created as item attributes in ShipWorks
415
+ if ($item->getGiftMessageId())
416
+ {
417
+ $message = Mage::helper('giftmessage/message')->getGiftMessage($item->getGiftMessageId());
418
+
419
+ // write the gift message as an attribute
420
+ $this->writeStartTag("Attribute");
421
+ $this->writeElement("Name", "Gift Message");
422
+ $this->writeelement("Value", $message['message']);
423
+ $this->writeCloseTag("Attribute");
424
+
425
+ // write the gift messgae recipient as an attribute
426
+ $this->writeStartTag("Attribute");
427
+ $this->writeElement("Name", "Gift Message, Recipient");
428
+ $this->writeelement("Value", $message['recipient']);
429
+ $this->writeCloseTag("Attribute");
430
+ }
431
+
432
+
433
+ // Uncomment the following lines to include a custom product attribute in the downloaded data.
434
+ // These will appear as Order Item Attributes in ShipWorks.
435
+ //$product = Mage::getModel('catalog/product');
436
+ //$productId = $product->getIdBySku($sku);
437
+ //$product->load($productId);
438
+ //$value = $product->getAttributeText("attribute_code_here");
439
+ //if ($value)
440
+ //{
441
+ // // write the gift message as an attribute
442
+ // writeStartTag("Attribute");
443
+ // writeElement("Name", "Attribute_title_here");
444
+ // writeelement("Value", $value);
445
+ // writeCloseTag("Attribute");
446
+ //}
447
+
448
+ $this->writeCloseTag("Attributes");
449
+
450
+ $this->writeCloseTag("Item");
451
+ }
452
+
453
+ $this->writeCloseTag("Items");
454
+ }
455
+
456
+ // Write all totals lines for the order
457
+ function WriteOrderTotals($order)
458
+ {
459
+ $this->writeStartTag("Totals");
460
+
461
+ $this->WriteOrderTotal("Order Subtotal", $order->getSubtotal(), "ot_subtotal", "none");
462
+ $this->WriteOrderTotal("Shipping and Handling", $order->getShippingAmount(), "shipping", "add");
463
+
464
+ if ($order->getTaxAmount() > 0)
465
+ {
466
+ $this->WriteOrderTotal("Tax", $order->getTaxAmount(), "tax", "add");
467
+ }
468
+
469
+ // Magento 1.4 started storing discounts as negative values
470
+ if ($this->MagentoVersionGreaterOrEqualTo('1.4.0') && $order->getDiscountAmount() < 0)
471
+ {
472
+ $couponcode = $order->getCouponCode();
473
+ $this->WriteOrderTotal("Discount ($couponcode)", -1 * $order->getDiscountAmount(), "discount", "subtract");
474
+ }
475
+
476
+ if (!$this->MagentoVersionGreaterOrEqualTo('1.4.0') && $order->getDiscountAmount() > 0)
477
+ {
478
+ $couponcode = $order->getCouponCode();
479
+ $this->WriteOrderTotal("Discount ($couponcode)", $order->getDiscountAmount(), "discount", "subtract");
480
+ }
481
+
482
+ if ($order->getGiftcertAmount() > 0)
483
+ {
484
+ $this->WriteOrderTotal("Gift Certificate", $order->getGiftcertAmount(), "giftcertificate", "subtract");
485
+ }
486
+
487
+ if ($order->getAdjustmentPositive())
488
+ {
489
+ $this->WriteOrderTotal("Adjustment Refund", $order->getAdjustmentPositive(), "refund", "subtract");
490
+ }
491
+
492
+ if ($order->getAdjustmentNegative())
493
+ {
494
+ $this->WriteOrderTotal("Adjustment Fee", $order->getAdjustmentPositive(), "fee", "add");
495
+ }
496
+
497
+ $this->WriteOrderTotal("Grand Total", $order->getGrandTotal(), "total", "none");
498
+
499
+ $this->writeCloseTag("Totals");
500
+ }
501
+
502
+ // writes a single order total
503
+ function WriteOrderTotal($name, $value, $class, $impact = "add")
504
+ {
505
+ if ($value > 0)
506
+ {
507
+ $this->writeFullElement("Total", $value, array("name" => $name, "class" => $class, "impact" => $impact));
508
+ }
509
+ }
510
+ // Gets the price of an order item
511
+ function getCalculationPrice($item)
512
+ {
513
+ if ($item instanceof Mage_Sales_Model_Order_Item)
514
+ {
515
+ if ($this->MagentoVersionGreaterOrEqualTo('1.3.0'))
516
+ {
517
+ return $item->getPrice();
518
+ }
519
+ else
520
+ {
521
+ if ($item->hasCustomPrice())
522
+ {
523
+ return $item->getCustomPrice();
524
+ }
525
+ else if ($item->hasOriginalPrice())
526
+ {
527
+ return $item->getOriginalPrice();
528
+ }
529
+ }
530
+ }
531
+
532
+ return 0;
533
+ }
534
+
535
+
536
+
537
+ // Output the order as xml
538
+ function WriteOrder($order, $storeCode)
539
+ {
540
+ $this->writeStartTag("Order");
541
+
542
+ $incrementId = $order->getIncrementId();
543
+
544
+ $orderPrefix = '';
545
+ $orderNumber = '';
546
+ $orderPostfix = '';
547
+ $ordernumberParts = '';
548
+
549
+ $numberArray = str_split($incrementId);
550
+
551
+ foreach($numberArray as $orderNumberPart)
552
+ {
553
+ if(!is_numeric($orderNumberPart) && $orderNumber == '')
554
+ {
555
+ $orderPrefix .= $orderNumberPart;
556
+ }
557
+ elseif(is_numeric($orderNumberPart) && $orderPostfix == '')
558
+ {
559
+ $orderNumber .= $orderNumberPart;
560
+ }
561
+ elseif($orderNumber != '')
562
+ {
563
+ $orderPostfix .= $orderNumberPart;
564
+ }
565
+ }
566
+
567
+ if(!is_numeric($orderNumber))
568
+ {
569
+ $this->outputError(99, "ShipWorks is not compatible with your Order Number format, please contact ShipWorks support");
570
+ }
571
+
572
+ $this->writeElement("OrderNumberPrefix", $orderPrefix);
573
+ $this->writeElement("OrderNumber", $orderNumber);
574
+ $this->writeElement("OrderNumberPostfix", $orderPostfix);
575
+ $this->writeElement("OrderDate", $this->FormatDate($order->getCreatedAt()));
576
+ $this->writeElement("LastModified", $this->FormatDate($order->getUpdatedAt()));
577
+ $this->writeElement("ShippingMethod", $order->getShippingDescription());
578
+ $this->writeElement("StatusCode", $order->getStatus());
579
+ $this->writeElement("CustomerID", $order->getCustomerId());
580
+
581
+ // check for order-level gift messages
582
+ if ($order->getGiftMessageId())
583
+ {
584
+ $message = Mage::helper('giftmessage/message')->getGiftMessage($order->getGiftMessageId());
585
+ $messageString = "Gift message for ". $message['recipient']. ": ". $message['message'];
586
+
587
+ $this->writeStartTag("Notes");
588
+ $this->writeFullElement("Note", $messageString, array("public" => "true"));
589
+ $this->writeCloseTag("Notes");
590
+ }
591
+
592
+ $address = $order->getBillingAddress();
593
+ $this->writeStartTag("BillingAddress");
594
+ $this->writeElement("FullName", $address->getName());
595
+ $this->writeElement("Company", $address->getCompany());
596
+ $this->writeElement("Street1", $address->getStreet(1));
597
+ $this->writeElement("Street2", $address->getStreet(2));
598
+ $this->writeElement("Street3", $address->getStreet(3));
599
+ $this->writeElement("City", $address->getCity());
600
+ $this->writeElement("State", $address->getRegionCode());
601
+ $this->writeElement("PostalCode", $address->getPostcode());
602
+ $this->writeElement("Country", $address->getCountryId());
603
+ $this->writeElement("Phone", $address->getTelephone());
604
+ $this->writeElement("Email", $order->getCustomerEmail());
605
+ $this->writeCloseTag("BillingAddress");
606
+
607
+ $billFullName = $address->getName();
608
+ $billStreet1 = $address->getStreet(1);
609
+ $billCity = $address->getCity();
610
+ $billZip = $address->getPostcode();
611
+
612
+ $address = $order->getShippingAddress();
613
+ if (!$address)
614
+ {
615
+ // sometimes the shipping address isn't specified, so use billing
616
+ $address = $order->getBillingAddress();
617
+ }
618
+
619
+ $this->writeStartTag("ShippingAddress");
620
+ $this->writeElement("FullName", $address->getName());
621
+ $this->writeElement("Company", $address->getCompany());
622
+ $this->writeElement("Street1", $address->getStreet(1));
623
+ $this->writeElement("Street2", $address->getStreet(2));
624
+ $this->writeElement("Street3", $address->getStreet(3));
625
+ $this->writeElement("City", $address->getCity());
626
+ $this->writeElement("State", $address->getRegionCode());
627
+ $this->writeElement("PostalCode", $address->getPostcode());
628
+ $this->writeElement("Country", $address->getCountryId());
629
+ $this->writeElement("Phone", $address->getTelephone());
630
+
631
+ // if the addressses appear to be the same, use customer email as shipping email too
632
+ if ($address->getName() == $billFullName &&
633
+ $address->getStreet(1) == $billStreet1 &&
634
+ $address->getCity() == $billCity &&
635
+ $address->getPostcode() == $billZip)
636
+ {
637
+ $this->writeElement("Email", $order->getCustomerEmail());
638
+ }
639
+
640
+ $this->writeCloseTag("ShippingAddress");
641
+
642
+ $payment = $order->getPayment();
643
+
644
+ // CC info
645
+ $cc_num = $payment->getCcLast4();
646
+ if (!empty($cc_num))
647
+ {
648
+ $cc_num = '************'.$payment->getCcLast4();
649
+ }
650
+ $cc_year = sprintf('%02u%s', $payment->getCcExpMonth(), substr($payment->getCcExpYear(), 2));
651
+
652
+
653
+ $this->writeStartTag("Payment");
654
+ $this->writeElement("Method", Mage::helper('payment')->getMethodInstance($payment->getMethod())->getTitle());
655
+
656
+ $this->writeStartTag("CreditCard");
657
+ $this->writeElement("Type", $payment->getCcType());
658
+ $this->writeElement("Owner", $payment->getCcOwner());
659
+ $this->writeElement("Number", $cc_num);
660
+ $this->writeElement("Expires", $cc_year);
661
+ $this->writeCloseTag("CreditCard");
662
+
663
+ $this->writeCloseTag("Payment");
664
+
665
+ $this->WriteOrderItems($order->getAllItems(), $storeCode);
666
+ $this->WriteOrderTotals($order);
667
+
668
+ $this->writeStartTag("Debug");
669
+ $this->writeElement("OrderID", $order->getEntityId());
670
+ $this->writeElement("OrderNumberPostfix", $orderPostfix);
671
+ $this->writeCloseTag("Debug");
672
+
673
+ $this->writeCloseTag("Order");
674
+ }
675
+
676
+ // get orders
677
+ public function getOrders($start, $maxCount, $storeCode)
678
+ {
679
+ $storeId = $this->StoreIdFromCode($storeCode);
680
+
681
+ // Only get orders through 2 seconds ago.
682
+ $end = date("Y-m-d H:i:s", time() - 2);
683
+
684
+ // Convert to local SQL time
685
+ $start = $this->toLocalSqlDate($start);
686
+
687
+ // Write the params for easier diagnostics
688
+ $this->writeXmlDeclaration();
689
+ $this->writeShipWorksStart();
690
+ $this->writeStartTag("Parameters");
691
+ $this->writeElement("Start", $start);
692
+ $this->writeElement("End", $end);
693
+ $this->writeElement("MaxCount", $maxcount);
694
+ $this->writeCloseTag("Parameters");
695
+
696
+ // setup the query
697
+ $orders = Mage::getModel('sales/order')->getCollection();
698
+ $orders->addAttributeToSelect("*")
699
+ ->getSelect()
700
+ ->where("(updated_at > '$start' AND updated_at <= '$end' AND store_id = $storeId)")
701
+ ->order('updated_at', 'asc');
702
+
703
+ // configure paging
704
+ $orders->setCurPage(1)
705
+ ->setPageSize($maxcount)
706
+ ->loadData();
707
+
708
+ $this->writeStartTag("Orders");
709
+
710
+ $lastModified = null;
711
+ $processedIds = "";
712
+
713
+ foreach ($orders as $order)
714
+ {
715
+ // keep track of the ids we've downloaded
716
+ $lastModified = $order->getUpdatedAt();
717
+
718
+ if ($processedIds != "")
719
+ {
720
+ $processedIds .= ", ";
721
+ }
722
+ $processedIds .= $order->getEntityId();
723
+
724
+ $this->WriteOrder($order, $storeCode);
725
+ }
726
+
727
+ // if we processed some orders we may have to get some more
728
+ if ($processedIds != "")
729
+ {
730
+ $orders = Mage::getModel('sales/order')->getCollection();
731
+ $orders->addAttributeToSelect("*")->getSelect()->where("updated_at = '$lastModified' AND entity_id not in ($processedIds) AND store_id = $storeId");
732
+
733
+ foreach ($orders as $order)
734
+ {
735
+ $this->WriteOrder($order, $storeCode);
736
+ }
737
+ }
738
+
739
+ $this->writeCloseTag("Orders");
740
+ $this->writeCloseTag("ShipWorks");
741
+
742
+ return $this->output;
743
+ }
744
+
745
+ // Takes the actions necessary to get an order to Complete
746
+ function CompleteOrder($order, $comments, $carrierData, $tracking, $sendEmail)
747
+ {
748
+ //Check to see if the order already shipments
749
+ if($order->hasShipments())
750
+ {
751
+ //Order already has shipments
752
+ $existingShipments = $order->getShipmentsCollection();
753
+
754
+ //Grab the first shipment to add tracking to
755
+ $shipment = $existingShipments->getFirstItem();
756
+ }
757
+ else
758
+ {
759
+ //Order has no shipments
760
+ $shipment = $order->prepareShipment();
761
+ $shipment->register();
762
+ }
763
+
764
+ //Do Shipment Stuff
765
+ if ($shipment)
766
+ {
767
+ $shipment->addComment($comments, false);
768
+ $order->setIsInProcess(true);
769
+
770
+ // add tracking info if it was supplied
771
+ if (strlen($tracking) > 0)
772
+ {
773
+ $track = Mage::getModel('sales/order_shipment_track')->setNumber($tracking);
774
+
775
+ # carrier data is of the format code|title
776
+ $carrierData = preg_split("[\|]", $carrierData);
777
+ $track->setCarrierCode($carrierData[0]);
778
+ $track->setTitle($carrierData[1]);
779
+
780
+ $shipment->addTrack($track);
781
+ }
782
+
783
+ $transactionSave = Mage::getModel('core/resource_transaction')
784
+ ->addObject($shipment)
785
+ ->addObject($shipment->getOrder())
786
+ ->save();
787
+
788
+ // send the email if it's requested
789
+ if ($sendEmail == '1')
790
+ {
791
+ $shipment->sendEmail(true);
792
+ }
793
+ }
794
+
795
+ // invoice the order
796
+ if ($order->hasInvoices())
797
+ {
798
+ // select the last invoice to attach the note to
799
+ $invoice = $order->getInvoiceCollection()->getLastItem();
800
+ }
801
+ else
802
+ {
803
+ // prepare a brand-new invoice
804
+ $invoice = $order->prepareInvoice();
805
+ $invoice->register();
806
+ }
807
+
808
+ // capture the invoice if possible
809
+ if ($invoice->canCapture())
810
+ {
811
+ $invoice->Capture();
812
+ }
813
+
814
+ // some magento versions prevent multiple pay() calls from have impact,
815
+ // but others don't. If pay is called multiple times, Order.Total Paid is off.
816
+ if ($invoice->getState() != Mage_Sales_Model_Order_Invoice::STATE_PAID)
817
+ {
818
+ $invoice->pay();
819
+ }
820
+
821
+ // set the comment
822
+ $invoice->addComment($comments);
823
+
824
+ // save the new invoice
825
+ $transactionSave = Mage::getModel('core/resource_transaction')
826
+ ->addObject($invoice)
827
+ ->addObject($invoice->getOrder());
828
+ $transactionSave->save();
829
+
830
+ // Saving will force magento to move the state/status
831
+ $order->save();
832
+ }
833
+
834
+ // Changes the status of an order
835
+ function ExecuteOrderCommand($order, $command, $comments, $carrierData, $tracking, $sendEmail)
836
+ {
837
+ try
838
+ {
839
+ // to change statuses, we need to unhold if necessary
840
+ if ($order->canUnhold())
841
+ {
842
+ $order->unhold();
843
+ $order->save();
844
+ }
845
+
846
+ switch (strtolower($command))
847
+ {
848
+ case "complete":
849
+ $this->CompleteOrder($order, $comments, $carrierData, $tracking, $sendEmail);
850
+ break;
851
+ case "cancel":
852
+ $order->cancel();
853
+ $order->addStatusToHistory($order->getStatus(), $comments);
854
+ $order->save();
855
+ break;
856
+ case "hold":
857
+ $order->hold();
858
+ $order->addStatusToHistory($order->getStatus(), $comments);
859
+ $order->save();
860
+ break;
861
+ default:
862
+ outputError(80, "Unknown order command '$command'.");
863
+ break;
864
+ }
865
+
866
+ $this->writeStartTag("Debug");
867
+ $this->writeElement("OrderStatus", $order->getStatus());
868
+ $this->writeCloseTag("Debug");
869
+ }
870
+ catch (Exception $ex)
871
+ {
872
+ $this->outputError(90, "Error Executing Command. ". $ex->getMessage());
873
+ }
874
+ }
875
+
876
+
877
+ // Update the status of an order
878
+ function updateOrder($order, $command, $comments, $tracking, $carrierData, $sendEmail)
879
+ {
880
+ $this->output = '';
881
+
882
+ $this->writeXmlDeclaration();
883
+ $this->writeShipWorksStart();
884
+
885
+ $this->writeStartTag("Parameters");
886
+ $this->writeElement("Order", $order);
887
+ $this->writeElement("Command", $command);
888
+ $this->writeElement("Comments", $comments);
889
+ $this->writeElement("Tracking", $tracking);
890
+ $this->writeElement("CarrierData", $carrierData);
891
+ $this->writeElement("SendEmail", $sendEmail);
892
+ $this->writeCloseTag("Parameters");
893
+
894
+ // newer version of ShipWorks, pull the entity id
895
+ $order = Mage::getModel('sales/order')->load($order);
896
+
897
+ $this->ExecuteOrderCommand($order, $command, $comments, $carrierData, $tracking);
898
+
899
+ $this->writeCloseTag("ShipWorks");
900
+ return $this->output;
901
+ }
902
+
903
+
904
+ // gets status codes
905
+ function getStatusCodes()
906
+ {
907
+ $this->writeXmlDeclaration();
908
+ $this->writeShipWorksStart();
909
+ $this->writeStartTag("StatusCodes");
910
+
911
+ $statuses_node = Mage::getConfig()->getNode('global/sales/order/statuses');
912
+
913
+ foreach ($statuses_node->children() as $status)
914
+ {
915
+ $this->writeStartTag("StatusCode");
916
+ $this->writeElement("Code", $status->getName());
917
+ $this->writeElement("Name", $status->label);
918
+ $this->writeCloseTag("StatusCode");
919
+ }
920
+
921
+ $this->writeCloseTag("StatusCodes");
922
+ $this->writeCloseTag("ShipWorks");
923
+
924
+ return $this->output;
925
+ }
926
+
927
+ // Get the count of orders greater than the start ID
928
+ public function getCount($start, $storeCode)
929
+ {
930
+ $this->output = '';
931
+
932
+ $storeId = $this->StoreIdFromCode($storeCode);
933
+
934
+ // only get orders through 2 seconds ago
935
+ $end = date("Y-m-d H:i:s", time() - 2);
936
+
937
+ // Convert to local SQL time
938
+ $start = $this->toLocalSqlDate($start);
939
+
940
+ // Write the params for easier diagnostics
941
+ $this->writeXmlDeclaration();
942
+ $this->writeShipWorksStart();
943
+ $this->writeStartTag("Parameters");
944
+ $this->writeElement("Start", $start);
945
+ $this->writeElement("StoreID", $storeId);
946
+ $this->writeCloseTag("Parameters");
947
+
948
+ $orders = Mage::getModel('sales/order')->getCollection();
949
+ $orders->addAttributeToSelect("updated_at")->getSelect()->where("(updated_at > '$start' AND updated_at <= '$end' AND store_id = $storeId)");
950
+ $count = $orders->count();
951
+
952
+ $this->writeElement("OrderCount", $count);
953
+ $this->writeCloseTag("ShipWorks");
954
+
955
+ return $this->output;
956
+ }
957
+ }
958
+ ?>
app/code/local/Interapptive/ShipWorks/Model/Version.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Interapptive_ShipWorks_Model_Version
4
+ {
5
+ // Gets the UI value for version infomation for display in the UI
6
+ public function toOptionArray()
7
+ {
8
+ return array("version" => $this->getModuleVersion());
9
+ }
10
+
11
+ // gets the module version
12
+ public function getModuleVersion()
13
+ {
14
+ return "3.10.0";
15
+ }
16
+ }
17
+ ?>
app/code/local/Interapptive/ShipWorks/etc/adminhtml.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <shipWorksApi translate="title" module="ShipWorks">
12
+ <title>ShipWorks Here</title>
13
+ </shipWorksApi>
14
+ </children>
15
+ </config>
16
+ </children>
17
+ </system>
18
+ </children>
19
+ </admin>
20
+ </resources>
21
+ </acl>
22
+ </config>
23
+
app/code/local/Interapptive/ShipWorks/etc/api.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <config>
3
+ <modules>
4
+ <ShipWorks>
5
+ <version>0.1</version>
6
+ </ShipWorks>
7
+ </modules>
8
+ <api>
9
+ <resources>
10
+ <shipWorksApi translate="title" module="Interapptive_ShipWorks">
11
+ <title>ShipWorks API</title>
12
+ <model>Interapptive_ShipWorks_Model_Objectmodel_Api</model>
13
+ <methods>
14
+ <getModule translate="title" module="Interapptive_ShipWorks">
15
+ <Title>Get Module</Title>
16
+ </getModule>
17
+
18
+ <getCount translate="title" module="Interapptive_ShipWorks">
19
+ <Title>Get Order Count</Title>
20
+ </getCount>
21
+
22
+ <getStore translate="title" module="Interapptive_ShipWorks">
23
+ <Title>Get Store</Title>
24
+ </getStore>
25
+
26
+ <getOrders translate="title" module="Interapptive_ShipWorks">
27
+ <Title>Get Orders</Title>
28
+ </getOrders>
29
+
30
+ <getStatusCodes translate="title" module="Interapptive_ShipWorks">
31
+ <Title>Get Status Codes</Title>
32
+ </getStatusCodes>
33
+
34
+ <updateOrder translate="title" module="Interapptive_ShipWorks">
35
+ <Title>Update Order</Title>
36
+ </updateOrder>
37
+ </methods>
38
+ </shipWorksApi>
39
+ </resources>
40
+ </api>
41
+ </config>
app/code/local/Interapptive/ShipWorks/etc/config.xml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <config>
3
+ <modules>
4
+ <Interapptive_ShipWorks>
5
+ <version>0.1.0</version>
6
+ </Interapptive_ShipWorks>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <ShipWorks>
11
+ <class>Interapptive_ShipWorks_Model</class>
12
+ </ShipWorks>
13
+ </models>
14
+ <helpers>
15
+ <ShipWorks>
16
+ <class>Interapptive_ShipWorks_Helper</class>
17
+ </ShipWorks>
18
+ </helpers>
19
+ </global>
20
+ <admin>
21
+ <routers>
22
+ <shipWorksApi>
23
+ <use>admin</use>
24
+ <args>
25
+ <module>Interapptive_ShipWorks</module>
26
+ <frontName>ShipWorks</frontName>
27
+ </args>
28
+ </shipWorksApi>
29
+ </routers>
30
+ </admin>
31
+ <default>
32
+ <shipWorksApi>
33
+ <mapping>
34
+ <Code>sku</Code>
35
+ <Location>None</Location>
36
+ <AttributeOne>None</AttributeOne>
37
+ <AttributeTwo>None</AttributeTwo>
38
+ <AttributeThree>None</AttributeThree>
39
+ </mapping>
40
+ </shipWorksApi>
41
+ </default>
42
+ </config>
app/code/local/Interapptive/ShipWorks/etc/system.xml ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <sections>
4
+ <shipWorksApi translate="label" module="ShipWorks">
5
+ <label>ShipWorks</label>
6
+ <tab>sales</tab>
7
+ <sort_order>800</sort_order>
8
+ <show_in_default>1</show_in_default>
9
+ <show_in_website>1</show_in_website>
10
+ <show_in_store>1</show_in_store>
11
+ <groups>
12
+ <shipWorksApi translate="label">
13
+ <label>Module Version</label>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>1</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <expanded>0</expanded>
20
+ <fields>
21
+ <version translate="label comment">
22
+ <label>Module Version</label>
23
+ <frontend_type>select</frontend_type>
24
+ <source_model>ShipWorks/Version</source_model>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>1</show_in_store>
28
+ </version>
29
+ </fields>
30
+ </shipWorksApi>
31
+ <mapping translate="label">
32
+ <label>Custom Mapping</label>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>2</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ <expanded>1</expanded>
39
+ <fields>
40
+ <Code translate="label comment">
41
+ <label>Code</label>
42
+ <frontend_type>select</frontend_type>
43
+ <source_model>ShipWorks/ItemAttributes</source_model>
44
+ <sort_order>1</sort_order>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ <show_in_store>1</show_in_store>
48
+ </Code>
49
+ <Location translate="label comment">
50
+ <label>Location</label>
51
+ <frontend_type>select</frontend_type>
52
+ <source_model>ShipWorks/ItemAttributes</source_model>
53
+ <sort_order>2</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ </Location>
58
+ <AttributeOne translate="label comment">
59
+ <label>Attribute 1</label>
60
+ <frontend_type>select</frontend_type>
61
+ <source_model>ShipWorks/ItemAttributes</source_model>
62
+ <sort_order>3</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </AttributeOne>
67
+ <AttributeTwo translate="label comment">
68
+ <label>Attribute 2</label>
69
+ <frontend_type>select</frontend_type>
70
+ <source_model>ShipWorks/ItemAttributes</source_model>
71
+ <sort_order>4</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ </AttributeTwo>
76
+ <AttributeThree translate="label comment">
77
+ <label>Attribute 3</label>
78
+ <frontend_type>select</frontend_type>
79
+ <source_model>ShipWorks/ItemAttributes</source_model>
80
+ <sort_order>5</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ </AttributeThree>
85
+ </fields>
86
+ </mapping>
87
+
88
+ </groups>
89
+ </shipWorksApi>
90
+ </sections>
91
+ </config>
app/etc/modules/Interapptive_ShipWorks.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Interapptive_ShipWorks>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Interapptive_ShipWorks>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>ShipWorks_Multi_Carrier_Shipping_Software</name>
4
+ <version>3.10.1</version>
5
+ <stability>stable</stability>
6
+ <license>Commercial</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>ShipWorks 3.0 Integration</summary>
10
+ <description>Allows your ShipWorks 3.0 application to integrate with your online store.</description>
11
+ <notes>Updated to support Magento Community and Enterprise</notes>
12
+ <authors><author><name>ShipWorks</name><user>Administrator</user><email>support@shipworks.com</email></author></authors>
13
+ <date>2015-01-28</date>
14
+ <time>22:10:55</time>
15
+ <contents><target name="magelocal"><dir><dir name="Interapptive"><dir name="ShipWorks"><dir name="Helper"><file name="Data.php" hash="3df8007ff0f7ec4b619e633ebf4fbaf9"/></dir><dir name="Model"><file name="ItemAttributes.php" hash="16149db3abc101922f6a06bcce7d0e10"/><dir name="Objectmodel"><file name="Api.php" hash="0409c9c4519bd9ed4e37e5267d5e3818"/></dir><file name="Version.php" hash="b6ec828d206fc1dd137bae2fb55a7f85"/></dir><dir name="etc"><file name="adminhtml.xml" hash="fcb9ca5fa9a0be357c9bcbc697a56f8a"/><file name="api.xml" hash="1124243c22d9f352472172db4f825b96"/><file name="config.xml" hash="b2093dab43d7f4c457e63c5c7ed9dcda"/><file name="system.xml" hash="8ffba3c8888c3d61d28556f0f91c184f"/></dir></dir></dir><dir name=".."><dir name=".."><dir name="etc"><dir name="modules"><file name="Interapptive_ShipWorks.xml" hash="f6abb1488fd579321de6b47245af4bf9"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>