iparcel_logistics - Version 1.4.0

Version Notes

Notes

Download this release

Release Info

Developer Bobby Burden
Extension iparcel_logistics
Version 1.4.0
Comparing to
See all releases


Code changes from version 1.3.0 to 1.4.0

Files changed (39) hide show
  1. app/code/community/Iparcel/All/Block/Adminhtml/Iparcel/Sync.php +48 -0
  2. app/code/community/Iparcel/All/Block/Catalog/Product/List.php +9 -0
  3. app/code/community/Iparcel/All/Block/Sales/Order/Totals/Duty.php +1 -1
  4. app/code/community/Iparcel/All/Block/Sales/Order/Totals/Tax.php +1 -1
  5. app/code/community/Iparcel/All/Helper/Api.php +303 -162
  6. app/code/community/Iparcel/All/Helper/Data.php +28 -1
  7. app/code/community/Iparcel/All/Model/Carrier/Abstract.php +47 -0
  8. app/code/community/Iparcel/All/Model/Carrier/Iparcel.php +109 -39
  9. app/code/community/Iparcel/All/Model/Catalog/Product/Observer.php +25 -11
  10. app/code/community/Iparcel/All/Model/Config/Script/Js.php +0 -5
  11. app/code/community/Iparcel/All/Model/Observer.php +80 -47
  12. app/code/community/Iparcel/All/Model/Payment/Iparcel.php +13 -0
  13. app/code/community/Iparcel/All/Model/Quote/Address/Total/Abstract.php +2 -1
  14. app/code/community/Iparcel/All/Model/Quote/Address/Total/Collector.php +3 -3
  15. app/code/community/Iparcel/All/Model/Quote/Address/Total/Duty.php +1 -1
  16. app/code/community/Iparcel/All/Model/Quote/Address/Total/Tax.php +6 -1
  17. app/code/community/Iparcel/All/Model/System/Config/Catalog/Mapping.php +2 -0
  18. app/code/community/Iparcel/All/Model/Tax/Quote/Shipping.php +1 -1
  19. app/code/community/Iparcel/All/Model/Tax/Quote/Subtotal.php +1 -1
  20. app/code/community/Iparcel/All/Model/Tax/Quote/Tax.php +1 -1
  21. app/code/community/Iparcel/All/controllers/Adminhtml/Iparcel/Sync/AjaxController.php +43 -110
  22. app/code/community/Iparcel/All/controllers/Adminhtml/Iparcel/SyncController.php +0 -18
  23. app/code/community/Iparcel/All/controllers/AjaxController.php +3 -1
  24. app/code/community/Iparcel/All/controllers/InfoController.php +1 -27
  25. app/code/community/Iparcel/All/controllers/InternationalController.php +4 -4
  26. app/code/community/Iparcel/All/etc/config.xml +4 -1
  27. app/code/community/Iparcel/All/etc/system.xml +54 -54
  28. app/code/community/Iparcel/All/sql/iparcel_setup/mysql4-upgrade-1.1.0-1.1.1.php +7 -4
  29. app/code/community/Iparcel/All/sql/iparcel_setup/mysql4-upgrade-1.2.1-1.3.0.php +17 -0
  30. app/code/community/Iparcel/Logistics/etc/config.xml +1 -1
  31. app/design/adminhtml/default/default/layout/iparcel.xml +1 -12
  32. app/design/adminhtml/default/default/template/iparcel/sync/ajax/catalog.phtml +14 -16
  33. app/design/adminhtml/default/default/template/iparcel/sync/ajax/checkitems.phtml +0 -21
  34. js/iparcel/adminhtml/shipping-methods.js +2 -2
  35. js/iparcel/adminhtml/sync.js +87 -75
  36. js/iparcel/lib.js +46 -44
  37. js/iparcel/post.js +108 -52
  38. package.xml +4 -4
  39. skin/adminhtml/default/default/iparcel/ajaxSync.css +22 -4
app/code/community/Iparcel/All/Block/Adminhtml/Iparcel/Sync.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adminhtml i-parcel Sync Block
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ class Iparcel_All_Block_Adminhtml_Iparcel_Sync extends Mage_Adminhtml_Block_Template
10
+ {
11
+ /**
12
+ * Initialize factory instance
13
+ */
14
+ public function __construct()
15
+ {
16
+ $this->_blockGroup = 'iparcel';
17
+ $this->_controller = 'adminhtml_iparcel_sync_ajax';
18
+ $this->_headerText = $this->__('i-parcel Catalog Sync');
19
+ parent::__construct();
20
+ }
21
+
22
+ /**
23
+ * Add "Start" Button block
24
+ *
25
+ * @return Iparcel_All_Block_Adminhtml_Iparcel_Sync
26
+ */
27
+ protected function _prepareLayout()
28
+ {
29
+ $this->setChild('start_button', $this->getLayout()->createBlock('adminhtml/widget_button')
30
+ ->setData(array(
31
+ 'label' => 'Start',
32
+ 'class' => 'go',
33
+ 'onclick' => 'window.catalogSync.run()'
34
+ )));
35
+
36
+ return parent::_prepareLayout();
37
+ }
38
+
39
+ /**
40
+ * Return the HTML for the start button
41
+ *
42
+ * @return string
43
+ */
44
+ public function getStartButton()
45
+ {
46
+ return $this->getChildHtml('start_button');
47
+ }
48
+ }
app/code/community/Iparcel/All/Block/Catalog/Product/List.php CHANGED
@@ -59,6 +59,15 @@ class Iparcel_All_Block_Catalog_Product_List extends Mage_Catalog_Block_Product_
59
  }
60
  }
61
 
 
 
 
 
 
 
 
 
 
62
  return $this->_productCollection;
63
  }
64
 
59
  }
60
  }
61
 
62
+ // If "checkItems" is enabled, call the CartHandoff API model to
63
+ // check the items in the product collection
64
+ if (Mage::getStoreConfig('iparcel/international_customer/checkitems')) {
65
+ $handoffApi = Mage::helper('ipcarthandoff/api');
66
+ if (is_object($handoffApi)) {
67
+ $handoffApi->checkItems($this->_productCollection);
68
+ }
69
+ }
70
+
71
  return $this->_productCollection;
72
  }
73
 
app/code/community/Iparcel/All/Block/Sales/Order/Totals/Duty.php CHANGED
@@ -20,7 +20,7 @@ class Iparcel_All_Block_Sales_Order_Totals_Duty extends Iparcel_All_Block_Sales_
20
  $value = $source->getIparcelDutyAmount();
21
 
22
  $this->getParentBlock()->addTotal(new Varien_Object(array(
23
- 'code' => 'iparcel_duty',
24
  'strong' => false,
25
  'label' => Mage::helper('iparcel')->getDutyLabel(),
26
  'value' => $value
20
  $value = $source->getIparcelDutyAmount();
21
 
22
  $this->getParentBlock()->addTotal(new Varien_Object(array(
23
+ 'code' => Mage::getModel('iparcel/payment_iparcel')->getDutyCode(),
24
  'strong' => false,
25
  'label' => Mage::helper('iparcel')->getDutyLabel(),
26
  'value' => $value
app/code/community/Iparcel/All/Block/Sales/Order/Totals/Tax.php CHANGED
@@ -20,7 +20,7 @@ class Iparcel_All_Block_Sales_Order_Totals_Tax extends Iparcel_All_Block_Sales_O
20
  $value = $source->getIparcelTaxAmount();
21
 
22
  $this->getParentBlock()->addTotal(new Varien_Object(array(
23
- 'code' => 'iparcel_tax',
24
  'strong' => false,
25
  'label' => Mage::helper('iparcel')->getTaxLabel(),
26
  'value' => $value
20
  $value = $source->getIparcelTaxAmount();
21
 
22
  $this->getParentBlock()->addTotal(new Varien_Object(array(
23
+ 'code' => Mage::getModel('iparcel/payment_iparcel')->getTaxCode(),
24
  'strong' => false,
25
  'label' => Mage::helper('iparcel')->getTaxLabel(),
26
  'value' => $value
app/code/community/Iparcel/All/Helper/Api.php CHANGED
@@ -23,23 +23,29 @@ class Iparcel_All_Helper_Api
23
  /** @var string URL for the Quote endpoint */
24
  protected $_quote = 'https://webservices.i-parcel.com/api/Quote';
25
 
 
 
 
26
  /**
27
  * Send POST requests to the REST API
28
  *
29
  * @param string $post POST Data to send
30
  * @param string $url REST API URL to send POST data to
31
  * @param array $header Array of headers to attach to the request
 
32
  * @return string Response from the POST request
33
  */
34
- protected function _rest($post, $url, array $header)
35
  {
36
  $curl = curl_init($url);
37
 
38
- $timeout = 15;
39
- if ($timeout) {
40
- curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
 
41
  }
42
 
 
43
  curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
44
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
45
  curl_setopt($curl, CURLOPT_POST, true);
@@ -49,25 +55,17 @@ class Iparcel_All_Helper_Api
49
 
50
  $response = curl_exec($curl);
51
 
 
 
 
 
 
 
52
  curl_close($curl);
53
 
54
  return $response;
55
  }
56
 
57
- /**
58
- * Send REST XML requests
59
- *
60
- * Wrapper for _rest() that sends a SimpleXMLElement object to the API.
61
- *
62
- * @param SimpleXMLElement $xml XML to send
63
- * @param string $url REST API URL to send POST data to
64
- * @return string Response from the POST request
65
- */
66
- protected function _restXML($xml, $url)
67
- {
68
- return $this->_rest($xml->asXml, $url, array('Content-Type: text/xml'));
69
- }
70
-
71
  /**
72
  * Send REST JSON requests
73
  *
@@ -75,24 +73,42 @@ class Iparcel_All_Helper_Api
75
  *
76
  * @param string $json Data to be JSON encoded and sent to the API
77
  * @param string $url REST API URL to send POST data to
 
78
  * @return string Response from the POST request
79
  */
80
- protected function _restJSON($json, $url)
81
  {
82
  return $this->_rest(
83
  json_encode($json),
84
  $url,
85
- array('Content-Type: text/json')
 
86
  );
87
  }
88
 
89
- protected function _getProductAttribute($product, $code) {
 
 
 
 
 
 
 
 
90
  $attribute = Mage::getModel('eav/entity_attribute')
91
  ->load(Mage::getStoreConfig('catalog_mapping/attributes/' . $code));
92
  if ($attribute->getData()) {
93
  $code = $attribute->getAttributeCode();
94
  }
95
- $val = strip_tags(($product->getData($code) && $product->getAttributeText($code)) ? $product->getAttributeText($code) : $product->getData($code));
 
 
 
 
 
 
 
 
96
  return $val;
97
  }
98
 
@@ -106,7 +122,7 @@ class Iparcel_All_Helper_Api
106
  {
107
  $json = array();
108
  $json['TrackingNumber'] = Mage::helper('iparcel')->getTrackingNumber($shipment);
109
- $json['UserNotes'] = '';
110
  $json['Key'] = Mage::helper('iparcel')->getGuid();
111
 
112
  $response = $this->_restJSON($json, $this->_cancel);
@@ -175,81 +191,41 @@ class Iparcel_All_Helper_Api
175
  */
176
  public function quote(Mage_Shipping_Model_Rate_Request $request)
177
  {
178
- // log init
 
 
 
 
179
  $log = Mage::getModel('iparcel/log');
180
- /* var $log Iparcel_All_Model_Api_Log */
 
181
  $log->setController('Quote');
182
- $quote = Mage::getModel('checkout/cart')->getQuote();
183
- /* var $quote Mage_Sales_Model_Quote */
184
- $shippingAddress = $quote->getShippingAddress();
185
- /* var $shippingAddress Mage_Sales_Model_Quote_Address */
186
- $billingAddress = $quote->getBillingAddress();
187
- /* var $billingAddress Mage_Sales_Model_Quote_Address */
188
  $json = array();
189
- $addressInfo = array();
190
- $billingStreet = $billingAddress->getStreet();
191
- $billing = array();
192
- $billing['City'] = $billingAddress->getCity();
193
- $billing['CountryCode'] = $billingAddress->getCountryId();
194
- $billing['Email'] = $quote->getCustomerEmail();
195
- $billing['FirstName'] = $billingAddress->getFirstname();
196
- $billing['LastName'] = $billingAddress->getLastname();
197
- $billing['Phone'] = $billingAddress->getTelephone();
198
- $billing['PostCode'] = $billingAddress->getPostcode();
199
- $billing['Region'] = $billingAddress->getRegion();
200
- for ($i=0; $i<count($billingStreet); $i++) {
201
- $billing['Street'.($i+1)] = $billingStreet[$i];
202
- }
203
- $addressInfo['Billing'] = $billing;
204
- $shippingStreet = explode("\n", $request->getDestStreet());
205
- $shipping = array();
206
- $shipping['City'] = $request->getDestCity();
207
- $shipping['CountryCode'] = $request->getDestCountryId();
208
- $shipping['Email'] = $quote->getCustomerEmail();
209
- $shipping['FirstName'] = $shippingAddress->getFirstname();
210
- $shipping['LastName'] = $shippingAddress->getLastname();
211
- $shipping['Phone'] = $shippingAddress->getTelephone();
212
- $shipping['PostCode'] = $request->getDestPostcode();
213
- $shipping['Region'] = $request->getDestRegionCode();
214
- foreach($shippingStreet as $key => $value) {
215
- $shipping['Street' . ($key + 1)] = $value;
216
- }
217
- $addressInfo['Shipping'] = $shipping;
218
- $addressInfo['ControlNumber'] = $quote->getCpf();
219
  $json['AddressInfo'] = $addressInfo;
220
  $json['CurrencyCode'] = $request->getPackageCurrency()->getCurrencyCode();
221
  $json['DDP'] = true;
 
222
  $itemsList = array();
223
  foreach ($request->getAllItems() as $item) {
224
- /* var $item Mage_Sales_Model_Quote_Item */
225
- $itemProduct = Mage::getModel('catalog/product')->load($item->getProductId());
226
- /* var $itemProduct Mage_Catalog_Model_Product */
227
- //get item price
228
- $itemPrice = (float)$this->_getProductAttribute($item->getProduct(), 'final_price') ?: (float)$this->_getProductAttribute($item->getProduct(), 'price');
229
- // if not price and item has parent (is configurable)
230
- if (!$itemPrice && ($parent=$item->getParentItem())) {
231
- // get parent price
232
- $itemPrice = (float)$this->_getProductAttribute($parent->getProduct(), 'final_price') ?: (float)$this->_getProductAttribute($parent->getProduct(), 'price');
233
- }
234
- // if still not price
235
- if (!$itemPrice) {
236
- // get product price
237
- $itemPrice = (float)$this->_getProductAttribute($item->getProduct(), 'price');
238
  }
239
- // if product isn't virtual and is configurable or downloadable
240
- if ($item["is_virtual"] == false && !in_array($itemProduct->getTypeId(), array('configurable','downloadable'))) {
241
- // add line item node
242
- $lineItem = array();
243
- $lineItem['SKU'] = $item->getSku();
244
- $lineItem['ValueUSD'] = $itemPrice;
245
- $lineItem['CustLengthInches'] = (float)$this->_getProductAttribute($item->getProduct(), 'length');
246
- $lineItem['CustHeightInches'] = (float)$this->_getProductAttribute($item->getProduct(), 'height');
247
- $lineItem['CustWidthInches'] = (float)$this->_getProductAttribute($item->getProduct(), 'width');
248
- $lineItem['CustWeightLbs'] = (float)$this->_getProductAttribute($item->getProduct(), 'weight');
249
- $lineItem['Quantity'] = $item->getTotalQty();
250
- $lineItem['ValueShopperCurrency'] = $itemPrice;
251
- $lineItem['ShopperCurrency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
252
- $itemsList[] = $lineItem;
253
  }
254
  }
255
  $json['ItemDetailsList'] = $itemsList;
@@ -325,57 +301,34 @@ class Iparcel_All_Helper_Api
325
  */
326
  public function submitParcel(Mage_Sales_Model_Order_Shipment $shipment)
327
  {
 
 
 
 
328
  $order = $shipment->getOrder();
329
- // init log
330
  $log = Mage::getModel('iparcel/log');
331
- /* var $log Iparcel_All_Model_Api_Log */
 
332
  $log->setController('Submit Parcel');
333
- $shippingAddress = $order->getShippingAddress();
334
- /* var $shippingAddress Mage_Sales_Model_Quote_Address */
335
- $billingAddress = $order->getBillingAddress();
336
- /* var $billingAddress Mage_Sales_Model_Quote_Address */
 
 
337
  $json = array();
338
- $addressInfo = array();
339
- $billingStreet = $billingAddress->getStreet();
340
- $billing = array();
341
- $billing['City'] = $billingAddress->getCity();
342
- $billing['CountryCode'] = $billingAddress->getCountryId();
343
- $billing['Email'] = $order->getCustomerEmail();
344
- $billing['FirstName'] = $billingAddress->getFirstname();
345
- $billing['LastName'] = $billingAddress->getLastname();
346
- $billing['Phone'] = $billingAddress->getTelephone();
347
- $billing['PostCode'] = $billingAddress->getPostcode();
348
- $billing['Region'] = $billingAddress->getRegion();
349
- $billing['Street1'] = $billingStreet[0];
350
- if (array_key_exists(1, $billingStreet)) {
351
- $billing['Street2'] = $billingStreet[1];
352
- }
353
- $addressInfo['Billing'] = $billing;
354
- $shippingStreet = $shippingAddress->getStreet();
355
- $shipping = array();
356
- $shipping['City'] = $shippingAddress->getCity();
357
- $shipping['CountryCode'] = $shippingAddress->getCountryId();
358
- $shipping['Email'] = $order->getCustomerEmail();
359
- $shipping['FirstName'] = $shippingAddress->getFirstname();
360
- $shipping['LastName'] = $shippingAddress->getLastname();
361
- $shipping['Phone'] = $shippingAddress->getTelephone();
362
- $shipping['PostCode'] = $shippingAddress->getPostcode();
363
- $shipping['Region'] = $shippingAddress->getRegion();
364
- $shipping['Street1'] = $shippingStreet[0];
365
- if (array_key_exists(1, $shippingStreet)) {
366
- $shipping['Street2'] = $shippingStreet[1];
367
- }
368
- $addressInfo['Shipping'] = $shipping;
369
- $addressInfo['ControlNumber'] = $order->getCpf();
370
  $json['AddressInfo'] = $addressInfo;
371
  $json['CurrencyCode'] = $order->getOrderCurrencyCode();
372
  $json['DDP'] = true;
 
373
  $shipmentItems = $shipment->getAllItems();
374
  $itemsList = array();
375
  foreach ($shipmentItems as $item) {
376
- /** @var $item Mage_Sales_Model_Order_Shipment_Item */
377
- // Check for a configurable product -- the simple should be loaded
378
- /** @var $itemProduct Mage_Catalog_Model_Product */
 
 
379
  $orderItem = $item->getOrderItem();
380
  if ($orderItem->getProductType() == "configurable") {
381
  $itemProduct = $orderItem->getChildrenItems();
@@ -383,33 +336,10 @@ class Iparcel_All_Helper_Api
383
  } else {
384
  $itemProduct = Mage::getModel('catalog/product')->load($item->getOrderItem()->getProductId());
385
  }
386
- //get item price
387
- $itemPrice = (float)$item->getFinalPrice() ?: (float)$item->getPrice();
388
- // if not price and item has parent (is configurable)
389
- if (!$itemPrice && ($parent=$item->getParentItem())) {
390
- // get parent price
391
- $itemPrice = (float)$parent->getFinalPrice() ?: (float)$parent->getPrice();
392
- }
393
- // if still not price
394
- if (!$itemPrice) {
395
- // get product price
396
- $itemPrice = (float)$this->_getProductAttribute($item->getProduct(), 'price');
397
- }
398
-
399
  // if product isn't virtual and is configurable or downloadable
400
  if ($item["is_virtual"] == false && !in_array($itemProduct->getTypeId(), array('configurable','downloadable'))) {
401
- // add line item node
402
- $lineItem = array();
403
- $lineItem['SKU'] = $item->getSku();
404
- $lineItem['ValueUSD'] = $itemPrice;
405
- $lineItem['CustWeightLbs'] = (float)$item->getWeight();
406
- $lineItem['CustLengthInches'] = (float)$item->getLength();
407
- $lineItem['CustWidthInches'] = (float)$item->getWidth();
408
- $lineItem['CustHeightInches'] = (float)$item->getHeight();
409
- $lineItem['Quantity'] = (float)$item->getQty();
410
- $lineItem['ValueShopperCurrency'] = $itemPrice;
411
- $lineItem['ShopperCurrency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
412
- $itemsList[] = $lineItem;
413
  }
414
  }
415
  $json['ItemDetailsList'] = $itemsList;
@@ -566,8 +496,6 @@ class Iparcel_All_Helper_Api
566
  $items = array();
567
  $items['key'] = Mage::helper('iparcel')->getGuid();
568
 
569
- $skus = $items['SKUs'] = array();
570
-
571
  foreach ($products as $product) {
572
  /** @var Mage_Catalog_Model_Product $product */
573
  $product = Mage::getModel('catalog/product')->load($product->getId());
@@ -600,6 +528,21 @@ class Iparcel_All_Helper_Api
600
  }
601
 
602
  $price = null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
603
  // if it's simple product and config is to get parent's price
604
  if ($product->getTypeId() == 'simple' && Mage::getStoreConfig('catalog_mapping/attributes/price_type') == Iparcel_All_Model_System_Config_Source_Catalog_Mapping_Configurable_Price::CONFIGURABLE) {
605
  // get parentIds
@@ -610,7 +553,15 @@ class Iparcel_All_Helper_Api
610
  // if there's no price
611
  if (!$price) {
612
  //get current product's price
613
- $price = $this->_getProductAttribute($product, 'price');
 
 
 
 
 
 
 
 
614
  }
615
 
616
  $item['CountryOfOrigin'] = (string)$product->getCountryOfManufacture();
@@ -627,7 +578,18 @@ class Iparcel_All_Helper_Api
627
  $item['Length'] = (float)$this->_getProductAttribute($product, 'length');
628
  $item['Height'] = (float)$this->_getProductAttribute($product, 'height');
629
  $item['Width'] = (float)$this->_getProductAttribute($product, 'width');
630
- $item['Weight'] = (float)$this->_getProductAttribute($product, 'weight');
 
 
 
 
 
 
 
 
 
 
 
631
 
632
  $item['ProductURL'] = $product->getUrlPath();
633
  $item['SKN'] = '';
@@ -637,6 +599,12 @@ class Iparcel_All_Helper_Api
637
 
638
  // Detect and handle a Simple Product with Custom Options
639
  if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE && $product->getHasOptions()) {
 
 
 
 
 
 
640
  // loop through each of the sorted products with custom options
641
  // and build out custom option and option type based skus
642
  foreach ($this->_findSimpleProductVariants($product) as $customOptionProduct) {
@@ -658,22 +626,31 @@ class Iparcel_All_Helper_Api
658
  $item['ProductName'] = $name . $customOptionName;
659
  $items['SKUs'][] = $item;
660
  }
 
661
  } else {
662
  $items['SKUs'][] = $item;
663
  }
664
-
665
  }
666
 
667
  return $items;
668
  }
669
 
 
 
 
 
 
 
 
 
 
670
  /**
671
  * Performs the work of handling Simple Products with Custom Options
672
  *
673
  * @param Mage_Catalog_Model_Product $product Product with Options
674
  * @return array Options array with all product variations
675
  */
676
- private function _findSimpleProductVariants($product)
677
  {
678
  // get product options collection object
679
  $options = Mage::getModel('catalog/product_option')
@@ -765,7 +742,7 @@ class Iparcel_All_Helper_Api
765
  * @param array $options Array of option arrays (sku, price, title, sort_order, required)
766
  * @return array Array of arrays, representing the possible option variations
767
  */
768
- private function _findVariations($options)
769
  {
770
  // filter out empty values
771
  $options = array_filter($options);
@@ -822,9 +799,126 @@ class Iparcel_All_Helper_Api
822
  $result[] = $allOptionals;
823
  }
824
 
 
 
 
 
 
 
825
  return $result;
826
  }
827
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
828
  /**
829
  * Set the URLs for API Calls.
830
  *
@@ -846,4 +940,51 @@ class Iparcel_All_Helper_Api
846
 
847
  return true;
848
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
849
  }
23
  /** @var string URL for the Quote endpoint */
24
  protected $_quote = 'https://webservices.i-parcel.com/api/Quote';
25
 
26
+ /** @var int Timeout in seconds for REST requests */
27
+ protected $_timeout = 15;
28
+
29
  /**
30
  * Send POST requests to the REST API
31
  *
32
  * @param string $post POST Data to send
33
  * @param string $url REST API URL to send POST data to
34
  * @param array $header Array of headers to attach to the request
35
+ * @param int $timeout Timeout in seconds
36
  * @return string Response from the POST request
37
  */
38
+ protected function _rest($post, $url, array $header, $timeout = 0)
39
  {
40
  $curl = curl_init($url);
41
 
42
+ $throwExceptionOnTimeout = true;
43
+ if (!$timeout || !is_int($timeout) || $timeout == 0) {
44
+ $timeout = $this->_timeout;
45
+ $throwExceptionOnTimeout = false;
46
  }
47
 
48
+ curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
49
  curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
50
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
51
  curl_setopt($curl, CURLOPT_POST, true);
55
 
56
  $response = curl_exec($curl);
57
 
58
+ if (curl_errno($curl) == 28 // CURLE_OPERATION_TIMEDOUT
59
+ && $throwExceptionOnTimeout
60
+ ) {
61
+ throw new Exception;
62
+ }
63
+
64
  curl_close($curl);
65
 
66
  return $response;
67
  }
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  /**
70
  * Send REST JSON requests
71
  *
73
  *
74
  * @param string $json Data to be JSON encoded and sent to the API
75
  * @param string $url REST API URL to send POST data to
76
+ * @param int Timeout value in seconds
77
  * @return string Response from the POST request
78
  */
79
+ protected function _restJSON($json, $url, $timeout = 0)
80
  {
81
  return $this->_rest(
82
  json_encode($json),
83
  $url,
84
+ array('Content-Type: text/json'),
85
+ $timeout
86
  );
87
  }
88
 
89
+ /**
90
+ * Finds the value of attribute matching the extension's configuration
91
+ *
92
+ * @param Mage_Catalog_Model_Product $product
93
+ * @param string $code Attribute code
94
+ * @return string
95
+ */
96
+ protected function _getProductAttribute(Mage_Catalog_Model_Product $product, $code)
97
+ {
98
  $attribute = Mage::getModel('eav/entity_attribute')
99
  ->load(Mage::getStoreConfig('catalog_mapping/attributes/' . $code));
100
  if ($attribute->getData()) {
101
  $code = $attribute->getAttributeCode();
102
  }
103
+
104
+ // Special case for `special_price` code
105
+ if ($code == 'special_price') {
106
+ // Grabs the special price if we are in the applicable date range
107
+ $val = $product->getFinalPrice();
108
+ } else {
109
+ $val = strip_tags(($product->getData($code) && $product->getAttributeText($code)) ? $product->getAttributeText($code) : $product->getData($code));
110
+ }
111
+
112
  return $val;
113
  }
114
 
122
  {
123
  $json = array();
124
  $json['TrackingNumber'] = Mage::helper('iparcel')->getTrackingNumber($shipment);
125
+ $json['UserNotes'] = 'Canceled by Admin User of the Magento Store.';
126
  $json['Key'] = Mage::helper('iparcel')->getGuid();
127
 
128
  $response = $this->_restJSON($json, $this->_cancel);
191
  */
192
  public function quote(Mage_Shipping_Model_Rate_Request $request)
193
  {
194
+ /**
195
+ * @var Mage_Sales_Model_Quote $quote
196
+ * @var Iparcel_All_Model_Api_Log $log
197
+ */
198
+ $quote = Mage::getModel('checkout/cart')->getQuote();
199
  $log = Mage::getModel('iparcel/log');
200
+
201
+ // init log
202
  $log->setController('Quote');
203
+
204
+ /**
205
+ * @var array $addressInfo AddressInfo segment of API call
206
+ * @var array $json Array to be sent to the API
207
+ */
208
+ $addressInfo = $this->_prepareAddress($quote, $request);
209
  $json = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  $json['AddressInfo'] = $addressInfo;
211
  $json['CurrencyCode'] = $request->getPackageCurrency()->getCurrencyCode();
212
  $json['DDP'] = true;
213
+
214
  $itemsList = array();
215
  foreach ($request->getAllItems() as $item) {
216
+ // Skip products that belong to a configurable -- we send the configurable product
217
+ if ($item->getParentItemId() !== null) {
218
+ continue;
 
 
 
 
 
 
 
 
 
 
 
219
  }
220
+
221
+ /**
222
+ * @var Mage_Sales_Model_Quote_Item $item
223
+ * @var Mage_Catalog_Model_Product $itemProduct
224
+ */
225
+ $itemProduct = Mage::getModel('catalog/product')->load($item->getProductId());
226
+ if ($item["is_virtual"] == false && $itemProduct->getTypeId() != 'downloadable') {
227
+ $itemDetails = $this->_getItemDetails($item);
228
+ $itemsList[] = $itemDetails;
 
 
 
 
 
229
  }
230
  }
231
  $json['ItemDetailsList'] = $itemsList;
301
  */
302
  public function submitParcel(Mage_Sales_Model_Order_Shipment $shipment)
303
  {
304
+ /**
305
+ * @var Mage_Sales_Model_Order $order
306
+ * @var Iparcel_All_Model_Api_Log $log
307
+ */
308
  $order = $shipment->getOrder();
 
309
  $log = Mage::getModel('iparcel/log');
310
+
311
+ // init log
312
  $log->setController('Submit Parcel');
313
+
314
+ /**
315
+ * @var array $addressInfo AddressInfo segment of API call
316
+ * @var array $json Array to be sent to the API
317
+ */
318
+ $addressInfo = $this->_prepareAddress($order);
319
  $json = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
320
  $json['AddressInfo'] = $addressInfo;
321
  $json['CurrencyCode'] = $order->getOrderCurrencyCode();
322
  $json['DDP'] = true;
323
+
324
  $shipmentItems = $shipment->getAllItems();
325
  $itemsList = array();
326
  foreach ($shipmentItems as $item) {
327
+ /**
328
+ * Check for a configurable product -- the simple should be loaded
329
+ * @var Mage_Sales_Model_Order_Shipment_Item $item
330
+ * @var Mage_Catalog_Model_Product $itemProduct
331
+ */
332
  $orderItem = $item->getOrderItem();
333
  if ($orderItem->getProductType() == "configurable") {
334
  $itemProduct = $orderItem->getChildrenItems();
336
  } else {
337
  $itemProduct = Mage::getModel('catalog/product')->load($item->getOrderItem()->getProductId());
338
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  // if product isn't virtual and is configurable or downloadable
340
  if ($item["is_virtual"] == false && !in_array($itemProduct->getTypeId(), array('configurable','downloadable'))) {
341
+ $itemDetails = $this->_getItemDetails($item);
342
+ $itemsList[] = $itemDetails;
 
 
 
 
 
 
 
 
 
 
343
  }
344
  }
345
  $json['ItemDetailsList'] = $itemsList;
496
  $items = array();
497
  $items['key'] = Mage::helper('iparcel')->getGuid();
498
 
 
 
499
  foreach ($products as $product) {
500
  /** @var Mage_Catalog_Model_Product $product */
501
  $product = Mage::getModel('catalog/product')->load($product->getId());
528
  }
529
 
530
  $price = null;
531
+
532
+ // Finds the price for simple products with configurable parents
533
+ $configurableParent = Mage::getModel('catalog/product_type_configurable')
534
+ ->getParentIdsByChild($product->getId());
535
+ if (count($configurableParent)) {
536
+ $configurableParent = Mage::getModel('catalog/product')->load(
537
+ $configurableParent[0]
538
+ );
539
+
540
+ $price = $this->_getConfigurableProductPrice(
541
+ $configurableParent,
542
+ $product
543
+ );
544
+ }
545
+
546
  // if it's simple product and config is to get parent's price
547
  if ($product->getTypeId() == 'simple' && Mage::getStoreConfig('catalog_mapping/attributes/price_type') == Iparcel_All_Model_System_Config_Source_Catalog_Mapping_Configurable_Price::CONFIGURABLE) {
548
  // get parentIds
553
  // if there's no price
554
  if (!$price) {
555
  //get current product's price
556
+ if (is_null($price)) {
557
+ $price = $this->_getProductAttribute($product, 'price');
558
+ }
559
+ }
560
+
561
+ // If all attempts to gather a price based on configuration fail,
562
+ // call getPrice() on the product
563
+ if (!$price) {
564
+ $price = $product->getPrice();
565
  }
566
 
567
  $item['CountryOfOrigin'] = (string)$product->getCountryOfManufacture();
578
  $item['Length'] = (float)$this->_getProductAttribute($product, 'length');
579
  $item['Height'] = (float)$this->_getProductAttribute($product, 'height');
580
  $item['Width'] = (float)$this->_getProductAttribute($product, 'width');
581
+
582
+ /**
583
+ * On configurable products, send the weight if one is available,
584
+ * otherwise, send '0.1'. This allows for classification while the
585
+ * simple product is the one actually added to cart and sold.
586
+ */
587
+ $productWeight = (float)$this->_getProductAttribute($product, 'weight');
588
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_TYPE::TYPE_CONFIGURABLE
589
+ && $productWeight < 0.1) {
590
+ $productWeight = 0.1;
591
+ }
592
+ $item['Weight'] = $productWeight;
593
 
594
  $item['ProductURL'] = $product->getUrlPath();
595
  $item['SKN'] = '';
599
 
600
  // Detect and handle a Simple Product with Custom Options
601
  if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE && $product->getHasOptions()) {
602
+ if(get_class($product->getOptionInstance()) == 'MageWorx_CustomOptions_Model_Catalog_Product_Option') {
603
+ if($this->_productHasDropdownOption($product)) {
604
+ $items['SKUs'][] = $item;
605
+ }
606
+ }
607
+
608
  // loop through each of the sorted products with custom options
609
  // and build out custom option and option type based skus
610
  foreach ($this->_findSimpleProductVariants($product) as $customOptionProduct) {
626
  $item['ProductName'] = $name . $customOptionName;
627
  $items['SKUs'][] = $item;
628
  }
629
+
630
  } else {
631
  $items['SKUs'][] = $item;
632
  }
 
633
  }
634
 
635
  return $items;
636
  }
637
 
638
+ protected function _productHasDropdownOption($product) {
639
+ foreach($product->getOptions() as $option) {
640
+ if($option->getType() == 'drop_down') {
641
+ return true;
642
+ }
643
+ }
644
+ return false;
645
+ }
646
+
647
  /**
648
  * Performs the work of handling Simple Products with Custom Options
649
  *
650
  * @param Mage_Catalog_Model_Product $product Product with Options
651
  * @return array Options array with all product variations
652
  */
653
+ protected function _findSimpleProductVariants($product)
654
  {
655
  // get product options collection object
656
  $options = Mage::getModel('catalog/product_option')
742
  * @param array $options Array of option arrays (sku, price, title, sort_order, required)
743
  * @return array Array of arrays, representing the possible option variations
744
  */
745
+ protected function _findVariations($options)
746
  {
747
  // filter out empty values
748
  $options = array_filter($options);
799
  $result[] = $allOptionals;
800
  }
801
 
802
+ // Make sure that the first element of the result array is an empty
803
+ // array. This will cause the "base" SKU to be sent as a catalog item.
804
+ if ($result[0] != array()) {
805
+ array_unshift($result, array());
806
+ }
807
+
808
  return $result;
809
  }
810
 
811
+ /**
812
+ * Accepts a Magento quote or order, then returns an address formatted for
813
+ * the API
814
+ *
815
+ * @param object $object Object to extract address information from
816
+ * @param bool $request If provided, this shipping rate request is used
817
+ * @return array Address information formatted for API requests
818
+ */
819
+ protected function _prepareAddress($object, $request = false)
820
+ {
821
+ /**
822
+ * @var Mage_Sales_Model_Quote_Address $shippingAddress
823
+ * @var Mage_Sales_Model_Quote_Address $billingAddress
824
+ * @var array $formattedAddress
825
+ */
826
+ $shippingAddress = $object->getShippingAddress();
827
+ $billingAddress = $object->getBillingAddress();
828
+ $formattedAddress = array();
829
+
830
+ $formattedAddress['Billing'] = $this->_getAddressArray(
831
+ $billingAddress,
832
+ $object->getCustomerEmail()
833
+ );
834
+
835
+ $formattedAddress['Shipping'] = $this->_getAddressArray(
836
+ $shippingAddress,
837
+ $object->getCustomerEmail(),
838
+ $request
839
+ );
840
+
841
+ $formattedAddress['ControlNumber'] = $object->getCpf();
842
+
843
+ return $formattedAddress;
844
+ }
845
+
846
+ /**
847
+ * Used by _prepareAddress() to generate an array of Address information
848
+ *
849
+ * @param object $address Address to act on
850
+ * @param string $emailAddress Email address of the user
851
+ * @param object|bool $request If provided, this shipping rate request is used
852
+ * @return array Formatted address array
853
+ */
854
+ protected function _getAddressArray($address, $emailAddress, $request = false)
855
+ {
856
+ $formattedAddress = array();
857
+ $formattedAddress['City'] = $request ? $request->getDestCity() : $address->getCity();
858
+ $formattedAddress['CountryCode'] = $request ? $request->getDestCountryId() : $address->getCountryId();
859
+ $formattedAddress['Email'] = $emailAddress;
860
+ $formattedAddress['FirstName'] = $address->getFirstname();
861
+ $formattedAddress['LastName'] = $address->getLastname();
862
+ $formattedAddress['Phone'] = $address->getTelephone();
863
+ $formattedAddress['PostCode'] = $request ? $request->getDestPostcode() : $address->getPostcode();
864
+ $formattedAddress['Region'] = $request ? $request->getDestRegionCode() : $address->getRegion();
865
+
866
+ $street = $request ? explode('\n', $request->getDestStreet()) : $address->getStreet();
867
+ for ($i=0; $i<count($street); $i++) {
868
+ $formattedAddress['Street'.($i+1)] = $street[$i];
869
+ }
870
+
871
+ return $formattedAddress;
872
+ }
873
+
874
+ /**
875
+ * Prepares an item for API requests
876
+ *
877
+ * @param $item
878
+ * @return array
879
+ */
880
+ private function _getItemDetails($item)
881
+ {
882
+ // Find the corresponding product for the item
883
+ $itemProduct = $item->getProduct();
884
+ if (!$itemProduct) {
885
+ $itemProduct = Mage::getModel('catalog/product')
886
+ ->loadByAttribute('sku', $item->getSku());
887
+ }
888
+
889
+ // Find the price of the product
890
+ $itemPrice = (float) $item->getCalculationPrice();
891
+ // if no price and item has parent (is configurable)
892
+ if (is_null($itemPrice) && ($parent = $item->getParentItem())) {
893
+ // get parent price
894
+ $itemPrice = (float)$this->_getProductAttribute($parent->getProduct(), 'final_price') ?: (float)$this->_getProductAttribute($parent->getProduct(), 'price');
895
+ }
896
+ // if still no price
897
+ if (is_null($itemPrice)) {
898
+ // get product price
899
+ $itemPrice = (float)$this->_getProductAttribute($itemProduct, 'price');
900
+ }
901
+
902
+ // If all attempts to gather a price based on configuration fail,
903
+ // call getPrice() on the product
904
+ if (!$itemPrice) {
905
+ $itemPrice = $itemProduct->getPrice();
906
+ }
907
+
908
+ $lineItem = array();
909
+ $lineItem['SKU'] = $item->getSku();
910
+ $lineItem['ValueUSD'] = $itemPrice;
911
+ $lineItem['CustLengthInches'] = (float)$this->_getProductAttribute($itemProduct, 'length');
912
+ $lineItem['CustHeightInches'] = (float)$this->_getProductAttribute($itemProduct, 'height');
913
+ $lineItem['CustWidthInches'] = (float)$this->_getProductAttribute($itemProduct, 'width');
914
+ $lineItem['CustWeightLbs'] = (float)$this->_getProductAttribute($itemProduct, 'weight');
915
+ $lineItem['Quantity'] = $item->getTotalQty() ?: $item->getQty();
916
+ $lineItem['ValueShopperCurrency'] = $itemPrice;
917
+ $lineItem['ShopperCurrency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
918
+
919
+ return $lineItem;
920
+ }
921
+
922
  /**
923
  * Set the URLs for API Calls.
924
  *
940
 
941
  return true;
942
  }
943
+
944
+ /**
945
+ * Find the price for a simple product based on the configurable
946
+ *
947
+ * @param $configurable
948
+ * @param $simple
949
+ * @return null|float
950
+ */
951
+ protected function _getConfigurableProductPrice($configurable, $simple)
952
+ {
953
+ $price = null;
954
+
955
+ $productAttributeOptions = $configurable->getTypeInstance(true)
956
+ ->getConfigurableAttributesAsArray($configurable);
957
+
958
+ $options = array();
959
+ // Builds the $options array to match the attribute configuration for
960
+ // this particular simple -> configurable relationship
961
+ foreach ($productAttributeOptions as $key => $productAttribute) {
962
+ $allValues = array_column(
963
+ $productAttribute['values'],
964
+ 'value_index'
965
+ );
966
+
967
+ $currentProductValue = $simple->getData(
968
+ $productAttribute['attribute_code']
969
+ );
970
+
971
+ if (in_array($currentProductValue, $allValues)) {
972
+ $options[$key] = array_search($currentProductValue, $allValues);
973
+ }
974
+ }
975
+
976
+ if (!count($options)) {
977
+ return null;
978
+ }
979
+
980
+ // Get the value of each selected option
981
+ foreach ($options as $key => $value) {
982
+ $price += $productAttributeOptions[$key]['values'][$value]['pricing_value'];
983
+ }
984
+
985
+ // Add configurable base price
986
+ $price += $configurable->getFinalPrice();
987
+
988
+ return $price;
989
+ }
990
  }
app/code/community/Iparcel/All/Helper/Data.php CHANGED
@@ -101,7 +101,7 @@ class Iparcel_All_Helper_Data extends Mage_Core_Helper_Abstract
101
 
102
  if (is_null($carrier) || $carrier == false) {
103
  $method = $order->getShippingMethod();
104
- if (preg_match('/^iparcel.*/', $method)) {
105
  return true;
106
  }
107
  return false;
@@ -295,4 +295,31 @@ class Iparcel_All_Helper_Data extends Mage_Core_Helper_Abstract
295
  $allExtensions = Mage::app()->getConfig()->getNode('modules')->asArray();
296
  return array_key_exists($name, $allExtensions);
297
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  }
101
 
102
  if (is_null($carrier) || $carrier == false) {
103
  $method = $order->getShippingMethod();
104
+ if (preg_match('/^' . $iparcelCarrier->getCarrierCode() . '.*/', $method)) {
105
  return true;
106
  }
107
  return false;
295
  $allExtensions = Mage::app()->getConfig()->getNode('modules')->asArray();
296
  return array_key_exists($name, $allExtensions);
297
  }
298
+
299
+ /**
300
+ * Gathers extension versions for any installed i-parcel extensions
301
+ *
302
+ * @return array
303
+ */
304
+ public function gatherExtensionVersions()
305
+ {
306
+ $extensions = array(
307
+ 'Iparcel_All' => 0,
308
+ 'Iparcel_CartHandoff' => 0,
309
+ 'Iparcel_GlobaleCommerce' => 0,
310
+ 'Iparcel_Logistics' => 0
311
+ );
312
+
313
+ $allExtensions = Mage::app()->getConfig()->getNode('modules')->asArray();
314
+
315
+ foreach ($extensions as $key => &$version) {
316
+ if (array_key_exists($key, $allExtensions)) {
317
+ $version = $allExtensions[$key]['version'];
318
+ } else {
319
+ unset($extensions[$key]);
320
+ }
321
+ }
322
+
323
+ return $extensions;
324
+ }
325
  }
app/code/community/Iparcel/All/Model/Carrier/Abstract.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * i-parcel shipping method model
4
+ *
5
+ * @category Iparcel
6
+ * @package Iparcel_All
7
+ * @author Bobby Burden <bburden@i-parcel.com>
8
+ */
9
+ abstract class Iparcel_All_Model_Carrier_Abstract extends Mage_Shipping_Model_Carrier_Abstract
10
+ {
11
+ protected $_trackingUrl = 'https://tracking.i-parcel.com/secure/track.aspx?track=';
12
+
13
+ /**
14
+ * Check if carrier has shipping label option available
15
+ *
16
+ * @return bool
17
+ */
18
+ public function isShippingLabelsAvailable()
19
+ {
20
+ return true;
21
+ }
22
+
23
+ /**
24
+ * Check if carrier has shipping tracking option available
25
+ *
26
+ * @return bool
27
+ */
28
+ public function isTrackingAvailable()
29
+ {
30
+ return true;
31
+ }
32
+
33
+ /**
34
+ * Get info for track order page
35
+ *
36
+ * @param string $number Tracking Number
37
+ * @return Varien_Object
38
+ */
39
+ public function getTrackingInfo($number)
40
+ {
41
+ return new Varien_Object(array(
42
+ 'tracking' => $number,
43
+ 'carrier_title' => $this->getConfigData('title'),
44
+ 'url' => $this->_trackingUrl.$number
45
+ ));
46
+ }
47
+ }
app/code/community/Iparcel/All/Model/Carrier/Iparcel.php CHANGED
@@ -6,47 +6,10 @@
6
  * @package Iparcel_All
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
- class Iparcel_All_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
10
  {
11
  protected $_code = 'iparcel';
12
 
13
- protected $_trackingUrl = 'https://tracking.i-parcel.com/secure/track.aspx?track=';
14
-
15
- /**
16
- * Check if carrier has shipping label option available
17
- *
18
- * @return bool
19
- */
20
- public function isShippingLabelsAvailable()
21
- {
22
- return true;
23
- }
24
-
25
- /**
26
- * Check if carrier has shipping tracking option available
27
- *
28
- * @return bool
29
- */
30
- public function isTrackingAvailable()
31
- {
32
- return true;
33
- }
34
-
35
- /**
36
- * Get info for track order page
37
- *
38
- * @param string $number Tracking Number
39
- * @return Varien_Object
40
- */
41
- public function getTrackingInfo($number)
42
- {
43
- return new Varien_Object(array(
44
- 'tracking' => $number,
45
- 'carrier_title' => $this->getConfigData('title'),
46
- 'url' => $this->_trackingUrl.$number
47
- ));
48
- }
49
-
50
  /**
51
  * Return container types of carrier
52
  *
@@ -67,10 +30,23 @@ class Iparcel_All_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier_Abst
67
  public function collectRates(Mage_Shipping_Model_Rate_Request $request)
68
  {
69
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  /** @var boolean $internationalOrder */
71
  $internationalOrder = Mage::helper('iparcel')->getIsInternational($request);
72
  if ($internationalOrder && Mage::getStoreConfig('carriers/iparcel/active')) {
73
- /** @var array $iparcel Tax & Duty totals */
74
  $iparcelTaxAndDuty = array();
75
  /** @var Mage_Shipping_Model_Rate_Result $result*/
76
  $result = Mage::getModel('shipping/rate_result');
@@ -122,6 +98,14 @@ class Iparcel_All_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier_Abst
122
  'duty' => $duty,
123
  'tax' => $tax
124
  );
 
 
 
 
 
 
 
 
125
  }
126
  // Store the shipping quote
127
  $quoteId = Mage::getModel('checkout/cart')->getQuote()->getId();
@@ -131,6 +115,30 @@ class Iparcel_All_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier_Abst
131
  $quote->setParcelId($iparcelTaxAndDuty['parcel_id']);
132
  $quote->setServiceLevels($iparcelTaxAndDuty['service_levels']);
133
  $quote->save();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  return $result;
135
  }
136
  } catch (Exception $e) {
@@ -160,4 +168,66 @@ class Iparcel_All_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier_Abst
160
  {
161
  return $this->getMethodsNames();
162
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  }
6
  * @package Iparcel_All
7
  * @author Bobby Burden <bburden@i-parcel.com>
8
  */
9
+ class Iparcel_All_Model_Carrier_Iparcel extends Iparcel_All_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
10
  {
11
  protected $_code = 'iparcel';
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  /**
14
  * Return container types of carrier
15
  *
30
  public function collectRates(Mage_Shipping_Model_Rate_Request $request)
31
  {
32
  try {
33
+
34
+ // If this is being used with CartHandoff, we don't return methods
35
+ // for orders with Amazon or PayPal payments
36
+ $isCartHandoff = Mage::helper('iparcel')->isCartHandoffInstalled();
37
+ if ($isCartHandoff
38
+ && ($this->_isAmazonPayments() || $this->_isPayPalPayment())
39
+ ) {
40
+ return false;
41
+ }
42
+
43
+ // Maintain a list of items ineligible for international shipping
44
+ $ineligibleItems = array();
45
+
46
  /** @var boolean $internationalOrder */
47
  $internationalOrder = Mage::helper('iparcel')->getIsInternational($request);
48
  if ($internationalOrder && Mage::getStoreConfig('carriers/iparcel/active')) {
49
+ /** @var array $iparcelTaxAndDuty Tax & Duty totals */
50
  $iparcelTaxAndDuty = array();
51
  /** @var Mage_Shipping_Model_Rate_Result $result*/
52
  $result = Mage::getModel('shipping/rate_result');
98
  'duty' => $duty,
99
  'tax' => $tax
100
  );
101
+
102
+ // If this service level has InvalidItems, add them to the
103
+ // list of ineligible items
104
+ $invalid = (array) $ci->InvalidItems->Items;
105
+ foreach ($invalid as $item) {
106
+ $ineligibleItems[] = $item->Sku;
107
+ }
108
+
109
  }
110
  // Store the shipping quote
111
  $quoteId = Mage::getModel('checkout/cart')->getQuote()->getId();
115
  $quote->setParcelId($iparcelTaxAndDuty['parcel_id']);
116
  $quote->setServiceLevels($iparcelTaxAndDuty['service_levels']);
117
  $quote->save();
118
+
119
+ // Add error message for any products that are not eligible
120
+ // for international shipping
121
+ if ($isCartHandoff) {
122
+ $ineligibleItems = array_unique($ineligibleItems);
123
+ $skusToNames = array();
124
+ $allItems = $request->getAllItems();
125
+ if (count($ineligibleItems)) {
126
+ foreach ($allItems as $requestItem) {
127
+ $skusToNames[$requestItem->getSku()] = $requestItem
128
+ ->getName();
129
+ }
130
+ }
131
+
132
+ $session = Mage::getSingleton('checkout/session');
133
+ $session->getMessages(true);
134
+ foreach ($ineligibleItems as $ineligibleItem) {
135
+ $name = $skusToNames[$ineligibleItem];
136
+ $session->addError(
137
+ "'$name' is not available for international shipping"
138
+ );
139
+ }
140
+ }
141
+
142
  return $result;
143
  }
144
  } catch (Exception $e) {
168
  {
169
  return $this->getMethodsNames();
170
  }
171
+
172
+ /**
173
+ * Determines if the checkout session is an Amazon Payments session
174
+ *
175
+ * @return boolean
176
+ */
177
+ public function _isAmazonPayments()
178
+ {
179
+ $session = Mage::getSingleton('checkout/session');
180
+
181
+ $amazonReference = $session->getData('amazon_order_reference_id');
182
+ if (!is_null($amazonReference) || $amazonReference != "") {
183
+ return true;
184
+ }
185
+
186
+ return false;
187
+ }
188
+
189
+ /**
190
+ * Determines if the checkout session is a PayPal payment
191
+ *
192
+ * @return boolean
193
+ */
194
+ public function _isPayPalPayment()
195
+ {
196
+ return $this->_paymentMethodContains('paypal');
197
+ }
198
+
199
+ /**
200
+ * Check if string exists in payment method name
201
+ *
202
+ * @param string Payment Method name to search for
203
+ * @return boolean
204
+ */
205
+ private function _paymentMethodContains($string)
206
+ {
207
+ $paymentMethod = $this->_getPaymentMethod();
208
+
209
+ if (strpos($paymentMethod, $string) !== false) {
210
+ return true;
211
+ }
212
+
213
+ return false;
214
+ }
215
+
216
+ /**
217
+ * Finds the payment method of the current checkout session
218
+ *
219
+ * @return string
220
+ */
221
+ private function _getPaymentMethod()
222
+ {
223
+ if (is_null($this->_paymentMethod)) {
224
+ $checkoutSession = Mage::getSingleton('checkout/session');
225
+ $this->_paymentMethod = $checkoutSession
226
+ ->getQuote()
227
+ ->getPayment()
228
+ ->getMethod();
229
+ }
230
+
231
+ return $this->_paymentMethod;
232
+ }
233
  }
app/code/community/Iparcel/All/Model/Catalog/Product/Observer.php CHANGED
@@ -23,12 +23,19 @@ class Iparcel_All_Model_Catalog_Product_Observer
23
  */
24
  public function product_save($observer)
25
  {
26
- if ($this->_isEnabled()) {
27
- $product = $observer->getProduct();
28
- $productCollection = new Varien_Data_Collection();
29
- $productCollection->addItem($product);
30
- Mage::helper('iparcel/api')->submitCatalog($productCollection);
 
 
 
 
 
31
  }
 
 
32
  }
33
 
34
  /**
@@ -56,12 +63,19 @@ class Iparcel_All_Model_Catalog_Product_Observer
56
  */
57
  public function product_delete($observer)
58
  {
59
- if ($this->_isEnabled()) {
60
- $product = $observer->getProduct();
61
- $product->setIsDeleted(true);
62
- $productCollection = new Varien_Data_Collection();
63
- $productCollection->addItem($product);
64
- Mage::helper('iparcel/api')->submitCatalog($productCollection);
 
 
 
 
 
65
  }
 
 
66
  }
67
  }
23
  */
24
  public function product_save($observer)
25
  {
26
+ try {
27
+ if ($this->_isEnabled()) {
28
+ $product = $observer->getProduct();
29
+ $productCollection = new Varien_Data_Collection();
30
+ $productCollection->addItem($product);
31
+ Mage::helper('iparcel/api')->submitCatalog($productCollection);
32
+ }
33
+ } catch (Exception $e) {
34
+ Mage::log('Unable to sync SKU: ' . $product->getSku() . ' to i-parcel catalog.');
35
+ Mage::log($e->getMessage());
36
  }
37
+
38
+ return $this;
39
  }
40
 
41
  /**
63
  */
64
  public function product_delete($observer)
65
  {
66
+ try {
67
+ if ($this->_isEnabled()) {
68
+ $product = $observer->getProduct();
69
+ $product->setIsDeleted(true);
70
+ $productCollection = new Varien_Data_Collection();
71
+ $productCollection->addItem($product);
72
+ Mage::helper('iparcel/api')->submitCatalog($productCollection);
73
+ }
74
+ } catch (Exception $e) {
75
+ Mage::log('Unable to delete SKU: ' . $product->getSku() . ' from i-parcel catalog.');
76
+ Mage::log($e->getMessage());
77
  }
78
+
79
+ return $this;
80
  }
81
  }
app/code/community/Iparcel/All/Model/Config/Script/Js.php CHANGED
@@ -21,11 +21,6 @@ class Iparcel_All_Model_Config_Script_Js extends Mage_Adminhtml_Model_System_Con
21
 
22
  $file = $uploadDir.'/'.$this->getValue();
23
 
24
- // if it's delete action and file exists
25
- if ($delete && file_exists($file)) {
26
- unlink($file);
27
- }
28
-
29
  // if it's set new action and old file exists
30
  $file = $uploadDir.'/'. $_FILES['groups']['name'][$this->getGroupId()]['fields'][$this->getField()]['value'];
31
  if (file_exists($file)) {
21
 
22
  $file = $uploadDir.'/'.$this->getValue();
23
 
 
 
 
 
 
24
  // if it's set new action and old file exists
25
  $file = $uploadDir.'/'. $_FILES['groups']['name'][$this->getGroupId()]['fields'][$this->getField()]['value'];
26
  if (file_exists($file)) {
app/code/community/Iparcel/All/Model/Observer.php CHANGED
@@ -8,6 +8,32 @@
8
  */
9
  class Iparcel_All_Model_Observer
10
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  /**
12
  * Handles triggering the submitParcel call for the shipment.
13
  *
@@ -15,6 +41,11 @@ class Iparcel_All_Model_Observer
15
  */
16
  public function shipment_save_after($observer)
17
  {
 
 
 
 
 
18
  // if autotrack is enabled then order can be tracked when shipped
19
  if (Mage::getStoreConfigFlag('carriers/iparcel/autotrack')) {
20
  // If we are splitting shipments, skip automatic submission.
@@ -33,28 +64,47 @@ class Iparcel_All_Model_Observer
33
  return;
34
  }
35
 
 
 
36
  $order = $observer->getShipment()->getOrder();
37
- if ($order->getShippingCarrier() && $order->getShippingCarrier()->getCarrierCode() == 'iparcel') {
38
- $api = Mage::helper('iparcel/api');
39
- $response = $api->submitParcel($shipment);
40
-
41
- // Find the name of the Service Level as defined in the Admin
42
- $serviceLevels = Mage::helper('iparcel')->getServiceLevels();
43
- $responseServiceLevelId = $response->ServiceLevels[0][0]->ServiceLevelID;
44
- $serviceLevelTitle = 'I-Parcel';
45
- if (array_key_exists($responseServiceLevelId, $serviceLevels)) {
46
- $serviceLevelTitle = $serviceLevels[$responseServiceLevelId];
47
- }
48
 
49
- // Add tracking number from submitParcel response
50
- Mage::getModel('sales/order_shipment_api')->addTrack(
51
- $shipment->getIncrementId(),
52
- $order->getShippingCarrier()->getCarrierCode(),
53
- $serviceLevelTitle,
54
- $response->CarrierTrackingNumber
55
- );
 
 
 
 
 
 
 
 
 
 
56
  }
 
 
 
 
57
  }
 
 
 
 
 
 
 
 
 
58
  }
59
 
60
  /**
@@ -64,6 +114,11 @@ class Iparcel_All_Model_Observer
64
  */
65
  public function order_place_after($observer)
66
  {
 
 
 
 
 
67
  /** @var Mage_Sales_Model_Order $order */
68
  $order = $observer->getOrder();
69
 
@@ -74,41 +129,18 @@ class Iparcel_All_Model_Observer
74
  if (!$order->getQuote()) {
75
  return;
76
  }
 
 
 
77
  // if it's i-parcel shipping method
78
- if ($order->getShippingCarrier() && $order->getShippingCarrier()->getCarrierCode() != 'iparcel') {
79
  return;
80
  }
81
 
82
  // if autoship is enabled and order can be shipped
83
  if (Mage::getStoreConfigFlag('carriers/iparcel/autoship')) {
84
  if ($order->canShip()) {
85
- $converter = Mage::getModel('sales/convert_order');
86
- /* var $converter Mage_Sales_Model_Convert_Order */
87
- $shipment = $converter->toShipment($order);
88
- /* var $shipment Mage_Sales_Model_Order_Shipment */
89
- foreach ($order->getAllItems() as $orderItem) {
90
- /* var $orderItem Mage_Sales_Model_Order_Item */
91
- // continue if it is virtual or there is no quantity to ship
92
- if (!$orderItem->getQtyToShip()) {
93
- continue;
94
- }
95
- if ($order->getIsVirtual()) {
96
- continue;
97
- }
98
- $item = $converter->itemToShipmentItem($orderItem);
99
- /* var $item Mage_Sales_Model_Order_Shipment_Item */
100
- $item->setQty($orderItem->getQtyToShip());
101
- $shipment->addItem($item);
102
- }
103
- $shipment->register();
104
- $shipment->getOrder()->setIsInProcess(true);
105
- $transactionSave = Mage::getModel('core/resource_transaction')
106
- ->addObject($shipment)
107
- ->addObject($order);
108
- /* var $transactionSave Mage_Core_Model_Resource_Transaction */
109
- $transactionSave->save();
110
- $shipment->save();
111
- $shipment->sendEmail();
112
  }
113
  }
114
  }
@@ -189,8 +221,9 @@ class Iparcel_All_Model_Observer
189
  $iparcelDuty = $shippingAddress->getIparcelDutyAmount();
190
  } else {
191
  $carrier = $cart->getSalesEntity()->getShippingCarrier();
 
192
 
193
- if (is_object($carrier) && $carrier->getCarrierCode() == 'iparcel') {
194
  $iparcelTax = $cart->getSalesEntity()->getIparcelTaxAmount();
195
  $iparcelDuty = $cart->getSalesEntity()->getIparcelDutyAmount();
196
  }
8
  */
9
  class Iparcel_All_Model_Observer
10
  {
11
+ /**
12
+ * @param $shipment
13
+ * @param $order
14
+ */
15
+ protected function _submitParcel($shipment, $order)
16
+ {
17
+ $api = Mage::helper('iparcel/api');
18
+ $response = $api->submitParcel($shipment);
19
+
20
+ // Find the name of the Service Level as defined in the Admin
21
+ $serviceLevels = Mage::helper('iparcel')->getServiceLevels();
22
+ $responseServiceLevelId = $response->ServiceLevels[0][0]->ServiceLevelID;
23
+ $serviceLevelTitle = 'I-Parcel';
24
+ if (array_key_exists($responseServiceLevelId, $serviceLevels)) {
25
+ $serviceLevelTitle = $serviceLevels[$responseServiceLevelId];
26
+ }
27
+
28
+ // Add tracking number from submitParcel response
29
+ Mage::getModel('sales/order_shipment_api')->addTrack(
30
+ $shipment->getIncrementId(),
31
+ $order->getShippingCarrier()->getCarrierCode(),
32
+ $serviceLevelTitle,
33
+ $response->CarrierTrackingNumber
34
+ );
35
+ }
36
+
37
  /**
38
  * Handles triggering the submitParcel call for the shipment.
39
  *
41
  */
42
  public function shipment_save_after($observer)
43
  {
44
+ // Do not automatically trigger SubmitParcel with CartHandoff
45
+ if (Mage::helper('iparcel')->isCartHandoffInstalled()) {
46
+ return true;
47
+ }
48
+
49
  // if autotrack is enabled then order can be tracked when shipped
50
  if (Mage::getStoreConfigFlag('carriers/iparcel/autotrack')) {
51
  // If we are splitting shipments, skip automatic submission.
64
  return;
65
  }
66
 
67
+ $iparcelCarrierCode = Mage::getModel('iparcel/payment_iparcel')->getCode();
68
+
69
  $order = $observer->getShipment()->getOrder();
70
+ if ($order->getShippingCarrier() && $order->getShippingCarrier()->getCarrierCode() == $iparcelCarrierCode) {
71
+ $this->_submitParcel($shipment, $order);
72
+ }
73
+ }
74
+ }
 
 
 
 
 
 
75
 
76
+ /**
77
+ * @param $order
78
+ */
79
+ protected function _createShipment($order)
80
+ {
81
+ $converter = Mage::getModel('sales/convert_order');
82
+ /* var $converter Mage_Sales_Model_Convert_Order */
83
+ $shipment = $converter->toShipment($order);
84
+ /* var $shipment Mage_Sales_Model_Order_Shipment */
85
+ foreach ($order->getAllItems() as $orderItem) {
86
+ /* var $orderItem Mage_Sales_Model_Order_Item */
87
+ // continue if it is virtual or there is no quantity to ship
88
+ if (!$orderItem->getQtyToShip()) {
89
+ continue;
90
+ }
91
+ if ($order->getIsVirtual()) {
92
+ continue;
93
  }
94
+ $item = $converter->itemToShipmentItem($orderItem);
95
+ /* var $item Mage_Sales_Model_Order_Shipment_Item */
96
+ $item->setQty($orderItem->getQtyToShip());
97
+ $shipment->addItem($item);
98
  }
99
+ $shipment->register();
100
+ $shipment->getOrder()->setIsInProcess(true);
101
+ $transactionSave = Mage::getModel('core/resource_transaction')
102
+ ->addObject($shipment)
103
+ ->addObject($order);
104
+ /* var $transactionSave Mage_Core_Model_Resource_Transaction */
105
+ $transactionSave->save();
106
+ $shipment->save();
107
+ $shipment->sendEmail();
108
  }
109
 
110
  /**
114
  */
115
  public function order_place_after($observer)
116
  {
117
+ // Do not automatically create shipments with CartHandoff
118
+ if (Mage::helper('iparcel')->isCartHandoffInstalled()) {
119
+ return true;
120
+ }
121
+
122
  /** @var Mage_Sales_Model_Order $order */
123
  $order = $observer->getOrder();
124
 
129
  if (!$order->getQuote()) {
130
  return;
131
  }
132
+
133
+ $iparcelCarrierCode = Mage::getModel('iparcel/payment_iparcel')->getCode();
134
+
135
  // if it's i-parcel shipping method
136
+ if ($order->getShippingCarrier() && $order->getShippingCarrier()->getCarrierCode() != $iparcelCarrierCode) {
137
  return;
138
  }
139
 
140
  // if autoship is enabled and order can be shipped
141
  if (Mage::getStoreConfigFlag('carriers/iparcel/autoship')) {
142
  if ($order->canShip()) {
143
+ $this->_createShipment($order);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  }
145
  }
146
  }
221
  $iparcelDuty = $shippingAddress->getIparcelDutyAmount();
222
  } else {
223
  $carrier = $cart->getSalesEntity()->getShippingCarrier();
224
+ $iparcelCarrierCode = Mage::getModel('iparcel/payment_iparcel')->getCode();
225
 
226
+ if (is_object($carrier) && $carrier->getCarrierCode() == $iparcelCarrierCode) {
227
  $iparcelTax = $cart->getSalesEntity()->getIparcelTaxAmount();
228
  $iparcelDuty = $cart->getSalesEntity()->getIparcelDutyAmount();
229
  }
app/code/community/Iparcel/All/Model/Payment/Iparcel.php CHANGED
@@ -13,4 +13,17 @@ class Iparcel_All_Model_Payment_Iparcel extends Mage_Payment_Model_Method_Abstra
13
  protected $_canUseForMultishipping = false;
14
  protected $_canUseInternal = false;
15
  protected $_canCapture = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
13
  protected $_canUseForMultishipping = false;
14
  protected $_canUseInternal = false;
15
  protected $_canCapture = true;
16
+
17
+ protected $_taxCode = 'iparcel_tax';
18
+ protected $_dutyCode = 'iparcel_duty';
19
+
20
+ public function getTaxCode()
21
+ {
22
+ return $this->_taxCode;
23
+ }
24
+
25
+ public function getDutyCode()
26
+ {
27
+ return $this->_dutyCode;
28
+ }
29
  }
app/code/community/Iparcel/All/Model/Quote/Address/Total/Abstract.php CHANGED
@@ -16,9 +16,10 @@ class Iparcel_All_Model_Quote_Address_Total_Abstract extends Mage_Sales_Model_Qu
16
  */
17
  public function isIparcelShipping($address)
18
  {
 
19
  $shippingMethod = $address->getShippingMethod();
20
  $shippingMethod = explode('_', $shippingMethod);
21
- if ($shippingMethod[0] == 'iparcel') {
22
  return true;
23
  }
24
  return false;
16
  */
17
  public function isIparcelShipping($address)
18
  {
19
+ $iparcelCarrierCode = Mage::getModel('iparcel/payment_iparcel')->getCode();
20
  $shippingMethod = $address->getShippingMethod();
21
  $shippingMethod = explode('_', $shippingMethod);
22
+ if ($shippingMethod[0] == $iparcelCarrierCode) {
23
  return true;
24
  }
25
  return false;
app/code/community/Iparcel/All/Model/Quote/Address/Total/Collector.php CHANGED
@@ -17,8 +17,8 @@ class Iparcel_All_Model_Quote_Address_Total_Collector extends Mage_Sales_Model_Q
17
  $collectors = parent::getCollectors();
18
 
19
  $totals = array(
20
- 'iparcel_tax',
21
- 'iparcel_duty',
22
  'grand_total',
23
  'reward',
24
  'giftcardaccount',
@@ -39,7 +39,7 @@ class Iparcel_All_Model_Quote_Address_Total_Collector extends Mage_Sales_Model_Q
39
  * @param array $array
40
  * @return array
41
  */
42
- private function _moveIndexToEnd($index, $array)
43
  {
44
  if (isset($array[$index])) {
45
  $temp = $array[$index];
17
  $collectors = parent::getCollectors();
18
 
19
  $totals = array(
20
+ Mage::getModel('iparcel/payment_iparcel')->getTaxCode(),
21
+ Mage::getModel('iparcel/payment_iparcel')->getDutyCode(),
22
  'grand_total',
23
  'reward',
24
  'giftcardaccount',
39
  * @param array $array
40
  * @return array
41
  */
42
+ protected function _moveIndexToEnd($index, $array)
43
  {
44
  if (isset($array[$index])) {
45
  $temp = $array[$index];
app/code/community/Iparcel/All/Model/Quote/Address/Total/Duty.php CHANGED
@@ -10,7 +10,7 @@ class Iparcel_All_Model_Quote_Address_Total_Duty extends Iparcel_All_Model_Quote
10
  {
11
  public function __construct()
12
  {
13
- $this->setCode('iparcel_duty');
14
  }
15
 
16
  /**
10
  {
11
  public function __construct()
12
  {
13
+ $this->setCode(Mage::getModel('iparcel/payment_iparcel')->getDutyCode());
14
  }
15
 
16
  /**
app/code/community/Iparcel/All/Model/Quote/Address/Total/Tax.php CHANGED
@@ -10,7 +10,7 @@ class Iparcel_All_Model_Quote_Address_Total_Tax extends Iparcel_All_Model_Quote_
10
  {
11
  public function __construct()
12
  {
13
- $this->setCode('iparcel_tax');
14
  }
15
 
16
  /**
@@ -25,6 +25,11 @@ class Iparcel_All_Model_Quote_Address_Total_Tax extends Iparcel_All_Model_Quote_
25
  return;
26
  }
27
 
 
 
 
 
 
28
  if ($this->isIparcelShipping($address) &&
29
  (Mage::helper('iparcel')->getDisplayTaxAndDutyCumulatively()
30
  || Mage::helper('iparcel')->getDisplayTaxAndDutySeparately())) {
10
  {
11
  public function __construct()
12
  {
13
+ $this->setCode(Mage::getModel('iparcel/payment_iparcel')->getTaxCode());
14
  }
15
 
16
  /**
25
  return;
26
  }
27
 
28
+ // Make sure that we are not working on a quote with no items
29
+ if ($address->getQuote()->hasItems() == false) {
30
+ return;
31
+ }
32
+
33
  if ($this->isIparcelShipping($address) &&
34
  (Mage::helper('iparcel')->getDisplayTaxAndDutyCumulatively()
35
  || Mage::helper('iparcel')->getDisplayTaxAndDutySeparately())) {
app/code/community/Iparcel/All/Model/System/Config/Catalog/Mapping.php CHANGED
@@ -66,5 +66,7 @@ class Iparcel_All_Model_System_Config_Catalog_Mapping extends Mage_Core_Model_Co
66
  throw new Exception(Mage::helper('cron')->__('Unable to remove the cron expression'));
67
  }
68
  }
 
 
69
  }
70
  }
66
  throw new Exception(Mage::helper('cron')->__('Unable to remove the cron expression'));
67
  }
68
  }
69
+
70
+ return parent::_afterSave();
71
  }
72
  }
app/code/community/Iparcel/All/Model/Tax/Quote/Shipping.php CHANGED
@@ -13,7 +13,7 @@ class Iparcel_All_Model_Tax_Quote_Shipping extends Mage_Tax_Model_Sales_Total_Qu
13
  *
14
  * @return Iparcel_All_Model_Quote_Address_Total_Abstract
15
  */
16
- private function _getAbstract()
17
  {
18
  $model = new Iparcel_All_Model_Quote_Address_Total_Abstract;
19
  return $model;
13
  *
14
  * @return Iparcel_All_Model_Quote_Address_Total_Abstract
15
  */
16
+ protected function _getAbstract()
17
  {
18
  $model = new Iparcel_All_Model_Quote_Address_Total_Abstract;
19
  return $model;
app/code/community/Iparcel/All/Model/Tax/Quote/Subtotal.php CHANGED
@@ -13,7 +13,7 @@ class Iparcel_All_Model_Tax_Quote_Subtotal extends Mage_Tax_Model_Sales_Total_Qu
13
  *
14
  * @return Iparcel_All_Model_Quote_Address_Total_Abstract
15
  */
16
- private function _getAbstract()
17
  {
18
  $model = new Iparcel_All_Model_Quote_Address_Total_Abstract;
19
  return $model;
13
  *
14
  * @return Iparcel_All_Model_Quote_Address_Total_Abstract
15
  */
16
+ protected function _getAbstract()
17
  {
18
  $model = new Iparcel_All_Model_Quote_Address_Total_Abstract;
19
  return $model;
app/code/community/Iparcel/All/Model/Tax/Quote/Tax.php CHANGED
@@ -13,7 +13,7 @@ class Iparcel_All_Model_Tax_Quote_Tax extends Mage_Tax_Model_Sales_Total_Quote_T
13
  *
14
  * @return Iparcel_All_Model_Quote_Address_Total_Abstract
15
  */
16
- private function _getAbstract()
17
  {
18
  $model = new Iparcel_All_Model_Quote_Address_Total_Abstract;
19
  return $model;
13
  *
14
  * @return Iparcel_All_Model_Quote_Address_Total_Abstract
15
  */
16
+ protected function _getAbstract()
17
  {
18
  $model = new Iparcel_All_Model_Quote_Address_Total_Abstract;
19
  return $model;
app/code/community/Iparcel/All/controllers/Adminhtml/Iparcel/Sync/AjaxController.php CHANGED
@@ -9,103 +9,75 @@
9
  class Iparcel_All_Adminhtml_Iparcel_Sync_AjaxController extends Mage_Adminhtml_Controller_Action
10
  {
11
  /**
12
- * Response for init querry
13
  *
14
- * @return array
15
  */
16
- protected function _initResponse()
17
  {
18
- $step = Mage::getStoreConfig('catalog_mapping/upload/step');
19
- return array('count' => Mage::getModel('catalog/product')->getCollection()->getSize()-floor(Mage::getStoreConfig('catalog_mapping/upload/offset')/$step)*$step);
20
- }
 
 
 
 
 
 
21
 
22
- /**
23
- * Response for initCatalog querry
24
- *
25
- * @alias _initResponse
26
- * @return array
27
- */
28
- protected function _initCatalogResponse()
29
- {
30
- return $this->_initResponse();
31
- }
32
 
33
- /**
34
- * Response for initCheckitems querry
35
- *
36
- * @alias _initResponse
37
- * @return array
38
- */
39
- protected function _initCheckitemsResponse()
40
- {
41
- return $this->_initResponse();
42
  }
43
 
44
  /**
45
- * Response for uploadCatalog querry
46
  *
47
- * @param array $params
48
- * @return array
49
  */
50
- protected function _uploadCatalogResponse($params)
51
  {
52
- $page = $params['page'];
53
- $step = $params['step'];
54
 
55
- $offset = Mage::getStoreConfig('catalog_mapping/upload/offset');
56
- $page += floor($offset/$step);
57
 
58
  $productCollection = Mage::getModel('catalog/product')
59
  ->getCollection()
60
  ->setPageSize($step)
61
  ->setCurPage($page);
62
- /* var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
63
 
64
  $n = Mage::helper('iparcel/api')->submitCatalog($productCollection);
 
 
 
 
65
 
66
  if ($n != -1) {
67
- return array(
68
- 'page'=>$page,
69
- 'step'=>$step,
70
- 'uploaded'=>$n
71
- );
72
- } else {
73
- return array(
74
- 'error'=>'1'
75
- );
76
- }
77
- }
78
-
79
- /**
80
- * Response for _uploadCheckitems querry
81
- *
82
- * @param array $params
83
- * @return array
84
- */
85
- protected function _uploadCheckitemsResponse($params)
86
- {
87
- $page = $params['page'];
88
- $step = $params['step'];
89
-
90
- $productCollection = Mage::getModel('catalog/product')
91
- ->getCollection()
92
- ->setPageSize($step)
93
- ->setCurPage($page);
94
- /* var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
95
-
96
- $n = Mage::helper('iparcel/api')->checkItems($productCollection);
97
-
98
- if ($n != -1) {
99
- return array(
100
  'page' => $page,
101
  'step' => $step,
102
- 'uploaded' => $n
 
103
  );
104
  } else {
105
- return array(
106
  'error' => '1'
107
  );
108
  }
 
 
 
 
 
 
109
  }
110
 
111
  /**
@@ -113,46 +85,7 @@ class Iparcel_All_Adminhtml_Iparcel_Sync_AjaxController extends Mage_Adminhtml_C
113
  */
114
  public function catalogAction()
115
  {
116
- // if is xmlHttp Request
117
- if ($this->getRequest()->isXmlHttpRequest()) {
118
- // proceed it
119
- $params = $this->getRequest()->getParams();
120
- $params['type'] = '_'.$params['type'].'CatalogResponse';
121
- if (method_exists($this, $params['type'])) {
122
- $_response = $this->$params['type']($params);
123
- $this->getResponse()
124
- ->setHeader('Content-type', 'application/json', true)
125
- ->setBody(json_encode($_response));
126
- return;
127
- }
128
- } else {
129
- // show layout if not
130
- $this->loadLayout();
131
- $this->renderLayout();
132
- }
133
- }
134
-
135
- /**
136
- * Check Items request action
137
- */
138
- public function checkitemsAction()
139
- {
140
- // if is xmlHttp Request
141
- if ($this->getRequest()->isXmlHttpRequest()) {
142
- // proceed it
143
- $params = $this->getRequest()->getParams();
144
- $params['type'] = '_'.$params['type'].'CheckItemsResponse';
145
- if (method_exists($this, $params['type'])) {
146
- $_response = $this->$params['type']($params);
147
- $this->getResponse()
148
- ->setHeader('Content-type', 'application/json', true)
149
- ->setBody(json_encode($_response));
150
- return;
151
- }
152
- } else {
153
- // show layout if not
154
- $this->loadLayout();
155
- $this->renderLayout();
156
- }
157
  }
158
  }
9
  class Iparcel_All_Adminhtml_Iparcel_Sync_AjaxController extends Mage_Adminhtml_Controller_Action
10
  {
11
  /**
12
+ * Response for init query
13
  *
14
+ * @return bool
15
  */
16
+ protected function catalogJsonInitAction()
17
  {
18
+ $count = Mage::getModel('catalog/product')
19
+ ->getCollection()
20
+ ->addAttributeToFilter(
21
+ 'type_id', array('in' =>
22
+ array(
23
+ 'simple',
24
+ 'configurable'
25
+ )))
26
+ ->getSize();
27
 
28
+ $response = array(
29
+ 'count' => $count
30
+ );
 
 
 
 
 
 
 
31
 
32
+ $this->getResponse()
33
+ ->setHeader('Content-type', 'application/json', true)
34
+ ->setBody(json_encode($response));
35
+
36
+ return true;
 
 
 
 
37
  }
38
 
39
  /**
40
+ * Response for uploadCatalog query
41
  *
42
+ * @return bool
 
43
  */
44
+ protected function catalogJsonUploadAction()
45
  {
46
+ $params = $this->getRequest()->getParams();
 
47
 
48
+ $page = (int) $params['page'];
49
+ $step = (int) $params['step'];
50
 
51
  $productCollection = Mage::getModel('catalog/product')
52
  ->getCollection()
53
  ->setPageSize($step)
54
  ->setCurPage($page);
55
+ /** @var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
56
 
57
  $n = Mage::helper('iparcel/api')->submitCatalog($productCollection);
58
+ $skuList = array(
59
+ $productCollection->getFirstItem()->getSku(),
60
+ $productCollection->getLastItem()->getSku()
61
+ );
62
 
63
  if ($n != -1) {
64
+ $response = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  'page' => $page,
66
  'step' => $step,
67
+ 'uploaded' => $n,
68
+ 'SKUs' => $skuList
69
  );
70
  } else {
71
+ $response = array(
72
  'error' => '1'
73
  );
74
  }
75
+
76
+ $this->getResponse()
77
+ ->setHeader('Content-type', 'application/json', true)
78
+ ->setBody(json_encode($response));
79
+
80
+ return true;
81
  }
82
 
83
  /**
85
  */
86
  public function catalogAction()
87
  {
88
+ $this->loadLayout();
89
+ $this->renderLayout();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
91
  }
app/code/community/Iparcel/All/controllers/Adminhtml/Iparcel/SyncController.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- /**
3
- * Adminhtml i-parcel sync controller
4
- *
5
- * @category Iparcel
6
- * @package Iparcel_All
7
- * @author Bobby Burden <bburden@i-parcel.com>
8
- */
9
- class Iparcel_All_Adminhtml_Iparcel_SyncController extends Mage_Adminhtml_Controller_Action
10
- {
11
- public function salesruleAction()
12
- {
13
- $_salesRuleCollection = Mage::getResourceModel('salesrule/rule_collection');
14
- /* var $_salesRuleCollection Mage_SalesRule_Model_Resource_Rule_Collection */
15
- Mage::helper('iparcel/api')->salesRule($_salesRuleCollection);
16
- $this->_redirectReferer();
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iparcel/All/controllers/AjaxController.php CHANGED
@@ -51,7 +51,9 @@ class Iparcel_All_AjaxController extends Mage_Core_Controller_Front_Action
51
  }
52
  }
53
 
54
- $sku = $child->getSku();
 
 
55
 
56
  } else {
57
  /**
51
  }
52
  }
53
 
54
+ if (is_null($child) == false) {
55
+ $sku = $child->getSku();
56
+ }
57
 
58
  } else {
59
  /**
app/code/community/Iparcel/All/controllers/InfoController.php CHANGED
@@ -13,36 +13,10 @@ class Iparcel_All_InfoController extends Mage_Core_Controller_Front_Action
13
  */
14
  public function indexAction()
15
  {
16
- $versions = $this->_gatherExtensionVersions();
17
 
18
  foreach ($versions as $key => $version) {
19
  print "<b>$key</b>: $version<br />";
20
  }
21
  }
22
-
23
- /**
24
- * Gathers extension versions for any installed i-parcel extensions
25
- *
26
- * @return array
27
- */
28
- private function _gatherExtensionVersions()
29
- {
30
- $extensions = array(
31
- 'Iparcel_All' => 0,
32
- 'Iparcel_GlobaleCommerce' => 0,
33
- 'Iparcel_Logistics' => 0
34
- );
35
-
36
- $allExtensions = Mage::app()->getConfig()->getNode('modules')->asArray();
37
-
38
- foreach ($extensions as $key => &$version) {
39
- if (array_key_exists($key, $allExtensions)) {
40
- $version = $allExtensions[$key]['version'];
41
- } else {
42
- unset($extensions[$key]);
43
- }
44
- }
45
-
46
- return $extensions;
47
- }
48
  }
13
  */
14
  public function indexAction()
15
  {
16
+ $versions = Mage::helper('iparcel')->gatherExtensionVersions();
17
 
18
  foreach ($versions as $key => $version) {
19
  print "<b>$key</b>: $version<br />";
20
  }
21
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  }
app/code/community/Iparcel/All/controllers/InternationalController.php CHANGED
@@ -26,10 +26,10 @@ class Iparcel_All_InternationalController extends Mage_Core_Controller_Front_Act
26
  $this->_prepareHeaders();
27
  $current = Mage::helper('iparcel/international')->getInternational();
28
  if ($current) {
29
- echo 'false';
30
  } else {
31
  Mage::helper('iparcel/international')->setInternational(true);
32
- echo 'true';
33
  }
34
  }
35
 
@@ -42,9 +42,9 @@ class Iparcel_All_InternationalController extends Mage_Core_Controller_Front_Act
42
  $current = Mage::helper('iparcel/international')->getInternational();
43
  if ($current) {
44
  Mage::helper('iparcel/international')->setInternational(false);
45
- echo 'true';
46
  } else {
47
- echo 'false';
48
  }
49
  }
50
  }
26
  $this->_prepareHeaders();
27
  $current = Mage::helper('iparcel/international')->getInternational();
28
  if ($current) {
29
+ $this->getResponse()->setBody('false');
30
  } else {
31
  Mage::helper('iparcel/international')->setInternational(true);
32
+ $this->getResponse()->setBody('true');
33
  }
34
  }
35
 
42
  $current = Mage::helper('iparcel/international')->getInternational();
43
  if ($current) {
44
  Mage::helper('iparcel/international')->setInternational(false);
45
+ $this->getResponse()->setBody('true');
46
  } else {
47
+ $this->getResponse()->setBody('false');
48
  }
49
  }
50
  }
app/code/community/Iparcel/All/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Iparcel_All>
5
- <version>1.2.1</version>
6
  </Iparcel_All>
7
  </modules>
8
  <frontend>
@@ -57,6 +57,9 @@
57
  <log>
58
  <table>iparcel_all_log</table>
59
  </log>
 
 
 
60
  </entities>
61
  </iparcel_resource>
62
  <sales>
2
  <config>
3
  <modules>
4
  <Iparcel_All>
5
+ <version>1.3.0</version>
6
  </Iparcel_All>
7
  </modules>
8
  <frontend>
57
  <log>
58
  <table>iparcel_all_log</table>
59
  </log>
60
+ <tracking_number>
61
+ <table>iparcel_all_tracking_number</table>
62
+ </tracking_number>
63
  </entities>
64
  </iparcel_resource>
65
  <sales>
app/code/community/Iparcel/All/etc/system.xml CHANGED
@@ -11,9 +11,9 @@
11
  <iparcel translate="label" module="iparcel">
12
  <label>i-parcel</label>
13
  <sort_order>9999</sort_order>
14
- <show_in_default>0</show_in_default>
15
- <show_in_website>0</show_in_website>
16
- <show_in_store>0</show_in_store>
17
  </iparcel>
18
  </groups>
19
  </payment>
@@ -24,9 +24,9 @@
24
  <label>i-parcel</label>
25
  <frontend_type>text</frontend_type>
26
  <sort_order>99</sort_order>
27
- <show_in_default>0</show_in_default>
28
- <show_in_website>0</show_in_website>
29
- <show_in_store>0</show_in_store>
30
  <fields>
31
  <active translate="label">
32
  <label>Enabled</label>
@@ -126,7 +126,7 @@
126
  <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
127
  <show_in_default>1</show_in_default>
128
  <show_in_website>1</show_in_website>
129
- <show_in_store>0</show_in_store>
130
  </sallowspecific>
131
  <specificcountry translate="label">
132
  <label>Ship to Specific Countries</label>
@@ -135,7 +135,7 @@
135
  <source_model>adminhtml/system_config_source_country</source_model>
136
  <show_in_default>1</show_in_default>
137
  <show_in_website>1</show_in_website>
138
- <show_in_store>0</show_in_store>
139
  <can_be_empty>1</can_be_empty>
140
  </specificcountry>
141
  </fields>
@@ -149,7 +149,7 @@
149
  <sort_order>100</sort_order>
150
  <show_in_default>1</show_in_default>
151
  <show_in_website>1</show_in_website>
152
- <show_in_store>0</show_in_store>
153
  <groups>
154
  <config translate="label">
155
  <label>General</label>
@@ -157,7 +157,7 @@
157
  <sort_order>0</sort_order>
158
  <show_in_default>1</show_in_default>
159
  <show_in_website>1</show_in_website>
160
- <show_in_store>0</show_in_store>
161
  <expanded>1</expanded>
162
  <fields>
163
  <custid translate="label">
@@ -166,7 +166,7 @@
166
  <sort_order>2</sort_order>
167
  <show_in_default>1</show_in_default>
168
  <show_in_website>1</show_in_website>
169
- <show_in_store>0</show_in_store>
170
  <tooltip>This is the Company ID provided by i-parcel.</tooltip>
171
  </custid>
172
  <userid translate="label">
@@ -175,7 +175,7 @@
175
  <sort_order>3</sort_order>
176
  <show_in_default>1</show_in_default>
177
  <show_in_website>1</show_in_website>
178
- <show_in_store>0</show_in_store>
179
  <tooltip>This is Web Service Key provided by i-parcel.</tooltip>
180
  </userid>
181
  <dashboard>
@@ -193,9 +193,9 @@
193
  <label>Scripts</label>
194
  <frontend_type>text</frontend_type>
195
  <sort_order>5</sort_order>
196
- <show_in_default>0</show_in_default>
197
- <show_in_website>0</show_in_website>
198
- <show_in_store>0</show_in_store>
199
  <fields>
200
  <scripts translate="label">
201
  <label>Enable Frontend Scripts</label>
@@ -204,7 +204,7 @@
204
  <sort_order>5</sort_order>
205
  <show_in_default>1</show_in_default>
206
  <show_in_website>1</show_in_website>
207
- <show_in_store>0</show_in_store>
208
  </scripts>
209
  <jquery translate="label">
210
  <label>Enable jQuery</label>
@@ -213,8 +213,8 @@
213
  <source_model>adminhtml/system_config_source_yesno</source_model>
214
  <sort_order>10</sort_order>
215
  <show_in_default>1</show_in_default>
216
- <show_in_website>0</show_in_website>
217
- <show_in_store>0</show_in_store>
218
  </jquery>
219
  <post translate="label">
220
  <label>Custom POST scripts</label>
@@ -231,9 +231,9 @@
231
  <label>International Customer</label>
232
  <frontend_type>text</frontend_type>
233
  <sort_order>10</sort_order>
234
- <show_in_default>0</show_in_default>
235
- <show_in_website>0</show_in_website>
236
- <show_in_store>0</show_in_store>
237
  <fields>
238
  <enable translate="label">
239
  <label>Enabled</label>
@@ -260,9 +260,9 @@
260
  <label>Tax Intercepting</label>
261
  <frontend_type>text</frontend_type>
262
  <sort_order>15</sort_order>
263
- <show_in_default>0</show_in_default>
264
- <show_in_website>0</show_in_website>
265
- <show_in_store>0</show_in_store>
266
  <expanded>1</expanded>
267
  <fields>
268
  <mode translate="label">
@@ -318,7 +318,7 @@
318
  <sort_order>110</sort_order>
319
  <show_in_default>1</show_in_default>
320
  <show_in_website>1</show_in_website>
321
- <show_in_store>0</show_in_store>
322
  <groups>
323
  <config translate="label">
324
  <label>Configuration</label>
@@ -326,7 +326,7 @@
326
  <sort_order>0</sort_order>
327
  <show_in_default>1</show_in_default>
328
  <show_in_website>1</show_in_website>
329
- <show_in_store>0</show_in_store>
330
  <expanded>1</expanded>
331
  <fields>
332
  <auto_upload translate="label">
@@ -337,7 +337,7 @@
337
  <sort_order>5</sort_order>
338
  <show_in_default>1</show_in_default>
339
  <show_in_website>1</show_in_website>
340
- <show_in_store>0</show_in_store>
341
  </auto_upload>
342
  <cron_frequency translate="label">
343
  <label>Frequency</label>
@@ -346,7 +346,7 @@
346
  <sort_order>99</sort_order>
347
  <show_in_default>1</show_in_default>
348
  <show_in_website>1</show_in_website>
349
- <show_in_store>0</show_in_store>
350
  <depends>
351
  <auto_upload>2</auto_upload>
352
  </depends>
@@ -358,7 +358,7 @@
358
  <backend_model>iparcel/system_config_data_time_hour</backend_model>
359
  <show_in_default>1</show_in_default>
360
  <show_in_website>1</show_in_website>
361
- <show_in_store>0</show_in_store>
362
  <depends>
363
  <auto_upload>2</auto_upload>
364
  </depends>
@@ -370,7 +370,7 @@
370
  <backend_model>iparcel/system_config_data_time_minute</backend_model>
371
  <show_in_default>1</show_in_default>
372
  <show_in_website>1</show_in_website>
373
- <show_in_store>0</show_in_store>
374
  <depends>
375
  <auto_upload>2</auto_upload>
376
  </depends>
@@ -382,7 +382,7 @@
382
  <backend_model>iparcel/system_config_data_date_monthday</backend_model>
383
  <show_in_default>1</show_in_default>
384
  <show_in_website>1</show_in_website>
385
- <show_in_store>0</show_in_store>
386
  <depends>
387
  <auto_upload>2</auto_upload>
388
  <cron_frequency>M</cron_frequency>
@@ -396,7 +396,7 @@
396
  <backend_model>iparcel/system_config_data_date_weekday</backend_model>
397
  <show_in_default>1</show_in_default>
398
  <show_in_website>1</show_in_website>
399
- <show_in_store>0</show_in_store>
400
  <depends>
401
  <auto_upload>2</auto_upload>
402
  <cron_frequency>W</cron_frequency>
@@ -410,7 +410,7 @@
410
  <sort_order>0</sort_order>
411
  <show_in_default>1</show_in_default>
412
  <show_in_website>1</show_in_website>
413
- <show_in_store>0</show_in_store>
414
  <expanded>1</expanded>
415
  <fields>
416
  <upload translate="label">
@@ -420,7 +420,7 @@
420
  <sort_order>1</sort_order>
421
  <show_in_default>1</show_in_default>
422
  <show_in_website>1</show_in_website>
423
- <show_in_store>0</show_in_store>
424
  <tooltip>If this button is pressed, the catalog will be uploaded to i-parcel.</tooltip>
425
  <comment>This may take some time</comment>
426
  </upload>
@@ -429,8 +429,8 @@
429
  <frontend_type>text</frontend_type>
430
  <sort_order>10</sort_order>
431
  <show_in_default>1</show_in_default>
432
- <show_in_website>0</show_in_website>
433
- <show_in_store>0</show_in_store>
434
  <validate>validate-number validate-greater-than-zero</validate>
435
  </step>
436
  <offset translate="label">
@@ -438,8 +438,8 @@
438
  <frontend_type>text</frontend_type>
439
  <sort_order>20</sort_order>
440
  <show_in_default>1</show_in_default>
441
- <show_in_website>0</show_in_website>
442
- <show_in_store>0</show_in_store>
443
  <validate>validate-number validate-zero-or-greater</validate>
444
  </offset>
445
  </fields>
@@ -449,8 +449,8 @@
449
  <frontend_type>text</frontend_type>
450
  <sort_order>5</sort_order>
451
  <show_in_default>1</show_in_default>
452
- <show_in_website>0</show_in_website>
453
- <show_in_store>0</show_in_store>
454
  <expanded>1</expanded>
455
  <fields>
456
  <attribute1 translate="label">
@@ -460,7 +460,7 @@
460
  <sort_order>6</sort_order>
461
  <show_in_default>1</show_in_default>
462
  <show_in_website>1</show_in_website>
463
- <show_in_store>0</show_in_store>
464
  </attribute1>
465
  <attribute2 translate="label">
466
  <label>Attribute 2</label>
@@ -469,7 +469,7 @@
469
  <sort_order>11</sort_order>
470
  <show_in_default>1</show_in_default>
471
  <show_in_website>1</show_in_website>
472
- <show_in_store>0</show_in_store>
473
  </attribute2>
474
  <attribute3 translate="label">
475
  <label>Attribute 3</label>
@@ -478,7 +478,7 @@
478
  <sort_order>16</sort_order>
479
  <show_in_default>1</show_in_default>
480
  <show_in_website>1</show_in_website>
481
- <show_in_store>0</show_in_store>
482
  </attribute3>
483
  <attribute4 translate="label">
484
  <label>Attribute 4</label>
@@ -487,7 +487,7 @@
487
  <sort_order>21</sort_order>
488
  <show_in_default>1</show_in_default>
489
  <show_in_website>1</show_in_website>
490
- <show_in_store>0</show_in_store>
491
  </attribute4>
492
  <attribute5 translate="label">
493
  <label>Attribute 5</label>
@@ -496,7 +496,7 @@
496
  <sort_order>26</sort_order>
497
  <show_in_default>1</show_in_default>
498
  <show_in_website>1</show_in_website>
499
- <show_in_store>0</show_in_store>
500
  </attribute5>
501
  <attribute6 translate="label">
502
  <label>Attribute 6</label>
@@ -505,7 +505,7 @@
505
  <sort_order>31</sort_order>
506
  <show_in_default>1</show_in_default>
507
  <show_in_website>1</show_in_website>
508
- <show_in_store>0</show_in_store>
509
  </attribute6>
510
  <hscodeus translate="label">
511
  <label>HS Code</label>
@@ -514,7 +514,7 @@
514
  <sort_order>36</sort_order>
515
  <show_in_default>1</show_in_default>
516
  <show_in_website>1</show_in_website>
517
- <show_in_store>0</show_in_store>
518
  </hscodeus>
519
  <shipalone translate="label">
520
  <label>Ship Alone</label>
@@ -523,7 +523,7 @@
523
  <sort_order>41</sort_order>
524
  <show_in_default>1</show_in_default>
525
  <show_in_website>1</show_in_website>
526
- <show_in_store>0</show_in_store>
527
  <comment>Only boolean attributes</comment>
528
  </shipalone>
529
  <price_type translate="label">
@@ -533,7 +533,7 @@
533
  <sort_order>46</sort_order>
534
  <show_in_default>1</show_in_default>
535
  <show_in_website>1</show_in_website>
536
- <show_in_store>0</show_in_store>
537
  <comment>Price type for configurable products</comment>
538
  </price_type>
539
  <height translate="label">
@@ -543,7 +543,7 @@
543
  <sort_order>47</sort_order>
544
  <show_in_default>1</show_in_default>
545
  <show_in_website>1</show_in_website>
546
- <show_in_store>0</show_in_store>
547
  </height>
548
  <width translate="label">
549
  <label>Width</label>
@@ -552,7 +552,7 @@
552
  <sort_order>47</sort_order>
553
  <show_in_default>1</show_in_default>
554
  <show_in_website>1</show_in_website>
555
- <show_in_store>0</show_in_store>
556
  </width>
557
  <weight translate="label">
558
  <label>Weight</label>
@@ -561,7 +561,7 @@
561
  <sort_order>47</sort_order>
562
  <show_in_default>1</show_in_default>
563
  <show_in_website>1</show_in_website>
564
- <show_in_store>0</show_in_store>
565
  </weight>
566
  <length translate="label">
567
  <label>Length</label>
@@ -570,7 +570,7 @@
570
  <sort_order>47</sort_order>
571
  <show_in_default>1</show_in_default>
572
  <show_in_website>1</show_in_website>
573
- <show_in_store>0</show_in_store>
574
  </length>
575
  <price translate="label">
576
  <label>Price</label>
@@ -579,7 +579,7 @@
579
  <sort_order>47</sort_order>
580
  <show_in_default>1</show_in_default>
581
  <show_in_website>1</show_in_website>
582
- <show_in_store>0</show_in_store>
583
  </price>
584
  </fields>
585
  </attributes>
11
  <iparcel translate="label" module="iparcel">
12
  <label>i-parcel</label>
13
  <sort_order>9999</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
  </iparcel>
18
  </groups>
19
  </payment>
24
  <label>i-parcel</label>
25
  <frontend_type>text</frontend_type>
26
  <sort_order>99</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
  <fields>
31
  <active translate="label">
32
  <label>Enabled</label>
126
  <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
127
  <show_in_default>1</show_in_default>
128
  <show_in_website>1</show_in_website>
129
+ <show_in_store>1</show_in_store>
130
  </sallowspecific>
131
  <specificcountry translate="label">
132
  <label>Ship to Specific Countries</label>
135
  <source_model>adminhtml/system_config_source_country</source_model>
136
  <show_in_default>1</show_in_default>
137
  <show_in_website>1</show_in_website>
138
+ <show_in_store>1</show_in_store>
139
  <can_be_empty>1</can_be_empty>
140
  </specificcountry>
141
  </fields>
149
  <sort_order>100</sort_order>
150
  <show_in_default>1</show_in_default>
151
  <show_in_website>1</show_in_website>
152
+ <show_in_store>1</show_in_store>
153
  <groups>
154
  <config translate="label">
155
  <label>General</label>
157
  <sort_order>0</sort_order>
158
  <show_in_default>1</show_in_default>
159
  <show_in_website>1</show_in_website>
160
+ <show_in_store>1</show_in_store>
161
  <expanded>1</expanded>
162
  <fields>
163
  <custid translate="label">
166
  <sort_order>2</sort_order>
167
  <show_in_default>1</show_in_default>
168
  <show_in_website>1</show_in_website>
169
+ <show_in_store>1</show_in_store>
170
  <tooltip>This is the Company ID provided by i-parcel.</tooltip>
171
  </custid>
172
  <userid translate="label">
175
  <sort_order>3</sort_order>
176
  <show_in_default>1</show_in_default>
177
  <show_in_website>1</show_in_website>
178
+ <show_in_store>1</show_in_store>
179
  <tooltip>This is Web Service Key provided by i-parcel.</tooltip>
180
  </userid>
181
  <dashboard>
193
  <label>Scripts</label>
194
  <frontend_type>text</frontend_type>
195
  <sort_order>5</sort_order>
196
+ <show_in_default>1</show_in_default>
197
+ <show_in_website>1</show_in_website>
198
+ <show_in_store>1</show_in_store>
199
  <fields>
200
  <scripts translate="label">
201
  <label>Enable Frontend Scripts</label>
204
  <sort_order>5</sort_order>
205
  <show_in_default>1</show_in_default>
206
  <show_in_website>1</show_in_website>
207
+ <show_in_store>1</show_in_store>
208
  </scripts>
209
  <jquery translate="label">
210
  <label>Enable jQuery</label>
213
  <source_model>adminhtml/system_config_source_yesno</source_model>
214
  <sort_order>10</sort_order>
215
  <show_in_default>1</show_in_default>
216
+ <show_in_website>1</show_in_website>
217
+ <show_in_store>1</show_in_store>
218
  </jquery>
219
  <post translate="label">
220
  <label>Custom POST scripts</label>
231
  <label>International Customer</label>
232
  <frontend_type>text</frontend_type>
233
  <sort_order>10</sort_order>
234
+ <show_in_default>1</show_in_default>
235
+ <show_in_website>1</show_in_website>
236
+ <show_in_store>1</show_in_store>
237
  <fields>
238
  <enable translate="label">
239
  <label>Enabled</label>
260
  <label>Tax Intercepting</label>
261
  <frontend_type>text</frontend_type>
262
  <sort_order>15</sort_order>
263
+ <show_in_default>1</show_in_default>
264
+ <show_in_website>1</show_in_website>
265
+ <show_in_store>1</show_in_store>
266
  <expanded>1</expanded>
267
  <fields>
268
  <mode translate="label">
318
  <sort_order>110</sort_order>
319
  <show_in_default>1</show_in_default>
320
  <show_in_website>1</show_in_website>
321
+ <show_in_store>1</show_in_store>
322
  <groups>
323
  <config translate="label">
324
  <label>Configuration</label>
326
  <sort_order>0</sort_order>
327
  <show_in_default>1</show_in_default>
328
  <show_in_website>1</show_in_website>
329
+ <show_in_store>1</show_in_store>
330
  <expanded>1</expanded>
331
  <fields>
332
  <auto_upload translate="label">
337
  <sort_order>5</sort_order>
338
  <show_in_default>1</show_in_default>
339
  <show_in_website>1</show_in_website>
340
+ <show_in_store>1</show_in_store>
341
  </auto_upload>
342
  <cron_frequency translate="label">
343
  <label>Frequency</label>
346
  <sort_order>99</sort_order>
347
  <show_in_default>1</show_in_default>
348
  <show_in_website>1</show_in_website>
349
+ <show_in_store>1</show_in_store>
350
  <depends>
351
  <auto_upload>2</auto_upload>
352
  </depends>
358
  <backend_model>iparcel/system_config_data_time_hour</backend_model>
359
  <show_in_default>1</show_in_default>
360
  <show_in_website>1</show_in_website>
361
+ <show_in_store>1</show_in_store>
362
  <depends>
363
  <auto_upload>2</auto_upload>
364
  </depends>
370
  <backend_model>iparcel/system_config_data_time_minute</backend_model>
371
  <show_in_default>1</show_in_default>
372
  <show_in_website>1</show_in_website>
373
+ <show_in_store>1</show_in_store>
374
  <depends>
375
  <auto_upload>2</auto_upload>
376
  </depends>
382
  <backend_model>iparcel/system_config_data_date_monthday</backend_model>
383
  <show_in_default>1</show_in_default>
384
  <show_in_website>1</show_in_website>
385
+ <show_in_store>1</show_in_store>
386
  <depends>
387
  <auto_upload>2</auto_upload>
388
  <cron_frequency>M</cron_frequency>
396
  <backend_model>iparcel/system_config_data_date_weekday</backend_model>
397
  <show_in_default>1</show_in_default>
398
  <show_in_website>1</show_in_website>
399
+ <show_in_store>1</show_in_store>
400
  <depends>
401
  <auto_upload>2</auto_upload>
402
  <cron_frequency>W</cron_frequency>
410
  <sort_order>0</sort_order>
411
  <show_in_default>1</show_in_default>
412
  <show_in_website>1</show_in_website>
413
+ <show_in_store>1</show_in_store>
414
  <expanded>1</expanded>
415
  <fields>
416
  <upload translate="label">
420
  <sort_order>1</sort_order>
421
  <show_in_default>1</show_in_default>
422
  <show_in_website>1</show_in_website>
423
+ <show_in_store>1</show_in_store>
424
  <tooltip>If this button is pressed, the catalog will be uploaded to i-parcel.</tooltip>
425
  <comment>This may take some time</comment>
426
  </upload>
429
  <frontend_type>text</frontend_type>
430
  <sort_order>10</sort_order>
431
  <show_in_default>1</show_in_default>
432
+ <show_in_website>1</show_in_website>
433
+ <show_in_store>1</show_in_store>
434
  <validate>validate-number validate-greater-than-zero</validate>
435
  </step>
436
  <offset translate="label">
438
  <frontend_type>text</frontend_type>
439
  <sort_order>20</sort_order>
440
  <show_in_default>1</show_in_default>
441
+ <show_in_website>1</show_in_website>
442
+ <show_in_store>1</show_in_store>
443
  <validate>validate-number validate-zero-or-greater</validate>
444
  </offset>
445
  </fields>
449
  <frontend_type>text</frontend_type>
450
  <sort_order>5</sort_order>
451
  <show_in_default>1</show_in_default>
452
+ <show_in_website>1</show_in_website>
453
+ <show_in_store>1</show_in_store>
454
  <expanded>1</expanded>
455
  <fields>
456
  <attribute1 translate="label">
460
  <sort_order>6</sort_order>
461
  <show_in_default>1</show_in_default>
462
  <show_in_website>1</show_in_website>
463
+ <show_in_store>1</show_in_store>
464
  </attribute1>
465
  <attribute2 translate="label">
466
  <label>Attribute 2</label>
469
  <sort_order>11</sort_order>
470
  <show_in_default>1</show_in_default>
471
  <show_in_website>1</show_in_website>
472
+ <show_in_store>1</show_in_store>
473
  </attribute2>
474
  <attribute3 translate="label">
475
  <label>Attribute 3</label>
478
  <sort_order>16</sort_order>
479
  <show_in_default>1</show_in_default>
480
  <show_in_website>1</show_in_website>
481
+ <show_in_store>1</show_in_store>
482
  </attribute3>
483
  <attribute4 translate="label">
484
  <label>Attribute 4</label>
487
  <sort_order>21</sort_order>
488
  <show_in_default>1</show_in_default>
489
  <show_in_website>1</show_in_website>
490
+ <show_in_store>1</show_in_store>
491
  </attribute4>
492
  <attribute5 translate="label">
493
  <label>Attribute 5</label>
496
  <sort_order>26</sort_order>
497
  <show_in_default>1</show_in_default>
498
  <show_in_website>1</show_in_website>
499
+ <show_in_store>1</show_in_store>
500
  </attribute5>
501
  <attribute6 translate="label">
502
  <label>Attribute 6</label>
505
  <sort_order>31</sort_order>
506
  <show_in_default>1</show_in_default>
507
  <show_in_website>1</show_in_website>
508
+ <show_in_store>1</show_in_store>
509
  </attribute6>
510
  <hscodeus translate="label">
511
  <label>HS Code</label>
514
  <sort_order>36</sort_order>
515
  <show_in_default>1</show_in_default>
516
  <show_in_website>1</show_in_website>
517
+ <show_in_store>1</show_in_store>
518
  </hscodeus>
519
  <shipalone translate="label">
520
  <label>Ship Alone</label>
523
  <sort_order>41</sort_order>
524
  <show_in_default>1</show_in_default>
525
  <show_in_website>1</show_in_website>
526
+ <show_in_store>1</show_in_store>
527
  <comment>Only boolean attributes</comment>
528
  </shipalone>
529
  <price_type translate="label">
533
  <sort_order>46</sort_order>
534
  <show_in_default>1</show_in_default>
535
  <show_in_website>1</show_in_website>
536
+ <show_in_store>1</show_in_store>
537
  <comment>Price type for configurable products</comment>
538
  </price_type>
539
  <height translate="label">
543
  <sort_order>47</sort_order>
544
  <show_in_default>1</show_in_default>
545
  <show_in_website>1</show_in_website>
546
+ <show_in_store>1</show_in_store>
547
  </height>
548
  <width translate="label">
549
  <label>Width</label>
552
  <sort_order>47</sort_order>
553
  <show_in_default>1</show_in_default>
554
  <show_in_website>1</show_in_website>
555
+ <show_in_store>1</show_in_store>
556
  </width>
557
  <weight translate="label">
558
  <label>Weight</label>
561
  <sort_order>47</sort_order>
562
  <show_in_default>1</show_in_default>
563
  <show_in_website>1</show_in_website>
564
+ <show_in_store>1</show_in_store>
565
  </weight>
566
  <length translate="label">
567
  <label>Length</label>
570
  <sort_order>47</sort_order>
571
  <show_in_default>1</show_in_default>
572
  <show_in_website>1</show_in_website>
573
+ <show_in_store>1</show_in_store>
574
  </length>
575
  <price translate="label">
576
  <label>Price</label>
579
  <sort_order>47</sort_order>
580
  <show_in_default>1</show_in_default>
581
  <show_in_website>1</show_in_website>
582
+ <show_in_store>1</show_in_store>
583
  </price>
584
  </fields>
585
  </attributes>
app/code/community/Iparcel/All/sql/iparcel_setup/mysql4-upgrade-1.1.0-1.1.1.php CHANGED
@@ -16,10 +16,13 @@ $options = array(
16
  );
17
 
18
  foreach ($entities as $entity) {
19
- $installer->addAttribute($entity, 'base_iparcel_duty_amount', $options);
20
- $installer->addAttribute($entity, 'iparcel_duty_amount', $options);
21
- $installer->addAttribute($entity, 'base_iparcel_tax_amount', $options);
22
- $installer->addAttribute($entity, 'iparcel_tax_amount', $options);
 
 
 
23
  }
24
 
25
  $installer->endSetup();
16
  );
17
 
18
  foreach ($entities as $entity) {
19
+ $dutyCode = Mage::getModel('iparcel/payment_iparcel')->getDutyCode();
20
+ $taxCode = Mage::getModel('iparcel/payment_iparcel')->getTaxCode();
21
+
22
+ $installer->addAttribute($entity, 'base_' . $dutyCode . '_amount', $options);
23
+ $installer->addAttribute($entity, $dutyCode . '_amount', $options);
24
+ $installer->addAttribute($entity, 'base_' . $taxCode . '_amount', $options);
25
+ $installer->addAttribute($entity, $taxCode . '_amount', $options);
26
  }
27
 
28
  $installer->endSetup();
app/code/community/Iparcel/All/sql/iparcel_setup/mysql4-upgrade-1.2.1-1.3.0.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ // Create a table to store tracking_number -> order relationship
7
+ $installer->run("
8
+ DROP TABLE IF EXISTS {$this->getTable('iparcel/tracking_number')};
9
+ CREATE TABLE {$this->getTable('iparcel/tracking_number')} (
10
+ `id` int(11) unsigned NOT NULL auto_increment,
11
+ `tracking_number` varchar(255) NOT NULL,
12
+ `order_id` int(11) NOT NULL,
13
+ PRIMARY KEY (`id`)
14
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
15
+ ");
16
+
17
+ $installer->endSetup();
app/code/community/Iparcel/Logistics/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Iparcel_Logistics>
5
- <version>1.3.0</version>
6
  </Iparcel_Logistics>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Iparcel_Logistics>
5
+ <version>1.4.0</version>
6
  </Iparcel_Logistics>
7
  </modules>
8
  <global>
app/design/adminhtml/default/default/layout/iparcel.xml CHANGED
@@ -32,20 +32,9 @@
32
  <action method="setTitle"><title>i-parcel Catalog Upload</title></action>
33
  </reference>
34
  <reference name="content">
35
- <block type="core/template" name="catalog.sync" template="iparcel/sync/ajax/catalog.phtml"/>
36
  </reference>
37
  </adminhtml_iparcel_sync_ajax_catalog>
38
- <adminhtml_iparcel_sync_ajax_checkitems>
39
- <reference name="head">
40
- <action method="addJs"><script>iparcel/jQuery.js</script></action>
41
- <action method="addJs"><script>iparcel/adminhtml/sync.js</script></action>
42
- <action method="addCss"><stylesheet>iparcel/ajaxSync.css</stylesheet></action>
43
- <action method="setTitle"><title>i-parcel Check Items</title></action>
44
- </reference>
45
- <reference name="content">
46
- <block type="core/template" name="checkitems.sync" template="iparcel/sync/ajax/checkitems.phtml" />
47
- </reference>
48
- </adminhtml_iparcel_sync_ajax_checkitems>
49
 
50
  <adminhtml_sales_order_view>
51
  <reference name="order_totals">
32
  <action method="setTitle"><title>i-parcel Catalog Upload</title></action>
33
  </reference>
34
  <reference name="content">
35
+ <block type="iparcel/adminhtml_iparcel_sync" name="iparcel_catalog_sync" template="iparcel/sync/ajax/catalog.phtml"/>
36
  </reference>
37
  </adminhtml_iparcel_sync_ajax_catalog>
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  <adminhtml_sales_order_view>
40
  <reference name="order_totals">
app/design/adminhtml/default/default/template/iparcel/sync/ajax/catalog.phtml CHANGED
@@ -1,23 +1,21 @@
1
  <?php
2
  /**
3
- * @category design
4
- * @package Iparcel_All
5
- * @author Bobby Burden <bburden@i-parcel.com>
6
- * @class Mage_Core_Block_Template
7
  */
 
 
8
  ?>
9
- <div id="starting">
10
- <p>Starting catalog synchronization</p>
11
- </div>
12
- <div id="sync">
13
- <p><span>0</span> items from <span>0</span> uploaded</p>
14
- </div>
15
- <div id="end">
16
- <p><span>0</span> items from <span>0</span> successfully uploaded</p>
17
- <p>There was <span>0</span> errors when uploading catalog</p>
18
  </div>
 
19
  <script type="text/javascript">
20
- jQuery(document).ready(function() {
21
- var sync = new iparcelSync.sync('<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/iparcel_sync_ajax/catalog') ?>?isAjax=true', <?php echo Mage::getStoreConfig('catalog_mapping/upload/step'); ?>);
22
- })
23
  </script>
1
  <?php
2
  /**
3
+ * @category design
4
+ * @package Iparcel_All
5
+ * @author Bobby Burden <bburden@i-parcel.com>
6
+ * @class Mage_Core_Block_Template
7
  */
8
+ $initUrl = Mage::helper('adminhtml')->getUrl('adminhtml/iparcel_sync_ajax/catalogJsonInit');
9
+ $uploadUrl = Mage::helper('adminhtml')->getUrl('adminhtml/iparcel_sync_ajax/catalogJsonUpload');
10
  ?>
11
+ <?php echo $this->getStartButton(); ?>
12
+
13
+ <div id="message">
14
+ <p>Click "Start" to begin the Catalog Sync</p>
 
 
 
 
 
15
  </div>
16
+ <textarea id="log-area" wrap="off"></textarea>
17
  <script type="text/javascript">
18
+ jQuery(document).ready(function() {
19
+ window.catalogSync = new iparcelSync('<?php echo $initUrl ?>', '<?php echo $uploadUrl ?>', <?php echo Mage::getStoreConfig('catalog_mapping/upload/step'); ?>, jQuery('.middle div button')[0]);
20
+ })
21
  </script>
app/design/adminhtml/default/default/template/iparcel/sync/ajax/checkitems.phtml DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- /**
3
- * @category design
4
- * @package Iparcel_All
5
- * @author Bobby Burden <bburden@i-parcel.com>
6
- * @class Mage_Core_Block_Template
7
- */
8
- ?>
9
- <div id="starting">
10
- <p>Starting checking items</p>
11
- </div>
12
- <div id="sync">
13
- <p><span>0</span> items from <span>0</span> checked</p>
14
- </div>
15
- <div id="end">
16
- <p><span>0</span> items from <span>0</span> successfully checked</p>
17
- <p>There was <span>0</span> errors when checking items</p>
18
- </div>
19
- <script type="text/javascript">
20
- var sync = new iparcelSync.sync('<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/iparcel_sync_ajax/checkitems') ?>?isAjax=true', 1);
21
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/iparcel/adminhtml/shipping-methods.js CHANGED
@@ -9,7 +9,7 @@ toggleCountryOfOrigin = function($altEnabled, $corObject) {
9
  } else {
10
  $corObject.disable();
11
  }
12
- }
13
 
14
  document.observe('dom:loaded', function(event) {
15
  $alternateEnabledObject = $$('#carriers_i-parcel_choose_domestic').first();
@@ -17,7 +17,7 @@ document.observe('dom:loaded', function(event) {
17
  if (typeof($alternateEnabledObject) === 'object') {
18
  toggleCountryOfOrigin($alternateEnabledObject, $countryOfOriginObject);
19
  $alternateEnabledObject.observe('change', function(event) {
20
- toggleCountryOfOrigin($(this), $countryOfOriginObject)
21
  });
22
  }
23
  });
9
  } else {
10
  $corObject.disable();
11
  }
12
+ };
13
 
14
  document.observe('dom:loaded', function(event) {
15
  $alternateEnabledObject = $$('#carriers_i-parcel_choose_domestic').first();
17
  if (typeof($alternateEnabledObject) === 'object') {
18
  toggleCountryOfOrigin($alternateEnabledObject, $countryOfOriginObject);
19
  $alternateEnabledObject.observe('change', function(event) {
20
+ toggleCountryOfOrigin($(this), $countryOfOriginObject);
21
  });
22
  }
23
  });
js/iparcel/adminhtml/sync.js CHANGED
@@ -1,87 +1,99 @@
1
  /**
2
  * js lib for i-parcel's ajax sync
3
  *
4
- * @category Iparcel
5
- * @package Iparcel_All
6
- * @author Bobby Burden <bburden@i-parcel.com>
7
  */
8
- var iparcelSync = {
9
- item: null,
10
- sync: null,
11
- end: null,
 
12
 
13
- /**
14
- * Initialize sync ajax callback
15
- */
16
- init: function (data){
17
- iparcelSync.item.count = data.count;
18
- iparcelSync.sync.eq(1).text(iparcelSync.item.count);
19
- iparcelSync.end.eq(1).text(iparcelSync.item.count);
20
- jQuery('#starting').hide();
21
- jQuery('#sync').show();
22
- jQuery.get(iparcelSync.item.url,{
23
- page: ++iparcelSync.item.page,
24
- step: iparcelSync.item.step,
25
- type: 'upload'
26
- },iparcelSync.refresh);
27
- },
28
 
29
- /**
30
- * Refresh sync ajax callback
31
- */
32
- refresh: function(data){
33
- if (!data.error){
34
- iparcelSync.item.progress += data.uploaded;
35
- iparcelSync.item.errors += iparcelSync.item.step-data.uploaded;
36
- iparcelSync.sync.eq(0).text(iparcelSync.item.progress);
37
- iparcelSync.end.eq(0).text(iparcelSync.item.progress);
38
- }else{
39
- if (iparcelSync.item.page*iparcelSync.item.step > iparcelSync.item.count){
40
- iparcelSync.item.errors += iparcelSync.item.count - iparcelSync.item.progress;
41
- }else{
42
- iparcelSync.item.errors += iparcelSync.item.step;
43
- }
44
- }
45
- if (iparcelSync.item.progress+iparcelSync.item.errors < iparcelSync.item.count){
46
- jQuery.get(iparcelSync.item.url,{
47
- page: ++iparcelSync.item.page,
48
- step: iparcelSync.item.step,
49
- type: 'upload'
50
- },iparcelSync.refresh);
51
- }else{
52
- iparcelSync.finish();
53
- }
54
- },
55
 
56
- /**
57
- * Finish sync
58
- */
59
- finish: function(){
60
- iparcelSync.end.eq(2).text(iparcelSync.item.errors);
61
- jQuery('#sync').hide();
62
- jQuery('#end').show();
63
- },
 
 
 
64
 
65
- /**
66
- * Sync object
67
- */
68
- sync: function(url, step){
69
- this.url = url;
70
- this.step = step;
71
- this.progress = 0;
72
- this.errors = 0;
73
- this.count = 0;
74
- this.page = 0;
75
 
76
- iparcelSync.sync = jQuery('#sync span');
77
- iparcelSync.end = jQuery('#end span');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
- this.run = function (){
80
- jQuery.get(this.url,{type: 'init'}, iparcelSync.init);
81
- }
 
 
 
 
82
 
83
- iparcelSync.item = this;
 
 
 
84
 
85
- this.run();
86
- }
87
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /**
2
  * js lib for i-parcel's ajax sync
3
  *
4
+ * @category Iparcel
5
+ * @package Iparcel_All
6
+ * @author Bobby Burden <bburden@i-parcel.com>
7
  */
8
+ var iparcelSync = function (initUrl, uploadUrl, step, startButton) {
9
+ this.initUrl = initUrl;
10
+ this.uploadUrl = uploadUrl;
11
+ this.step = step;
12
+ this.startButton = startButton;
13
 
14
+ this.progress = 0;
15
+ this.errors = 0;
16
+ this.count = 0;
17
+ this.page = 1;
18
+ this.skus = [];
 
 
 
 
 
 
 
 
 
 
19
 
20
+ this.message = jQuery('#message');
21
+ this.log = jQuery('#log-area');
22
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
+ iparcelSync.prototype.run = function () {
25
+ this.message.html('<p>Catalog Sync running...</p>');
26
+ this.addToLog("Starting Catalog Sync...");
27
+ this.addToLog("Generating colleciton of products to sync. This may take a moment...");
28
+ this.startButton.disable();
29
+ var self = this;
30
+ jQuery.get(this.initUrl, function(data) {
31
+ self.setCount(data.count);
32
+ self.count = data.count;
33
+ self.upload();
34
+ });
35
 
36
+ };
 
 
 
 
 
 
 
 
 
37
 
38
+ iparcelSync.prototype.upload = function() {
39
+ if (this.page == 0
40
+ || (this.count / this.step) > this.page - 1) {
41
+ var payload = {
42
+ page: this.page,
43
+ step: this.step
44
+ };
45
+ var self = this;
46
+ jQuery.get(this.uploadUrl, payload)
47
+ .done(function(data) {
48
+ // Handle errors from the PHP controller
49
+ if (data.error == 1) {
50
+ self.addToLog('Unable to complete sync.');
51
+ self.errors += 1;
52
+ this.finish();
53
+ } else {
54
+ self.progress = self.progress + data.uploaded;
55
+ self.page = ++data.page;
56
+ self.skus = data.SKUs;
57
+ self.updateProgress();
58
+ self.upload();
59
+ }
60
+ });
61
+ } else {
62
+ this.finish();
63
+ }
64
+ };
65
 
66
+ iparcelSync.prototype.finish = function() {
67
+ this.message.html('<p>Catalog Sync Finished.</p>');
68
+ this.addToLog('Finished uploading a total of '
69
+ + this.progress +
70
+ ' compatible SKUs and variations with '
71
+ + this.errors
72
+ + ' errors. \n');
73
 
74
+ this.progress = 0;
75
+ this.errors = 0;
76
+ this.count = 0;
77
+ this.page = 0;
78
 
79
+ this.message.html('<p>Click "Start" to begin the Catalog Sync</p>');
80
+
81
+ this.startButton.enable();
82
+ };
83
+
84
+ iparcelSync.prototype.updateProgress = function() {
85
+ this.addToLog(
86
+ 'Uploaded ' + this.progress + ' products of ' + this.count + '... Synced SKUS "' +
87
+ this.skus[0] + '" through "' + this.skus[1] + '"'
88
+ );
89
+ };
90
+
91
+ iparcelSync.prototype.setCount = function(count) {
92
+ this.addToLog('Found a total of ' + count + ' products');
93
+ };
94
+
95
+ iparcelSync.prototype.addToLog = function (text) {
96
+ text = new Date().toISOString() + ": " + text + "\n";
97
+ this.log.append(text);
98
+ this.log.scrollTop(this.log[0].scrollHeight - this.log.height());
99
+ };
js/iparcel/lib.js CHANGED
@@ -1,45 +1,47 @@
1
  var iparcelMage = {
2
- displayEligibility: function(){
3
- try{
4
- $_ipar.fn.iparcel.ux.displayEligibility();
5
- }catch(exception){}
6
- },
7
- ajax: {
8
- post: function(sku, super_attribute, url) {
9
- var $jip = jQuery.noConflict();
10
- var data = super_attribute+'sku='+sku;
11
- $jip('.iparcelsku').attr('finalsku', 'false');
12
- $jip.ajax({
13
- 'url': url,
14
- 'data': data,
15
- type: 'POST',
16
- async: true,
17
- success: function(data){
18
- if (data){
19
- $jip('.iparcelsku').text(data.sku);
20
- $jip('.iparcelsku').attr('finalsku', 'true');
21
-
22
- iparcelPost.setStock('true');
23
-
24
- var $options = $jip('.iparceloptions');
25
- $options.empty();
26
- $jip.each(data.attributes, function(key, value){
27
- var $block = $jip('<div/>');
28
- $block.attr('id',key);
29
- $block.text(value);
30
- $options.append($block);
31
- });
32
-
33
- $jip('.iparcelstockquantity').text(data.stock);
34
- }
35
- iparcelMage.displayEligibility();
36
- }
37
- });
38
- }
39
- },
40
- parseHtmlEntities: function(str){
41
- var textArea = document.createElement('textarea');
42
- textArea.innerHTML = str;
43
- return textArea.value;
44
- }
45
- }
 
 
1
  var iparcelMage = {
2
+ displayEligibility: function() {
3
+ try{
4
+ $_ipar.fn.iparcel.ux.displayEligibility();
5
+ } catch(exception) {
6
+ }
7
+ },
8
+ ajax: {
9
+ post: function(sku, super_attribute, url) {
10
+ var $jip = jQuery.noConflict();
11
+ var data = super_attribute+'sku='+sku;
12
+ $jip('.' + iparcelPost.iparcelSkuClass).attr('finalsku', 'false');
13
+ $jip.ajax({
14
+ 'url': url,
15
+ 'data': data,
16
+ type: 'POST',
17
+ async: true,
18
+ success: function(data){
19
+ if (data){
20
+ $jip('.' + iparcelPost.iparcelSkuClass).text(data.sku);
21
+ $jip('.' + iparcelPost.iparcelSkuClass).attr('finalsku', 'true');
22
+
23
+ iparcelPost.setStock('true');
24
+
25
+ var $options = $jip('.' + iparcelPost.iparcelOptionsClass);
26
+ $options.empty();
27
+ $jip.each(data.attributes, function(key, value){
28
+ var $block = $jip('<div/>');
29
+ $block.attr('id',key);
30
+ $block.text(value);
31
+ $options.append($block);
32
+ });
33
+
34
+ $jip('.iparcelstockquantity').text(data.stock);
35
+ }
36
+ iparcelMage.displayEligibility();
37
+ }
38
+ });
39
+ }
40
+ },
41
+
42
+ parseHtmlEntities: function(str) {
43
+ var textArea = document.createElement('textarea');
44
+ textArea.innerHTML = str;
45
+ return textArea.value;
46
+ }
47
+ };
js/iparcel/post.js CHANGED
@@ -4,60 +4,98 @@ var iparcelPost = {
4
  url: null,
5
  sku_list_cache: null,
6
  stock_list_cache: null,
7
- textSelectors: '.product-custom-option[type="text"], textarea.product-custom-option',
8
- clear: function () {
9
- $jip('.iparcelsku,.iparcelstock').remove();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  },
11
- single: function(sku, url){
12
- this.sku = sku;
 
 
13
  if (url.indexOf(':') == 0) {
14
  url = url.substring(1,url.length);
15
  }
16
- this.url = url+'iparcel/ajax/configurable';
 
 
17
  $jip(document).ready(function(){
18
  var $sku = $jip("<div/>");
19
- $sku.css("display","none");
20
- $sku.attr("class","iparcelsku");
21
  $sku.text(sku);
22
- $jip('form#product_addtocart_form').append($sku);
23
 
24
  var $options = $jip("<div/>");
25
- $options.css("display","none");
26
- $options.attr("class","iparceloptions");
27
- $jip('form#product_addtocart_form').append($options);
28
 
29
- $jip('.super-attribute-select').change(function(){
30
  iparcelPost.updateSelect();
31
  });
32
 
33
  // if there are '.super-attribute-select' elements, find the SKU
34
  // for the default configuration
35
- if ($jip('.super-attribute-select.required-entry').length > 0) {
36
- $jip('.super-attribute-select.required-entry').each(function() {
37
- this.validOptions = [];
38
-
39
- var self = this;
40
- $jip(this).children().each(function(){
41
- if ($jip(this).val() != '') {
42
- self.validOptions.push($jip(this).val());
43
  }
44
  });
45
 
46
- if (this.validOptions.length == 1) {
47
- // Only one valid option for this required select
48
- $jip(this).val(this.validOptions[0]);
49
  }
50
  });
 
51
  iparcelPost.updateSelect();
52
  }
 
53
  // Watch for custom option text fields, areas
54
- $jip(iparcelPost.textSelectors).change(function() {
55
  iparcelPost.updateTextfields();
56
  });
57
 
58
  var $iterator = 0;
 
 
59
  $jip(document).bind('DOMNodeInserted', function(e){
60
- if ($jip(e.target).attr('class') == 'swatch-link'){
61
  $jip(e.target).click(iparcelPost.update);
62
  if ($iterator++ == 0){
63
  var target = e.target;
@@ -70,87 +108,105 @@ var iparcelPost = {
70
  }
71
  });
72
 
73
- $jip('.swatch-link').click(iparcelPost.update);
74
  });
75
  },
 
76
  update: function(){
77
  var $this = $jip(this);
78
  var id = $this.parent().attr('id').split('option')[1];
79
  var val = $this.attr('id').split('swatch')[1];
80
  var super_attribute = '';
81
- $jip('.super-attribute-select').each(function(){
 
82
  var $this = $jip(this);
83
  if ($this.attr('name') != 'super_attribute['+id+']'){
84
- super_attribute+=$this.attr('name')+'='+$this.val()+'&';
85
  }
86
  });
87
- iparcelMage.ajax.post(iparcelPost.sku,super_attribute,iparcelPost.url);
 
88
  },
 
89
  updateSelect: function () {
90
  iparcelPost.setStock('false');
91
  var $this = $jip(this);
92
  var super_attribute = '';
93
- $jip('.super-attribute-select, .product-custom-option').each(function () {
 
94
  var $this = $jip(this);
95
  super_attribute += $this.attr('name') + '=' + $this.val() + '&';
96
  });
 
97
  iparcelMage.ajax.post(iparcelPost.sku, super_attribute, iparcelPost.url);
98
  },
 
99
  updateTextfields: function() {
100
  iparcelPost.setStock('false');
101
  var custom_options = '';
102
- $jip(iparcelPost.textSelectors).each(function() {
 
103
  var $this = $jip(this);
104
  custom_options += $this.attr('name') + '=' + $this.val() + '&';
105
  });
 
106
  iparcelMage.ajax.post(iparcelPost.sku, custom_options, iparcelPost.url);
107
  },
 
108
  stock: function(qty){
109
- $jip(document).ready(function(){
110
  var $stock = $jip("<div/>");
111
- $stock.css("display","none");
112
- $stock.attr("class","iparcelstock");
113
  $stock.text(qty > 0 ? 'true' : 'false');
114
- $jip('form#product_addtocart_form').append($stock);
115
  });
116
  },
 
117
  setStock: function(value){
118
- $jip('.iparcelstock').text(value);
119
  },
 
120
  sku_list: function (sku_list) {
121
- this.sku_list_cache = sku_list;
122
- $jip(document).ready(function(){
 
123
  $jip.each(sku_list, function(sku,name){
124
  name = iparcelMage.parseHtmlEntities(name);
125
  var $sku = $jip("<div/>");
126
- $sku.css("display","none");
127
- $sku.attr("class","iparcelsku");
128
  $sku.text(sku);
129
  iparcelPost.append($sku,name);
130
  });
131
  });
132
- $jip(document).ajaxSuccess(function(data){
 
133
  iparcelPost.sku_list(sku_list);
134
  });
135
  },
 
136
  stock_list: function(stock_list){
137
  this.stock_list_cache = stock_list;
138
- $jip(document).ready(function(){
 
139
  $jip.each(stock_list, function(name,qty){
140
  name = iparcelMage.parseHtmlEntities(name);
141
  var $stock = $jip("<div/>");
142
- $stock.css("display","none");
143
- $stock.attr("class","iparcelstock");
144
  $stock.text(qty > 0 ? 'true' : 'false');
145
  iparcelPost.append($stock,name);
146
  });
147
  });
148
  },
 
149
  append: function(item,name){
150
- var $item = $jip('.item .product-name a').filter(function () {
151
  return $jip(this).text() == name;
152
  });
153
- $item.closest('.item').append(item);
 
154
  }
155
  };
156
 
@@ -158,12 +214,12 @@ Ajax.Responders.register({
158
  onComplete: function(args){
159
  iparcelPost.sku_list(iparcelPost.sku_list_cache);
160
  iparcelPost.stock_list(iparcelPost.stock_list_cache);
161
- if( typeof iparcel.session !== "undefined" ) {
162
- if( typeof iparcel.session.content !== "undefined" ) {
163
- if( typeof iparcel.session.content.locale !== "undefined" && iparcel.session.content.locale == "US" ) {
 
164
  $_ipar(iparcel.settings.productListingPriceElement).css("visibility","visible");
165
- }
166
- else{
167
  iparcel.ux.displayEligibility();
168
  }
169
  }
4
  url: null,
5
  sku_list_cache: null,
6
  stock_list_cache: null,
7
+
8
+ // Class names
9
+ iparcelSkuClass: 'iparcelsku',
10
+ iparcelStockClass: 'iparcelstock',
11
+ iparcelOptionsClass: 'iparcelOptions',
12
+ swatchLinkClass: 'swatch-link',
13
+
14
+ // Selectors
15
+ productAddToCartFormSelector: 'form#product_addtocart_form',
16
+ textSelector: '.product-custom-option[type="text"], textarea.product-custom-option',
17
+ superAttributeSelector: '.super-attribute-select',
18
+ requiredSuperAttributeSelector: '.super-attribute-select.required-entry',
19
+ productCustomOptionSelector: '.super-attribute-select, .product-custom-option',
20
+ productNameAnchorSelector: '.item .product-name a',
21
+ itemSelector: '.item',
22
+
23
+ updateProperties: function(sourceObject) {
24
+ for (var propertyName in iparcelPost) {
25
+ if (propertyName.substr(-5) === 'Class'
26
+ || propertyName.substr(-8) === 'Selector')
27
+ {
28
+ // Check for the propertyName to be set in the sourceObject
29
+ if (sourceObject.hasOwnProperty(propertyName)
30
+ && sourceObject[propertyName] !== null)
31
+ {
32
+ iparcelPost[propertyName] = sourceObject[propertyName];
33
+ }
34
+ }
35
+ }
36
+ },
37
+
38
+ clear: function() {
39
+ $jip('.' + iparcelPost.iparcelSkuClass + ', .' + iparcelPost.iparcelStockClass).remove();
40
  },
41
+
42
+ single: function(sku, url) {
43
+ iparcelPost.sku = sku;
44
+
45
  if (url.indexOf(':') == 0) {
46
  url = url.substring(1,url.length);
47
  }
48
+
49
+ iparcelPost.url = url+'iparcel/ajax/configurable';
50
+
51
  $jip(document).ready(function(){
52
  var $sku = $jip("<div/>");
53
+ $sku.css("display", "none");
54
+ $sku.attr("class", iparcelPost.iparcelSkuClass);
55
  $sku.text(sku);
56
+ $jip(iparcelPost.productAddToCartFormSelector).append($sku);
57
 
58
  var $options = $jip("<div/>");
59
+ $options.css("display", "none");
60
+ $options.attr("class", iparcelPost.iparcelOptionsClass);
61
+ $jip(iparcelPost.productAddToCartFormSelector).append($options);
62
 
63
+ $jip(iparcelPost.superAttributeSelector).change(function(){
64
  iparcelPost.updateSelect();
65
  });
66
 
67
  // if there are '.super-attribute-select' elements, find the SKU
68
  // for the default configuration
69
+ if ($jip(iparcelPost.requiredSuperAttributeSelector).length > 0) {
70
+ $jip(iparcelPost.requiredSuperAttributeSelector).each(function() {
71
+ iparcelPost.validOptions = [];
72
+ var self = iparcelPost;
73
+
74
+ $jip(iparcelPost).children().each(function(){
75
+ if ($jip(iparcelPost).val() != '') {
76
+ self.validOptions.push($jip(iparcelPost).val());
77
  }
78
  });
79
 
80
+ if (iparcelPost.validOptions.length == 1) {
81
+ // Only one valid option for iparcelPost required select
82
+ $jip(iparcelPost).val(iparcelPost.validOptions[0]);
83
  }
84
  });
85
+
86
  iparcelPost.updateSelect();
87
  }
88
+
89
  // Watch for custom option text fields, areas
90
+ $jip(iparcelPost.textSelector).change(function() {
91
  iparcelPost.updateTextfields();
92
  });
93
 
94
  var $iterator = 0;
95
+
96
+ // Handle swatch clicks
97
  $jip(document).bind('DOMNodeInserted', function(e){
98
+ if ($jip(e.target).attr('class') == iparcelPost.swatchLinkClass){
99
  $jip(e.target).click(iparcelPost.update);
100
  if ($iterator++ == 0){
101
  var target = e.target;
108
  }
109
  });
110
 
111
+ $jip('.' + iparcelPost.swatchLinkClass).click(iparcelPost.update);
112
  });
113
  },
114
+
115
  update: function(){
116
  var $this = $jip(this);
117
  var id = $this.parent().attr('id').split('option')[1];
118
  var val = $this.attr('id').split('swatch')[1];
119
  var super_attribute = '';
120
+
121
+ $jip(iparcelPost.superAttributeSelector).each(function(){
122
  var $this = $jip(this);
123
  if ($this.attr('name') != 'super_attribute['+id+']'){
124
+ super_attribute += $this.attr('name') + '=' + $this.val() + '&';
125
  }
126
  });
127
+
128
+ iparcelMage.ajax.post(iparcelPost.sku, super_attribute, iparcelPost.url);
129
  },
130
+
131
  updateSelect: function () {
132
  iparcelPost.setStock('false');
133
  var $this = $jip(this);
134
  var super_attribute = '';
135
+
136
+ $jip(iparcelPost.productCustomOptionSelector).each(function () {
137
  var $this = $jip(this);
138
  super_attribute += $this.attr('name') + '=' + $this.val() + '&';
139
  });
140
+
141
  iparcelMage.ajax.post(iparcelPost.sku, super_attribute, iparcelPost.url);
142
  },
143
+
144
  updateTextfields: function() {
145
  iparcelPost.setStock('false');
146
  var custom_options = '';
147
+
148
+ $jip(iparcelPost.textSelector).each(function() {
149
  var $this = $jip(this);
150
  custom_options += $this.attr('name') + '=' + $this.val() + '&';
151
  });
152
+
153
  iparcelMage.ajax.post(iparcelPost.sku, custom_options, iparcelPost.url);
154
  },
155
+
156
  stock: function(qty){
157
+ $jip(document).ready(function() {
158
  var $stock = $jip("<div/>");
159
+ $stock.css("display", "none");
160
+ $stock.attr("class", iparcelPost.iparcelStockClass);
161
  $stock.text(qty > 0 ? 'true' : 'false');
162
+ $jip(iparcelPost.productAddToCartFormSelector).append($stock);
163
  });
164
  },
165
+
166
  setStock: function(value){
167
+ $jip('.' + iparcelPost.iparcelStockClass).text(value);
168
  },
169
+
170
  sku_list: function (sku_list) {
171
+ iparcelPost.sku_list_cache = sku_list;
172
+
173
+ $jip(document).ready(function() {
174
  $jip.each(sku_list, function(sku,name){
175
  name = iparcelMage.parseHtmlEntities(name);
176
  var $sku = $jip("<div/>");
177
+ $sku.css("display", "none");
178
+ $sku.attr("class", iparcelPost.iparcelSkuClass);
179
  $sku.text(sku);
180
  iparcelPost.append($sku,name);
181
  });
182
  });
183
+
184
+ $jip(document).ajaxSuccess(function(data) {
185
  iparcelPost.sku_list(sku_list);
186
  });
187
  },
188
+
189
  stock_list: function(stock_list){
190
  this.stock_list_cache = stock_list;
191
+
192
+ $jip(document).ready(function() {
193
  $jip.each(stock_list, function(name,qty){
194
  name = iparcelMage.parseHtmlEntities(name);
195
  var $stock = $jip("<div/>");
196
+ $stock.css("display", "none");
197
+ $stock.attr("class", iparcelPost.iparcelStockClass);
198
  $stock.text(qty > 0 ? 'true' : 'false');
199
  iparcelPost.append($stock,name);
200
  });
201
  });
202
  },
203
+
204
  append: function(item,name){
205
+ var $item = $jip(iparcelPost.productNameAnchorSelector).filter(function () {
206
  return $jip(this).text() == name;
207
  });
208
+
209
+ $item.closest(iparcelPost.itemSelector).append(item);
210
  }
211
  };
212
 
214
  onComplete: function(args){
215
  iparcelPost.sku_list(iparcelPost.sku_list_cache);
216
  iparcelPost.stock_list(iparcelPost.stock_list_cache);
217
+ p
218
+ if (typeof iparcel.session !== "undefined") {
219
+ if (typeof iparcel.session.content !== "undefined") {
220
+ if (typeof iparcel.session.content.locale !== "undefined" && iparcel.session.content.locale == "US") {
221
  $_ipar(iparcel.settings.productListingPriceElement).css("visibility","visible");
222
+ } else {
 
223
  iparcel.ux.displayEligibility();
224
  }
225
  }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>iparcel_logistics</name>
4
- <version>1.3.0</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
@@ -16,9 +16,9 @@
16
  <email>bburden@i-parcel.com</email>
17
  </author>
18
  </authors>
19
- <date>2016-05-16</date>
20
- <time>18:12:34</time>
21
- <contents><target name="mageweb"><dir name="app"><dir name="etc"><dir name="modules"><file name="Iparcel_Logistics.xml" hash="2f375c30334e2d4a6bae03ccab808dd3"/><file name="Iparcel_All.xml" hash="89e4b47a6ac9aa0b82f70b1539d587ea"/></dir></dir><dir name="code"><dir name="community"><dir name="Iparcel"><dir name="Logistics"><dir name="etc"><file name="adminhtml.xml" hash="8b8a4a0643ce23b42709f3b82e46e830"/><file name="config.xml" hash="c0ebd6e8afbffaf59ac6d6534c5d8cea"/><file name="system.xml" hash="38d506e0c6acd3522f116caeda13477e"/></dir><dir name="Helper"><file name="Api.php" hash="ada246f9d5a93f77a1a487b6cab6490d"/><file name="Data.php" hash="87dc68870f301c88cc6325975039810f"/></dir><dir name="Model"><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="3eee28f86610e6cf1b83ee58b83d5e83"/></dir></dir></dir></dir><dir name="All"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Mapping"><file name="Button.php" hash="dfdaf5a2fbf824a10fccc952fdccf567"/></dir></dir><dir name="Iparcel"><file name="Dashboard.php" hash="ec9dddd10368136f1bdfe79fddd4500c"/><file name="Logs.php" hash="5823bbc2a78666972dd02d5fd3e9d05d"/><dir name="Logs"><file name="Grid.php" hash="9c472c78640c8aecb5de4b638372e6f5"/></dir><dir name="Shipment"><dir name="Split"><file name="Form.php" hash="db44693b1eda47cb1d87b8a69ac9a5a0"/></dir><file name="Split.php" hash="4cb66f91987f842c699bd2d6c42f2249"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Method.php" hash="935a3d4adad09d6c049cd6bb4cefb8db"/></dir></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="List.php" hash="2969af5eed8a1179579fa182e20cd59e"/></dir><file name="Product.php" hash="71a865c01574fd10ee0ffa7475cee378"/></dir><dir name="Catalogsearch"><dir name="Advanced"><file name="Result.php" hash="ad5a157444b80a284e0f9e7a91187b55"/></dir><file name="Result.php" hash="33e4ab0994bde9ba5dd87ade63869bee"/></dir><dir name="Html"><dir name="Head"><file name="Iparcel.php" hash="dd1737d041e9357269fa35b27dbef0bd"/><file name="Jquery.php" hash="3fd23960111c32d5696cc3de63e41b6e"/><file name="Post.php" hash="793d578cf82fb3ba83e1edc87b79ff95"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="Totals"><file name="Abstract.php" hash="71cdfdce9a538b2f78b83b7b5eac8b19"/><file name="Duty.php" hash="f8ae79b70c6b5ba41c7acac9be5d84c0"/><file name="Tax.php" hash="1cfee0fccb1feede23f3cdc22f57c903"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Iparcel"><file name="LogController.php" hash="94e2095979140ad6d7c149080be30d38"/><file name="ShipmentController.php" hash="a9b8896d816b7612e1dc0638a2f8b740"/><file name="SyncController.php" hash="9378f5db27d059bbb36ff1e71bd38d32"/><dir name="Shipment"><file name="SplitController.php" hash="6a294947cf9399e42e90c890a6da2caa"/></dir><dir name="Sync"><file name="AjaxController.php" hash="ceaffb0c652954b95e83426c763a2d0d"/></dir></dir></dir><file name="AjaxController.php" hash="f6b0573eefbb21d7ac863fd029783b3c"/><file name="InfoController.php" hash="6543b1e9803489e507d2470f8e3e408b"/><file name="InternationalController.php" hash="75fc93febe96e328d5927665c33d40d1"/></dir><dir name="etc"><file name="adminhtml.xml" hash="50bc0bee93b5612763321eae11cfdc51"/><file name="config.xml" hash="4bd33ca7a2dca415a545f524165ced48"/><file name="system.xml" hash="823d3690c187d8c3db42912d83a6303b"/></dir><dir name="Helper"><file name="Api.php" hash="bc0872952d20a9a4c7b2a91a644a0017"/><file name="Data.php" hash="0c32ec392ffb3857571f272c21d84faa"/><file name="International.php" hash="7bba0cd23188eaa3f99ed3d32ffccd14"/></dir><dir name="Model"><dir name="Api"><file name="Quote.php" hash="2e938bda13d007e73f8c2238aff76fa1"/></dir><dir name="Carrier"><file name="Iparcel.php" hash="ad65fdc9f7f2264e9704b0f17d89dd34"/></dir><dir name="Catalog"><dir name="Product"><file name="Observer.php" hash="d16d89cea8eea6352a7d9b1193cd9512"/></dir></dir><dir name="Config"><dir name="Script"><file name="Js.php" hash="100822286c5326c82cbc5d4ff3cf4c39"/></dir></dir><file name="Cron.php" hash="670d37cd6cdbe60aa69fad8eb0a0759e"/><file name="Log.php" hash="8c87e5f356f8ca77a186430dda106097"/><file name="Observer.php" hash="ad3c34320671927263e673e18c798a34"/><dir name="Order"><dir name="Creditmemo"><dir name="Total"><file name="Duty.php" hash="33b91a5b8fa32293bfe0eab4460b04f9"/><file name="Tax.php" hash="7cd4046231eb8cb9031ae160720390da"/></dir></dir><dir name="Invoice"><dir name="Total"><file name="Duty.php" hash="5a4010994ea502afe88632ddd2699c63"/><file name="Tax.php" hash="c4c95aaaae9662860dd635238150aa46"/></dir></dir></dir><dir name="Payment"><file name="Iparcel.php" hash="30ad607409d5ed225e233638ecbff39c"/></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Abstract.php" hash="a3af320e934f50651e09bfd15b86ffea"/><file name="Collector.php" hash="f99413fe415c342d5c0d582caa767ad1"/><file name="Duty.php" hash="6ef16c8b2038d5c90b4b9c7d00825da2"/><file name="Tax.php" hash="62c9e255562643a967b8c49b9914524d"/></dir></dir></dir><dir name="Resource"><dir name="Api"><file name="Quote.php" hash="84d032b89c5df67ef24a112ad7846302"/></dir><dir name="Log"><file name="Collection.php" hash="7cb78be07207a599eff71c1e18ba0b7a"/></dir><file name="Log.php" hash="d14c2eb8314456a18adadbb52856e0b5"/><dir name="Mysql4"><file name="Setup.php" hash="9f9cf4b5934b70bd00b394beacb245f7"/></dir></dir><dir name="System"><dir name="Config"><dir name="Catalog"><file name="Mapping.php" hash="8895678aa59e49226509d2b4709c5f43"/></dir><dir name="Data"><dir name="Date"><file name="Monthday.php" hash="baec5b8a27c5b037529ba935aae0370a"/><file name="Weekday.php" hash="173edc075325d932f8dad6d4674b8153"/></dir><dir name="Time"><file name="Hour.php" hash="ddad98b85290d9b13ec9f65fbe8a10b3"/><file name="Minute.php" hash="4a76af0057d60e8ff0ff7fedc1d50575"/></dir></dir><file name="Guid.php" hash="311c7f8072f02a6be9e25b6411298c5c"/><dir name="Script"><file name="Js.php" hash="3e3f23b38ecdc361bf6ff6cee1871e92"/></dir><dir name="Source"><dir name="Catalog"><dir name="Mapping"><dir name="Configurable"><file name="Price.php" hash="f9116fd446914467e7fb31bed5a6dd0b"/></dir><file name="Mode.php" hash="36140a050ea65ff23d45264fa67e1a2b"/></dir><dir name="Product"><dir name="Attribute"><file name="Boolean.php" hash="ca1883122659f1b48890ecd46a1590ee"/></dir><file name="Attribute.php" hash="8ca9c929cda497400865751ffba991e6"/></dir></dir><dir name="Date"><file name="Weekday.php" hash="143c26f9661e5dc995ff064e333a2018"/></dir><dir name="Sales"><dir name="Order"><file name="Status.php" hash="f1e414c08c43ebb2fcc6ccf5b41a2ff2"/></dir></dir><dir name="Tax"><file name="Mode.php" hash="fb09f17b54ef8ffa22580741cc66ac14"/></dir></dir></dir></dir><dir name="Tax"><dir name="Quote"><file name="Shipping.php" hash="5d76b072c657035cf3d7713fa6672f1f"/><file name="Subtotal.php" hash="cbd2e41f3bdc74134590a675d93d4bfb"/><file name="Tax.php" hash="ffc8d78a8d0442690c49b60f909c8e48"/></dir></dir></dir><dir name="sql"><dir name="iparcel_setup"><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="4df6e3a3f2adf96eeb6ccdac213e3f1e"/><file name="mysql4-upgrade-1.1.0-1.1.1.php" hash="cfb9fbc137e7e551dfaece00ac6bb2f4"/><file name="mysql4-upgrade-1.1.1-1.2.0.php" hash="1f04c5c71a6a79aaf74810e87670d998"/><file name="mysql4-upgrade-1.2.0-1.2.1.php" hash="de1c9caa713dd194595aa2dd15a829ac"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="iparcel.xml" hash="55aec816cb242fe44aab3a2e0d9de0ba"/><file name="iparcel.xml" hash="55aec816cb242fe44aab3a2e0d9de0ba"/></dir><dir name="template"><dir name="iparcel"><dir name="html"><dir name="head"><file name="iparcel.phtml" hash="07091c9914189cfef06af8cc6e41855c"/><file name="jquery.phtml" hash="c287cb0aa4ddd1f04f27cb5df605a27d"/><file name="post.phtml" hash="1a53e744668b250175ba275b4260050b"/><file name="iparcel.phtml" hash="07091c9914189cfef06af8cc6e41855c"/><file name="jquery.phtml" hash="c287cb0aa4ddd1f04f27cb5df605a27d"/><file name="post.phtml" hash="1a53e744668b250175ba275b4260050b"/></dir></dir><dir name="post"><file name="list.phtml" hash="20e5d7d7f82e1f8d951a1509921eb3bf"/><file name="list.phtml" hash="20e5d7d7f82e1f8d951a1509921eb3bf"/></dir><file name="post.phtml" hash="3827cab2dba981556aeb8ec915ab03cc"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="iparcel.xml" hash="c6be54da5875c9356bba8988fa8c264c"/></dir><dir name="template"><dir name="iparcel"><dir name="order"><dir name="totals"><file name="duty.phtml" hash="7af41c6d47dafeb890a520d8e6e39910"/><file name="tax.phtml" hash="25bffd2b58554cf28e5f4abe4b4e1e7c"/></dir></dir><dir name="sync"><dir name="ajax"><file name="catalog.phtml" hash="64da446db5c1bfe892951c9b3c7f1e7d"/><file name="checkitems.phtml" hash="c19b0e4fd0feddedbc2cef3b2f4ce79b"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="locale"><dir name="en_US"><file name="iparcel.csv" hash="cbcb75a490376ca0b63c8c66622c1656"/></dir></dir></dir><dir name="js"><dir name="iparcel"><dir name="adminhtml"><file name="shipping-methods.js" hash="eca91e8a5cf152fce7af0eb5bf2991bb"/><file name="sync.js" hash="f4525e5c6bce01f9a5cea562f23618e7"/><file name="shipping-methods.js" hash="eca91e8a5cf152fce7af0eb5bf2991bb"/><file name="sync.js" hash="f4525e5c6bce01f9a5cea562f23618e7"/><file name="shipping-methods.js" hash="eca91e8a5cf152fce7af0eb5bf2991bb"/><file name="sync.js" hash="f4525e5c6bce01f9a5cea562f23618e7"/><file name="shipping-methods.js" hash="eca91e8a5cf152fce7af0eb5bf2991bb"/><file name="sync.js" hash="f4525e5c6bce01f9a5cea562f23618e7"/><file name="shipping-methods.js" hash="eca91e8a5cf152fce7af0eb5bf2991bb"/><file name="sync.js" hash="f4525e5c6bce01f9a5cea562f23618e7"/></dir><file name="jQuery.js" hash="8ec1680e4d815ff93f661214efa06276"/><file name="lib.js" hash="42c556650eb62797de469f1770bde3f0"/><file name="post.js" hash="c710697e3d4905a6a707222728485047"/><file name="jQuery.js" hash="8ec1680e4d815ff93f661214efa06276"/><file name="lib.js" hash="42c556650eb62797de469f1770bde3f0"/><file name="post.js" hash="c710697e3d4905a6a707222728485047"/><file name="jQuery.js" hash="8ec1680e4d815ff93f661214efa06276"/><file name="lib.js" hash="42c556650eb62797de469f1770bde3f0"/><file name="post.js" hash="c710697e3d4905a6a707222728485047"/></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="iparcel"><file name="ajaxSync.css" hash="c622b9e4b77589bc0f3c0555124d2751"/></dir></dir></dir></dir></dir></target></contents>
22
  <compatible/>
23
  <dependencies>
24
  <required>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>iparcel_logistics</name>
4
+ <version>1.4.0</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
16
  <email>bburden@i-parcel.com</email>
17
  </author>
18
  </authors>
19
+ <date>2017-03-30</date>
20
+ <time>19:31:02</time>
21
+ <contents><target name="mageweb"><dir name="app"><dir name="etc"><dir name="modules"><file name="Iparcel_Logistics.xml" hash="2f375c30334e2d4a6bae03ccab808dd3"/><file name="Iparcel_All.xml" hash="89e4b47a6ac9aa0b82f70b1539d587ea"/></dir></dir><dir name="code"><dir name="community"><dir name="Iparcel"><dir name="Logistics"><dir name="etc"><file name="adminhtml.xml" hash="8b8a4a0643ce23b42709f3b82e46e830"/><file name="config.xml" hash="fce34ed5a47bbfad4676c0882bbb38b5"/><file name="system.xml" hash="38d506e0c6acd3522f116caeda13477e"/></dir><dir name="Helper"><file name="Api.php" hash="ada246f9d5a93f77a1a487b6cab6490d"/><file name="Data.php" hash="87dc68870f301c88cc6325975039810f"/></dir><dir name="Model"><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="3eee28f86610e6cf1b83ee58b83d5e83"/></dir></dir></dir></dir><dir name="All"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Mapping"><file name="Button.php" hash="dfdaf5a2fbf824a10fccc952fdccf567"/></dir></dir><dir name="Iparcel"><file name="Dashboard.php" hash="ec9dddd10368136f1bdfe79fddd4500c"/><file name="Logs.php" hash="5823bbc2a78666972dd02d5fd3e9d05d"/><file name="Sync.php" hash="ce239afe604653d4b15c739df965fa06"/><dir name="Logs"><file name="Grid.php" hash="9c472c78640c8aecb5de4b638372e6f5"/></dir><dir name="Shipment"><dir name="Split"><file name="Form.php" hash="db44693b1eda47cb1d87b8a69ac9a5a0"/></dir><file name="Split.php" hash="4cb66f91987f842c699bd2d6c42f2249"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Method.php" hash="935a3d4adad09d6c049cd6bb4cefb8db"/></dir></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="List.php" hash="5de6102a56f4a9301f1b81004da39ef8"/></dir><file name="Product.php" hash="71a865c01574fd10ee0ffa7475cee378"/></dir><dir name="Catalogsearch"><dir name="Advanced"><file name="Result.php" hash="ad5a157444b80a284e0f9e7a91187b55"/></dir><file name="Result.php" hash="33e4ab0994bde9ba5dd87ade63869bee"/></dir><dir name="Html"><dir name="Head"><file name="Iparcel.php" hash="dd1737d041e9357269fa35b27dbef0bd"/><file name="Jquery.php" hash="3fd23960111c32d5696cc3de63e41b6e"/><file name="Post.php" hash="793d578cf82fb3ba83e1edc87b79ff95"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="Totals"><file name="Abstract.php" hash="71cdfdce9a538b2f78b83b7b5eac8b19"/><file name="Duty.php" hash="2ca06e658c24b74d5e3dfa2a6950b010"/><file name="Tax.php" hash="7b630e60c6ff9340bedefdc84e99cef4"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Iparcel"><file name="LogController.php" hash="94e2095979140ad6d7c149080be30d38"/><file name="ShipmentController.php" hash="a9b8896d816b7612e1dc0638a2f8b740"/><dir name="Shipment"><file name="SplitController.php" hash="6a294947cf9399e42e90c890a6da2caa"/></dir><dir name="Sync"><file name="AjaxController.php" hash="8a7f2440ee161682eba59aeb7706f19a"/></dir></dir></dir><file name="AjaxController.php" hash="9069724f071742b25c83b2d0cc368871"/><file name="InfoController.php" hash="ab1bdf953dac27d87e9c5c8023ed9380"/><file name="InternationalController.php" hash="5250af3266389ddf0f5ea3a806652328"/></dir><dir name="etc"><file name="adminhtml.xml" hash="50bc0bee93b5612763321eae11cfdc51"/><file name="config.xml" hash="3fc0f987d470f83ccb10bd04de9d6abb"/><file name="system.xml" hash="cfec42b57a6c87e81a77d194499a4d3c"/></dir><dir name="Helper"><file name="Api.php" hash="25557db4f9491c94e05fe83384a45ae9"/><file name="Data.php" hash="2e4f16bb0a3f1fe1345b5d21df59dbae"/><file name="International.php" hash="7bba0cd23188eaa3f99ed3d32ffccd14"/></dir><dir name="Model"><dir name="Api"><file name="Quote.php" hash="2e938bda13d007e73f8c2238aff76fa1"/></dir><dir name="Carrier"><file name="Abstract.php" hash="87ebc5b402ea74709a00abcf2a8aa856"/><file name="Iparcel.php" hash="81fcf55784a5b2da78519e32f7f5cb92"/></dir><dir name="Catalog"><dir name="Product"><file name="Observer.php" hash="2fd0ce66f180cb7d0dfbe752e5227636"/></dir></dir><dir name="Config"><dir name="Script"><file name="Js.php" hash="f29fc9a7535bc886b3ccf8b2e5b7ebfc"/></dir></dir><file name="Cron.php" hash="670d37cd6cdbe60aa69fad8eb0a0759e"/><file name="Log.php" hash="8c87e5f356f8ca77a186430dda106097"/><file name="Observer.php" hash="9d53f374789eaa0b13349843d3e2c7fd"/><dir name="Order"><dir name="Creditmemo"><dir name="Total"><file name="Duty.php" hash="33b91a5b8fa32293bfe0eab4460b04f9"/><file name="Tax.php" hash="7cd4046231eb8cb9031ae160720390da"/></dir></dir><dir name="Invoice"><dir name="Total"><file name="Duty.php" hash="5a4010994ea502afe88632ddd2699c63"/><file name="Tax.php" hash="c4c95aaaae9662860dd635238150aa46"/></dir></dir></dir><dir name="Payment"><file name="Iparcel.php" hash="d7881d795edbbd7279888e3a86fff2c8"/></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Abstract.php" hash="c5f5a251d5cf9f6ddb5a6d92efad157b"/><file name="Collector.php" hash="f805c3fc373f931d912b92cf38a15154"/><file name="Duty.php" hash="41adb9e60a5a22e1e552eb12aa83f858"/><file name="Tax.php" hash="262c99bceac487a5849058d6ed88011e"/></dir></dir></dir><dir name="Resource"><dir name="Api"><file name="Quote.php" hash="84d032b89c5df67ef24a112ad7846302"/></dir><dir name="Log"><file name="Collection.php" hash="7cb78be07207a599eff71c1e18ba0b7a"/></dir><file name="Log.php" hash="d14c2eb8314456a18adadbb52856e0b5"/><dir name="Mysql4"><file name="Setup.php" hash="9f9cf4b5934b70bd00b394beacb245f7"/></dir></dir><dir name="System"><dir name="Config"><dir name="Catalog"><file name="Mapping.php" hash="3d44f4b4ee157333556f588d7d8cd25b"/></dir><dir name="Data"><dir name="Date"><file name="Monthday.php" hash="baec5b8a27c5b037529ba935aae0370a"/><file name="Weekday.php" hash="173edc075325d932f8dad6d4674b8153"/></dir><dir name="Time"><file name="Hour.php" hash="ddad98b85290d9b13ec9f65fbe8a10b3"/><file name="Minute.php" hash="4a76af0057d60e8ff0ff7fedc1d50575"/></dir></dir><file name="Guid.php" hash="311c7f8072f02a6be9e25b6411298c5c"/><dir name="Script"><file name="Js.php" hash="3e3f23b38ecdc361bf6ff6cee1871e92"/></dir><dir name="Source"><dir name="Catalog"><dir name="Mapping"><dir name="Configurable"><file name="Price.php" hash="f9116fd446914467e7fb31bed5a6dd0b"/></dir><file name="Mode.php" hash="36140a050ea65ff23d45264fa67e1a2b"/></dir><dir name="Product"><dir name="Attribute"><file name="Boolean.php" hash="ca1883122659f1b48890ecd46a1590ee"/></dir><file name="Attribute.php" hash="8ca9c929cda497400865751ffba991e6"/></dir></dir><dir name="Date"><file name="Weekday.php" hash="143c26f9661e5dc995ff064e333a2018"/></dir><dir name="Sales"><dir name="Order"><file name="Status.php" hash="f1e414c08c43ebb2fcc6ccf5b41a2ff2"/></dir></dir><dir name="Tax"><file name="Mode.php" hash="fb09f17b54ef8ffa22580741cc66ac14"/></dir></dir></dir></dir><dir name="Tax"><dir name="Quote"><file name="Shipping.php" hash="e4b0f82aaef3666be520bc2da28af098"/><file name="Subtotal.php" hash="6824b6e6e86dc423fd493a31b15aa28d"/><file name="Tax.php" hash="7ee0528db7b7f9e89cd00a0b0c74dda9"/></dir></dir></dir><dir name="sql"><dir name="iparcel_setup"><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="4df6e3a3f2adf96eeb6ccdac213e3f1e"/><file name="mysql4-upgrade-1.1.0-1.1.1.php" hash="358045d3bf4a53a477e52b573289fe4c"/><file name="mysql4-upgrade-1.1.1-1.2.0.php" hash="1f04c5c71a6a79aaf74810e87670d998"/><file name="mysql4-upgrade-1.2.0-1.2.1.php" hash="de1c9caa713dd194595aa2dd15a829ac"/><file name="mysql4-upgrade-1.2.1-1.3.0.php" hash="f7a5567470b6a3c98530600b48993889"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="iparcel.xml" hash="55aec816cb242fe44aab3a2e0d9de0ba"/><file name="iparcel.xml" hash="55aec816cb242fe44aab3a2e0d9de0ba"/></dir><dir name="template"><dir name="iparcel"><dir name="html"><dir name="head"><file name="iparcel.phtml" hash="07091c9914189cfef06af8cc6e41855c"/><file name="jquery.phtml" hash="c287cb0aa4ddd1f04f27cb5df605a27d"/><file name="post.phtml" hash="1a53e744668b250175ba275b4260050b"/><file name="iparcel.phtml" hash="07091c9914189cfef06af8cc6e41855c"/><file name="jquery.phtml" hash="c287cb0aa4ddd1f04f27cb5df605a27d"/><file name="post.phtml" hash="1a53e744668b250175ba275b4260050b"/></dir></dir><dir name="post"><file name="list.phtml" hash="20e5d7d7f82e1f8d951a1509921eb3bf"/><file name="list.phtml" hash="20e5d7d7f82e1f8d951a1509921eb3bf"/></dir><file name="post.phtml" hash="3827cab2dba981556aeb8ec915ab03cc"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="iparcel.xml" hash="f23a0739ab95168725913180ef44fff9"/></dir><dir name="template"><dir name="iparcel"><dir name="order"><dir name="totals"><file name="duty.phtml" hash="7af41c6d47dafeb890a520d8e6e39910"/><file name="tax.phtml" hash="25bffd2b58554cf28e5f4abe4b4e1e7c"/></dir></dir><dir name="sync"><dir name="ajax"><file name="catalog.phtml" hash="b95262967f28618b50f01962047816f2"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="locale"><dir name="en_US"><file name="iparcel.csv" hash="cbcb75a490376ca0b63c8c66622c1656"/></dir></dir></dir><dir name="js"><dir name="iparcel"><dir name="adminhtml"><file name="shipping-methods.js" hash="ad8056546367ec415350abd04b95afab"/><file name="sync.js" hash="ec17cf8528736f8aab3dd0ac76e3e7d9"/><file name="shipping-methods.js" hash="ad8056546367ec415350abd04b95afab"/><file name="sync.js" hash="ec17cf8528736f8aab3dd0ac76e3e7d9"/><file name="shipping-methods.js" hash="ad8056546367ec415350abd04b95afab"/><file name="sync.js" hash="ec17cf8528736f8aab3dd0ac76e3e7d9"/><file name="shipping-methods.js" hash="ad8056546367ec415350abd04b95afab"/><file name="sync.js" hash="ec17cf8528736f8aab3dd0ac76e3e7d9"/><file name="shipping-methods.js" hash="ad8056546367ec415350abd04b95afab"/><file name="sync.js" hash="ec17cf8528736f8aab3dd0ac76e3e7d9"/></dir><file name="jQuery.js" hash="8ec1680e4d815ff93f661214efa06276"/><file name="lib.js" hash="385c25c7fe89c44c8fff49daaa9c6299"/><file name="post.js" hash="55a14e510b988d893e95860e83e3f16b"/><file name="jQuery.js" hash="8ec1680e4d815ff93f661214efa06276"/><file name="lib.js" hash="385c25c7fe89c44c8fff49daaa9c6299"/><file name="post.js" hash="55a14e510b988d893e95860e83e3f16b"/><file name="jQuery.js" hash="8ec1680e4d815ff93f661214efa06276"/><file name="lib.js" hash="385c25c7fe89c44c8fff49daaa9c6299"/><file name="post.js" hash="55a14e510b988d893e95860e83e3f16b"/></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="iparcel"><file name="ajaxSync.css" hash="8e9222a567c960ec381f43307fd8d882"/></dir></dir></dir></dir></dir></target></contents>
22
  <compatible/>
23
  <dependencies>
24
  <required>
skin/adminhtml/default/default/iparcel/ajaxSync.css CHANGED
@@ -1,4 +1,22 @@
1
- *{margin: 0; padding: 0;}
2
- #starting{display: block;}
3
- #error{background-color: #c33; color: #fff;}
4
- *[id="page:main-container"] div{background-color: #8cd9cd; margin: 5px 0; padding: 5px; font-family: sans-serif; font-size: 12px; display: none;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ * {
2
+ margin: 0;
3
+ padding: 0;
4
+ }
5
+
6
+ #message {
7
+ display: block;
8
+ }
9
+
10
+ *[id="page:main-container"] div {
11
+ background-color: #8cd9cd;
12
+ margin: 5px 0;
13
+ padding: 5px;
14
+ font-family: sans-serif;
15
+ font-size: 12px;
16
+ display: none;
17
+ }
18
+
19
+ #log-area {
20
+ width: 100%;
21
+ height: 150px;
22
+ }