Rvtech_Starshipit - Version 1.6.1.0

Version Notes

- Added Shipping Instructions
- Added Signature Required
- Added Authority to Leave
- Added Api functionality to retrieve Shipping Notes by Order Id

- Added Address Autocomplete lookup during CheckOut

- Added ShipIt Settings in System Configuration
- Moved Api Key field to ShipIt Settings from Shipping Methods

Download this release

Release Info

Developer George Plummer
Extension Rvtech_Starshipit
Version 1.6.1.0
Comparing to
See all releases


Code changes from version 1.6.0.3 to 1.6.1.0

Files changed (64) hide show
  1. app/code/community/Rvtech/Starshipit/Block/Adminhtml/Sales/Order/Create/Shipnote.php +9 -0
  2. app/code/community/Rvtech/Starshipit/Block/Adminhtml/Sales/Order/Note.php +20 -0
  3. app/code/community/Rvtech/Starshipit/Block/Adminhtml/System/Config/Form/Button.php +3 -3
  4. app/code/community/Rvtech/Starshipit/Block/Adminhtml/System/Config/Form/Syncbutton.php +3 -3
  5. app/code/community/Rvtech/Starshipit/Block/Note.php +38 -0
  6. app/code/community/Rvtech/Starshipit/Block/Sales/Order/Grid.php +2 -2
  7. app/code/community/Rvtech/Starshipit/Block/Sales/Order/View.php +1 -1
  8. app/code/community/Rvtech/Starshipit/Block/Ship.php +5 -0
  9. app/code/community/Rvtech/Starshipit/Helper/Data.php +31 -1
  10. app/code/community/Rvtech/Starshipit/Helper/Starship.php +4 -4
  11. app/code/community/Rvtech/Starshipit/Model/Adminhtml/Observer.php +48 -0
  12. app/code/community/Rvtech/Starshipit/Model/Api.php +14 -0
  13. app/code/community/{Starshipit/Ship → Rvtech/Starshipit}/Model/Carrier/Auspost.php +7 -8
  14. app/code/community/{Starshipit/Ship → Rvtech/Starshipit}/Model/Carrier/Courierpost.php +5 -5
  15. app/code/community/{Starshipit/Ship → Rvtech/Starshipit}/Model/Carrier/Dhlexpress.php +4 -4
  16. app/code/community/{Starshipit/Ship → Rvtech/Starshipit}/Model/Carrier/Fastway.php +4 -4
  17. app/code/community/{Starshipit/Ship → Rvtech/Starshipit}/Model/Carrier/Nzpost.php +5 -5
  18. app/code/community/Rvtech/Starshipit/Model/Note.php +53 -0
  19. app/code/community/Rvtech/Starshipit/Model/Observer.php +96 -47
  20. app/code/community/Rvtech/Starshipit/Model/Orders.php +10 -10
  21. app/code/community/Rvtech/Starshipit/Model/Orders.php_ORG +0 -437
  22. app/code/community/Rvtech/Starshipit/Model/Resource/Note.php +8 -0
  23. app/code/community/Rvtech/Starshipit/Model/Resource/Note/Collection.php +8 -0
  24. app/code/community/Rvtech/Starshipit/controllers/Adminhtml/{StarshipitController.php → ShipItController.php} +4 -4
  25. app/code/community/Rvtech/Starshipit/controllers/Adminhtml/StarshipitController.php_ORG +0 -101
  26. app/code/community/Rvtech/Starshipit/controllers/IndexController.php +2 -4
  27. app/code/community/Rvtech/Starshipit/etc/api.xml +47 -0
  28. app/code/community/Rvtech/Starshipit/etc/config.xml +285 -85
  29. app/code/community/Rvtech/Starshipit/etc/system.xml +476 -97
  30. app/code/community/Rvtech/Starshipit/sql/shipnote_setup/install-1.0.0.php +38 -0
  31. app/code/community/Starshipit/Ship/Block/Ship.php +0 -5
  32. app/code/community/Starshipit/Ship/Helper/Data.php +0 -6
  33. app/code/community/Starshipit/Ship/Model/Carrier/Button.php +0 -51
  34. app/code/community/Starshipit/Ship/Model/Carrier/Grid.php +0 -226
  35. app/code/community/Starshipit/Ship/Model/Carrier/View.php +0 -347
  36. app/code/community/Starshipit/Ship/controllers/IndexController.php +0 -5
  37. app/code/community/Starshipit/Ship/etc/config.xml +0 -116
  38. app/code/community/Starshipit/Ship/etc/system.xml +0 -449
  39. app/design/adminhtml/default/default/layout/{starshipit.xml → shipit.xml} +1 -1
  40. app/design/adminhtml/default/default/layout/shipnote.xml +86 -0
  41. app/design/adminhtml/default/default/template/{starshipit → shipit}/system/config/button.phtml +0 -0
  42. app/design/adminhtml/default/default/template/{starshipit → shipit}/system/config/syncbutton.phtml +0 -0
  43. app/design/adminhtml/default/default/template/shipnote/note-create.phtml +9 -0
  44. app/design/adminhtml/default/default/template/shipnote/note.phtml +28 -0
  45. app/design/adminhtml/default/default/template/shipnote/sales/order/create/data.phtml +69 -0
  46. app/design/adminhtml/default/default/template/shipnote/sales/order/create/shipnote.phtml +26 -0
  47. app/design/adminhtml/default/default/template/shipnote/sales/order/creditmemo/create/form.phtml +63 -0
  48. app/design/adminhtml/default/default/template/shipnote/sales/order/creditmemo/view/form.phtml +74 -0
  49. app/design/adminhtml/default/default/template/shipnote/sales/order/invoice/create/form.phtml +85 -0
  50. app/design/adminhtml/default/default/template/shipnote/sales/order/invoice/view/form.phtml +68 -0
  51. app/design/adminhtml/default/default/template/shipnote/sales/order/shipment/create/form.phtml +59 -0
  52. app/design/adminhtml/default/default/template/shipnote/sales/order/shipment/view/form.phtml +64 -0
  53. app/design/adminhtml/default/default/template/shipnote/sales/order/view/tab/info.phtml +108 -0
  54. app/design/frontend/base/default/layout/addressautocomplete.xml +14 -0
  55. app/design/frontend/base/default/layout/shipnote.xml +16 -0
  56. app/design/frontend/base/default/template/shipnote/note.phtml +32 -0
  57. app/etc/modules/{Rvtech_Startshipit.xml → Rvtech_Starshipit.xml} +2 -2
  58. app/etc/modules/Starshipit.xml +0 -9
  59. app/locale/en_GB/Rvtech_StarshipitNote.csv +5 -0
  60. js/{mage/adminhtml/starshipgrid.js → shipit/adminhtml/grid.js} +2 -2
  61. package.xml +24 -11
  62. skin/frontend/base/default/css/shipnote.css +21 -0
  63. skin/frontend/base/default/js/shipit/onstepcheckout.js +184 -0
  64. skin/frontend/base/default/js/shipit/onstepcheckout_shipping.js +185 -0
app/code/community/Rvtech/Starshipit/Block/Adminhtml/Sales/Order/Create/Shipnote.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Rvtech_Starshipit_Block_Adminhtml_Sales_Order_Create_Shipnote extends Mage_Adminhtml_Block_Sales_Order_Create_Abstract
3
+ {
4
+ public function getShipNote()
5
+ {
6
+ return $this->htmlEscape($this->getQuote()->getShipNote());
7
+ }
8
+
9
+ }
app/code/community/Rvtech/Starshipit/Block/Adminhtml/Sales/Order/Note.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Rvtech_Starshipit_Block_Adminhtml_Sales_Order_Note extends Mage_Adminhtml_Block_Sales_Order_View_Info
3
+ {
4
+ /**
5
+ * @var Rvtech_Starshipit_Model_Note
6
+ */
7
+ protected $_note;
8
+
9
+ /**
10
+ * @return Rvtech_Starshipit_Model_Note|null
11
+ */
12
+ public function getNote()
13
+ {
14
+ if (null === $this->_note) {
15
+ $this->_note = Mage::getModel('shipnote/note')
16
+ ->loadByOrder($this->getOrder());
17
+ }
18
+ return $this->_note;
19
+ }
20
+ }
app/code/community/Rvtech/Starshipit/Block/Adminhtml/System/Config/Form/Button.php CHANGED
@@ -7,7 +7,7 @@ class Rvtech_Starshipit_Block_Adminhtml_System_Config_Form_Button extends Mage_A
7
  protected function _construct()
8
  {
9
  parent::_construct();
10
- $this->setTemplate('starshipit/system/config/button.phtml');
11
  }
12
 
13
  /**
@@ -28,7 +28,7 @@ class Rvtech_Starshipit_Block_Adminhtml_System_Config_Form_Button extends Mage_A
28
  */
29
  public function getAjaxCheckUrl()
30
  {
31
- return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_starshipit/test');
32
  }
33
 
34
  /**
@@ -40,7 +40,7 @@ class Rvtech_Starshipit_Block_Adminhtml_System_Config_Form_Button extends Mage_A
40
  {
41
  $button = $this->getLayout()->createBlock('adminhtml/widget_button')
42
  ->setData(array(
43
- 'id' => 'starshipit_test_button',
44
  'label' => $this->helper('adminhtml')->__('Test'),
45
  'onclick' => 'javascript:test(); return false;'
46
  ));
7
  protected function _construct()
8
  {
9
  parent::_construct();
10
+ $this->setTemplate('shipit/system/config/button.phtml');
11
  }
12
 
13
  /**
28
  */
29
  public function getAjaxCheckUrl()
30
  {
31
+ return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_shipit/test');
32
  }
33
 
34
  /**
40
  {
41
  $button = $this->getLayout()->createBlock('adminhtml/widget_button')
42
  ->setData(array(
43
+ 'id' => 'shipit_test_button',
44
  'label' => $this->helper('adminhtml')->__('Test'),
45
  'onclick' => 'javascript:test(); return false;'
46
  ));
app/code/community/Rvtech/Starshipit/Block/Adminhtml/System/Config/Form/Syncbutton.php CHANGED
@@ -7,7 +7,7 @@ class Rvtech_Starshipit_Block_Adminhtml_System_Config_Form_Syncbutton extends Ma
7
  protected function _construct()
8
  {
9
  parent::_construct();
10
- $this->setTemplate('starshipit/system/config/syncbutton.phtml');
11
  }
12
 
13
  /**
@@ -28,7 +28,7 @@ class Rvtech_Starshipit_Block_Adminhtml_System_Config_Form_Syncbutton extends Ma
28
  */
29
  public function getAjaxCheckUrl()
30
  {
31
- return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_starshipit/syncOrder');
32
  }
33
 
34
  /**
@@ -40,7 +40,7 @@ class Rvtech_Starshipit_Block_Adminhtml_System_Config_Form_Syncbutton extends Ma
40
  {
41
  $button = $this->getLayout()->createBlock('adminhtml/widget_button')
42
  ->setData(array(
43
- 'id' => 'starshipit_test_button',
44
  'label' => $this->helper('adminhtml')->__('Sync Orders'),
45
  'onclick' => 'javascript:syncOrder(); return false;'
46
  ));
7
  protected function _construct()
8
  {
9
  parent::_construct();
10
+ $this->setTemplate('shipit/system/config/syncbutton.phtml');
11
  }
12
 
13
  /**
28
  */
29
  public function getAjaxCheckUrl()
30
  {
31
+ return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_shipit/syncOrder');
32
  }
33
 
34
  /**
40
  {
41
  $button = $this->getLayout()->createBlock('adminhtml/widget_button')
42
  ->setData(array(
43
+ 'id' => 'shipit_test_button',
44
  'label' => $this->helper('adminhtml')->__('Sync Orders'),
45
  'onclick' => 'javascript:syncOrder(); return false;'
46
  ));
app/code/community/Rvtech/Starshipit/Block/Note.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Rvtech_Starshipit_Block_Note extends Mage_Core_Block_Template
3
+ {
4
+ /**
5
+ * Only display if module is enabled in store config and there are
6
+ * actually some shipping rates.
7
+ *
8
+ * @return bool
9
+ */
10
+ public function canShow()
11
+ {
12
+ return Mage::helper('shipnote')->isEnabled() || $this->getRateCount() < 1;
13
+ }
14
+
15
+ /**
16
+ * How many shipping rates are available
17
+ *
18
+ * @return bool
19
+ */
20
+ public function getRateCount()
21
+ {
22
+ return Mage::getSingleton('checkout/session')->getQuote()
23
+ ->getShippingAddress()
24
+ ->getShippingRatesCollection()
25
+ ->count();
26
+ }
27
+
28
+ /**
29
+ * @return string
30
+ */
31
+ public function _toHtml()
32
+ {
33
+ if (false === $this->canShow()) {
34
+ return '';
35
+ }
36
+ return parent::_toHtml();
37
+ }
38
+ }
app/code/community/Rvtech/Starshipit/Block/Sales/Order/Grid.php CHANGED
@@ -200,8 +200,8 @@ class Rvtech_Starshipit_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Widg
200
  'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
201
  ));
202
 
203
- $this->getMassactionBlock()->addItem('starshipIt_multi', array(
204
- 'label'=> Mage::helper('sales')->__('StarShipIt'),
205
  'url' => $this->getUrl('http://www.google.com'),
206
  'confirm' => Mage::helper('sales')->__('You Sure !!'),
207
  'startshipiturl' => true,
200
  'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
201
  ));
202
 
203
+ $this->getMassactionBlock()->addItem('shipit_multi', array(
204
+ 'label'=> Mage::helper('sales')->__('ShipIt'),
205
  'url' => $this->getUrl('http://www.google.com'),
206
  'confirm' => Mage::helper('sales')->__('You Sure !!'),
207
  'startshipiturl' => true,
app/code/community/Rvtech/Starshipit/Block/Sales/Order/View.php CHANGED
@@ -34,7 +34,7 @@
34
  class Rvtech_Starshipit_Block_Sales_Order_View extends Mage_Adminhtml_Block_Widget_Form_Container
35
  {
36
 
37
- const STARSHIP_BASE = 'http://beta.starshipit.com/templates/admin4/popupprint.aspx';
38
 
39
  public function __construct()
40
  {
34
  class Rvtech_Starshipit_Block_Sales_Order_View extends Mage_Adminhtml_Block_Widget_Form_Container
35
  {
36
 
37
+ const STARSHIP_BASE = 'https://app.shipit.click/templates/admin4/popupprint.aspx';
38
 
39
  public function __construct()
40
  {
app/code/community/Rvtech/Starshipit/Block/Ship.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Rvtech_Starshipit_Block_Ship extends Mage_Core_Block_Template
3
+ {
4
+
5
+ }
app/code/community/Rvtech/Starshipit/Helper/Data.php CHANGED
@@ -1,4 +1,34 @@
1
  <?php
2
  class Rvtech_Starshipit_Helper_Data extends Mage_Core_Helper_Abstract
3
  {
4
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
  class Rvtech_Starshipit_Helper_Data extends Mage_Core_Helper_Abstract
3
  {
4
+ const STORE_CONFIG_PATH_SHIPIT_API_KEY = 'shipnote_options/shipit_settings/shipit_api_key';
5
+ const STORE_CONFIG_PATH_ENABLED = 'shipnote_options/basic_settings/enabled';
6
+ const STORE_CONFIG_PATH_FRONTEND_LABEL = 'shipnote_options/basic_settings/frontend_label';
7
+
8
+ /**
9
+ * @return string
10
+ */
11
+ public function getShipItApiKey()
12
+ {
13
+ return Mage::getStoreConfig(self::STORE_CONFIG_PATH_SHIPIT_API_KEY);
14
+ }
15
+
16
+ /**
17
+ * @return bool
18
+ */
19
+ public function isEnabled()
20
+ {
21
+ if (false === parent::isModuleEnabled()) {
22
+ return false;
23
+ }
24
+ return Mage::getStoreConfigFlag(self::STORE_CONFIG_PATH_ENABLED);
25
+ }
26
+
27
+ /**
28
+ * @return string
29
+ */
30
+ public function getFrontendLabel()
31
+ {
32
+ return Mage::getStoreConfig(self::STORE_CONFIG_PATH_FRONTEND_LABEL);
33
+ }
34
+ }
app/code/community/Rvtech/Starshipit/Helper/Starship.php CHANGED
@@ -21,7 +21,7 @@ class Rvtech_Starshipit_Helper_Starship extends Mage_Core_Helper_Abstract
21
 
22
  protected function _getAuthDetails(){
23
 
24
- return Mage::getModel('starshipit/orders')->getAuthDetails();
25
  }
26
 
27
  /**
@@ -35,9 +35,9 @@ class Rvtech_Starshipit_Helper_Starship extends Mage_Core_Helper_Abstract
35
  if(!empty($authTo)) {
36
  Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
37
  Mage::getModel('core/config')
38
- ->saveConfig('starshipit_options/group1/username', $authTo['userName']);
39
  Mage::getModel('core/config')
40
- ->saveConfig('starshipit_options/group1/api_key', $authTo['apiKey']);
41
  }else {
42
  $authTo = $this->_getAuthDetails();
43
  }
@@ -132,7 +132,7 @@ class Rvtech_Starshipit_Helper_Starship extends Mage_Core_Helper_Abstract
132
  public function checkCondForMagentoWritebacks($response) {
133
 
134
  $success = $response->AddShipmentResult;
135
- $update = Mage::getModel('starshipit/orders')->needToUpdateOredrsInMage();
136
 
137
  if($success === 'Success' && ($update)) {
138
  return true;
21
 
22
  protected function _getAuthDetails(){
23
 
24
+ return Mage::getModel('shipit/orders')->getAuthDetails();
25
  }
26
 
27
  /**
35
  if(!empty($authTo)) {
36
  Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
37
  Mage::getModel('core/config')
38
+ ->saveConfig('shipit_options/group1/username', $authTo['userName']);
39
  Mage::getModel('core/config')
40
+ ->saveConfig('shipit_options/group1/api_key', $authTo['apiKey']);
41
  }else {
42
  $authTo = $this->_getAuthDetails();
43
  }
132
  public function checkCondForMagentoWritebacks($response) {
133
 
134
  $success = $response->AddShipmentResult;
135
+ $update = Mage::getModel('shipit/orders')->needToUpdateOredrsInMage();
136
 
137
  if($success === 'Success' && ($update)) {
138
  return true;
app/code/community/Rvtech/Starshipit/Model/Adminhtml/Observer.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Rvtech_Starshipit_Model_Adminhtml_Observer
3
+ {
4
+ /**
5
+ * @param Varien_Event_Observer $observer
6
+ * @return Rvtech_Starshipit_Model_Adminhtml_Observer
7
+ */
8
+ public function adminhtml_sales_order_create_process_data(Varien_Event_Observer $observer)
9
+ {
10
+ try {
11
+ $requestData = $observer->getEvent()->getRequest();
12
+ if (isset($requestData['order']['ship_note'])) {
13
+ $observer->getEvent()->getOrderCreateModel()->getQuote()
14
+ ->addData($requestData['order'])
15
+ ->save();
16
+ }
17
+ } catch (Exception $e) {
18
+ Mage::logException($e);
19
+ }
20
+ return $this;
21
+ }
22
+
23
+ /**
24
+ * If the quote has a delivery note then lets save that note and
25
+ * assign the id to the order
26
+ *
27
+ * @param Varien_Event_Observer $observer
28
+ * @return Rvtech_Starshipit_Model_Observer
29
+ */
30
+ public function sales_convert_quote_to_order(Varien_Event_Observer $observer)
31
+ {
32
+ if ($shipNote = $observer->getEvent()->getQuote()->getShipNote()) {
33
+ try {
34
+ $shipNoteId = Mage::getModel('shipnote/note')
35
+ ->setNote($shipNote)
36
+ ->save()
37
+ ->getId();
38
+
39
+ $observer->getEvent()->getOrder()
40
+ ->setShipNoteId($shipNoteId);
41
+
42
+ } catch (Exception $e) {
43
+ Mage::logException($e);
44
+ }
45
+ }
46
+ return $this;
47
+ }
48
+ }
app/code/community/Rvtech/Starshipit/Model/Api.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Rvtech_Starshipit_Model_Api extends Mage_Api_Model_Resource_Abstract
3
+ {
4
+ public function info($orderId)
5
+ {
6
+ $shipNoteModel = Mage::getModel('shipnote/note')->loadByOrderId($orderId);
7
+ if (!$shipNoteModel->getId()) {
8
+ $this->_fault('not_exists');
9
+ // If shipping note not found.
10
+ }
11
+ return $shipNoteModel->toArray();
12
+ // We can use only simple PHP data types in webservices.
13
+ }
14
+ }
app/code/community/{Starshipit/Ship → Rvtech/Starshipit}/Model/Carrier/Auspost.php RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- class Starshipit_Ship_Model_Carrier_Auspost extends Mage_Shipping_Model_Carrier_Abstract
3
  implements Mage_Shipping_Model_Carrier_Interface {
4
  protected $_code = 'auspost';
5
 
@@ -7,8 +7,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
7
  {
8
  if (!Mage::getStoreConfig('carriers/'.$this->_code.'/active')) {
9
  return false;
10
- }
11
-
12
  $price = 0;
13
  $doCalulate = $this->getConfigData('calculate');
14
  if ($doCalulate==0)
@@ -16,7 +15,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
16
  $price = $this->getConfigData('price');
17
  }
18
  else{
19
- $apiKey = $this->getConfigData('apiKey');
20
  $destCountryId = $request->getDestCountryId();
21
  $destCountry = $request->getDestCountry();
22
  $destRegion = $request->getDestRegionId();
@@ -30,7 +29,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
30
  $packagedepth = $request->getPackageDepth();
31
 
32
  $params = array(
33
- "apiKey" => $apiKey,
34
  "carrierid"=>10,
35
  "street"=>$destStreet,
36
  "suburb"=>"",
@@ -62,7 +61,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
62
  }
63
  catch (Exception $e)
64
  {
65
- Mage::log($e->getMessage(), null, starshipit.log);
66
  }
67
  }
68
 
@@ -101,14 +100,14 @@ implements Mage_Shipping_Model_Carrier_Interface {
101
 
102
  public function getTrackingInfo($tracking)
103
  {
104
- //Mage::log("Get Tracking", null, starshipit.log);
105
  $status = Mage::getModel('shipping/tracking_result_status');
106
  $status->setCarrier('ups');
107
  $status->setCarrierTitle($this->getConfigData('title'));
108
  $status->setTracking($tracking);
109
  $status->setPopup(1);
110
  $status->setUrl("http://auspost.com.au/track/track.html?id=".$tracking);
111
- //Mage::log("Get Tracking asd", null, starshipit.log);
112
  return $status;
113
  }
114
  }
1
  <?php
2
+ class Rvtech_Starshipit_Model_Carrier_Auspost extends Mage_Shipping_Model_Carrier_Abstract
3
  implements Mage_Shipping_Model_Carrier_Interface {
4
  protected $_code = 'auspost';
5
 
7
  {
8
  if (!Mage::getStoreConfig('carriers/'.$this->_code.'/active')) {
9
  return false;
10
+ }
 
11
  $price = 0;
12
  $doCalulate = $this->getConfigData('calculate');
13
  if ($doCalulate==0)
15
  $price = $this->getConfigData('price');
16
  }
17
  else{
18
+ $shipItApiKey = Mage::helper('shipnote')->getShipItApiKey();
19
  $destCountryId = $request->getDestCountryId();
20
  $destCountry = $request->getDestCountry();
21
  $destRegion = $request->getDestRegionId();
29
  $packagedepth = $request->getPackageDepth();
30
 
31
  $params = array(
32
+ "apiKey" => $shipItApiKey,
33
  "carrierid"=>10,
34
  "street"=>$destStreet,
35
  "suburb"=>"",
61
  }
62
  catch (Exception $e)
63
  {
64
+ Mage::log($e->getMessage(), null, ShipIt.log);
65
  }
66
  }
67
 
100
 
101
  public function getTrackingInfo($tracking)
102
  {
103
+ //Mage::log("Get Tracking", null, ShipIt.log);
104
  $status = Mage::getModel('shipping/tracking_result_status');
105
  $status->setCarrier('ups');
106
  $status->setCarrierTitle($this->getConfigData('title'));
107
  $status->setTracking($tracking);
108
  $status->setPopup(1);
109
  $status->setUrl("http://auspost.com.au/track/track.html?id=".$tracking);
110
+ //Mage::log("Get Tracking asd", null, ShipIt.log);
111
  return $status;
112
  }
113
  }
app/code/community/{Starshipit/Ship → Rvtech/Starshipit}/Model/Carrier/Courierpost.php RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- class Starshipit_Ship_Model_Carrier_CourierPost extends Mage_Shipping_Model_Carrier_Abstract
3
  implements Mage_Shipping_Model_Carrier_Interface {
4
  protected $_code = 'courierpost';
5
 
@@ -16,7 +16,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
16
  $price = $this->getConfigData('price');
17
  }
18
  else{
19
- $apiKey = $this->getConfigData('apiKey');
20
  $destCountryId = $request->getDestCountryId();
21
  $destCountry = $request->getDestCountry();
22
  $destRegion = $request->getDestRegionId();
@@ -30,7 +30,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
30
  $packagedepth = $request->getPackageDepth();
31
 
32
  $params = array(
33
- "apiKey" => $apiKey,
34
  "carrierid"=>0,
35
  "street"=>$destStreet,
36
  "suburb"=>"",
@@ -56,12 +56,12 @@ implements Mage_Shipping_Model_Carrier_Interface {
56
 
57
  $result = $client->__soapCall("GetQuote", array($params));
58
  $quoteResponse = $result->GetQuoteResult;
59
- //Mage::log("Price web:".$quoteResponse->Price, null, starshipit.log);
60
  $price = $quoteResponse->Price;
61
  }
62
  catch (Exception $e)
63
  {
64
- Mage::log($e->getMessage(), null, starshipit.log);
65
  }
66
  }
67
 
1
  <?php
2
+ class Rvtech_Starshipit_Model_Carrier_CourierPost extends Mage_Shipping_Model_Carrier_Abstract
3
  implements Mage_Shipping_Model_Carrier_Interface {
4
  protected $_code = 'courierpost';
5
 
16
  $price = $this->getConfigData('price');
17
  }
18
  else{
19
+ $shipItApiKey = Mage::helper('shipnote')->getShipItApiKey();
20
  $destCountryId = $request->getDestCountryId();
21
  $destCountry = $request->getDestCountry();
22
  $destRegion = $request->getDestRegionId();
30
  $packagedepth = $request->getPackageDepth();
31
 
32
  $params = array(
33
+ "apiKey" => $shipItApiKey,
34
  "carrierid"=>0,
35
  "street"=>$destStreet,
36
  "suburb"=>"",
56
 
57
  $result = $client->__soapCall("GetQuote", array($params));
58
  $quoteResponse = $result->GetQuoteResult;
59
+ //Mage::log("Price web:".$quoteResponse->Price, null, ShipIt.log);
60
  $price = $quoteResponse->Price;
61
  }
62
  catch (Exception $e)
63
  {
64
+ Mage::log($e->getMessage(), null, ShipIt.log);
65
  }
66
  }
67
 
app/code/community/{Starshipit/Ship → Rvtech/Starshipit}/Model/Carrier/Dhlexpress.php RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- class Starshipit_Ship_Model_Carrier_Dhlexpress extends Mage_Shipping_Model_Carrier_Abstract
3
  implements Mage_Shipping_Model_Carrier_Interface {
4
  protected $_code = 'dhlexpress';
5
 
@@ -16,7 +16,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
16
  $price = $this->getConfigData('price');
17
  }
18
  else{
19
- $apiKey = $this->getConfigData('apiKey');
20
  $destCountryId = $request->getDestCountryId();
21
  $destCountry = $request->getDestCountry();
22
  $destRegion = $request->getDestRegionId();
@@ -30,7 +30,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
30
  $packagedepth = $request->getPackageDepth();
31
 
32
  $params = array(
33
- "apiKey" => $apiKey,
34
  "carrierid"=>2,
35
  "street"=>$destStreet,
36
  "suburb"=>"",
@@ -56,7 +56,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
56
 
57
  $result = $client->__soapCall("GetQuote", array($params));
58
  $quoteResponse = $result->GetQuoteResult;
59
- //Mage::log("Price web:".$quoteResponse->Price, null, starshipit.log);
60
  $price = $quoteResponse->Price;
61
  }
62
 
1
  <?php
2
+ class Rvtech_Starshipit_Model_Carrier_Dhlexpress extends Mage_Shipping_Model_Carrier_Abstract
3
  implements Mage_Shipping_Model_Carrier_Interface {
4
  protected $_code = 'dhlexpress';
5
 
16
  $price = $this->getConfigData('price');
17
  }
18
  else{
19
+ $shipItApiKey = Mage::helper('shipnote')->getShipItApiKey();
20
  $destCountryId = $request->getDestCountryId();
21
  $destCountry = $request->getDestCountry();
22
  $destRegion = $request->getDestRegionId();
30
  $packagedepth = $request->getPackageDepth();
31
 
32
  $params = array(
33
+ "apiKey" => $shipItApiKey,
34
  "carrierid"=>2,
35
  "street"=>$destStreet,
36
  "suburb"=>"",
56
 
57
  $result = $client->__soapCall("GetQuote", array($params));
58
  $quoteResponse = $result->GetQuoteResult;
59
+ //Mage::log("Price web:".$quoteResponse->Price, null, ShipIt.log);
60
  $price = $quoteResponse->Price;
61
  }
62
 
app/code/community/{Starshipit/Ship → Rvtech/Starshipit}/Model/Carrier/Fastway.php RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- class Starshipit_Ship_Model_Carrier_Fastway extends Mage_Shipping_Model_Carrier_Abstract
3
  implements Mage_Shipping_Model_Carrier_Interface {
4
  protected $_code = 'fastway';
5
 
@@ -16,7 +16,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
16
  $price = $this->getConfigData('price');
17
  }
18
  else{
19
- $apiKey = $this->getConfigData('apiKey');
20
  $destCountryId = $request->getDestCountryId();
21
  $destCountry = $request->getDestCountry();
22
  $destRegion = $request->getDestRegionId();
@@ -30,7 +30,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
30
  $packagedepth = $request->getPackageDepth();
31
 
32
  $params = array(
33
- "apiKey" => $apiKey,
34
  "carrierid"=>3,
35
  "street"=>$destStreet,
36
  "suburb"=>"",
@@ -56,7 +56,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
56
 
57
  $result = $client->__soapCall("GetQuote", array($params));
58
  $quoteResponse = $result->GetQuoteResult;
59
- //Mage::log("Price web:".$quoteResponse->Price, null, starshipit.log);
60
  $price = $quoteResponse->Price;
61
  }
62
 
1
  <?php
2
+ class Rvtech_Starshipit_Model_Carrier_Fastway extends Mage_Shipping_Model_Carrier_Abstract
3
  implements Mage_Shipping_Model_Carrier_Interface {
4
  protected $_code = 'fastway';
5
 
16
  $price = $this->getConfigData('price');
17
  }
18
  else{
19
+ $shipItApiKey = Mage::helper('shipnote')->getShipItApiKey();
20
  $destCountryId = $request->getDestCountryId();
21
  $destCountry = $request->getDestCountry();
22
  $destRegion = $request->getDestRegionId();
30
  $packagedepth = $request->getPackageDepth();
31
 
32
  $params = array(
33
+ "apiKey" => $shipItApiKey,
34
  "carrierid"=>3,
35
  "street"=>$destStreet,
36
  "suburb"=>"",
56
 
57
  $result = $client->__soapCall("GetQuote", array($params));
58
  $quoteResponse = $result->GetQuoteResult;
59
+ //Mage::log("Price web:".$quoteResponse->Price, null, ShipIt.log);
60
  $price = $quoteResponse->Price;
61
  }
62
 
app/code/community/{Starshipit/Ship → Rvtech/Starshipit}/Model/Carrier/Nzpost.php RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- class Starshipit_Ship_Model_Carrier_Nzpost extends Mage_Shipping_Model_Carrier_Abstract
3
  implements Mage_Shipping_Model_Carrier_Interface {
4
  protected $_code = 'nzpost';
5
 
@@ -16,7 +16,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
16
  $price = $this->getConfigData('price');
17
  }
18
  else{
19
- $apiKey = $this->getConfigData('apiKey');
20
  $destCountryId = $request->getDestCountryId();
21
  $destCountry = $request->getDestCountry();
22
  $destRegion = $request->getDestRegionId();
@@ -30,7 +30,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
30
  $packagedepth = $request->getPackageDepth();
31
 
32
  $params = array(
33
- "apiKey" => $apiKey,
34
  "carrierid"=>1,
35
  "street"=>$destStreet,
36
  "suburb"=>"",
@@ -57,12 +57,12 @@ implements Mage_Shipping_Model_Carrier_Interface {
57
 
58
  $result = $client->__soapCall("GetQuote", array($params));
59
  $quoteResponse = $result->GetQuoteResult;
60
- //Mage::log("Price web:".$quoteResponse->Price, null, starshipit.log);
61
  $price = $quoteResponse->Price;
62
  }
63
  catch (Exception $e)
64
  {
65
- Mage::log($e->getMessage(), null, starshipit.log);
66
  }
67
  }
68
 
1
  <?php
2
+ class Rvtech_Starshipit_Model_Carrier_Nzpost extends Mage_Shipping_Model_Carrier_Abstract
3
  implements Mage_Shipping_Model_Carrier_Interface {
4
  protected $_code = 'nzpost';
5
 
16
  $price = $this->getConfigData('price');
17
  }
18
  else{
19
+ $shipItApiKey = Mage::helper('shipnote')->getShipItApiKey();
20
  $destCountryId = $request->getDestCountryId();
21
  $destCountry = $request->getDestCountry();
22
  $destRegion = $request->getDestRegionId();
30
  $packagedepth = $request->getPackageDepth();
31
 
32
  $params = array(
33
+ "apiKey" => $shipItApiKey,
34
  "carrierid"=>1,
35
  "street"=>$destStreet,
36
  "suburb"=>"",
57
 
58
  $result = $client->__soapCall("GetQuote", array($params));
59
  $quoteResponse = $result->GetQuoteResult;
60
+ //Mage::log("Price web:".$quoteResponse->Price, null, ShipIt.log);
61
  $price = $quoteResponse->Price;
62
  }
63
  catch (Exception $e)
64
  {
65
+ Mage::log($e->getMessage(), null, ShipIt.log);
66
  }
67
  }
68
 
app/code/community/Rvtech/Starshipit/Model/Note.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Rvtech_Starshipit_Model_Note extends Mage_Core_Model_Abstract
3
+ {
4
+ /**
5
+ * Constructor.
6
+ */
7
+ public function _construct()
8
+ {
9
+ $this->_init('shipnote/note');
10
+ }
11
+
12
+ /**
13
+ * Load a ship note by order
14
+ *
15
+ * @param Mage_Sales_Model_Order $order
16
+ * @return bool|Rvtech_Starshipit_Model_Note
17
+ */
18
+ public function loadByOrder(Mage_Sales_Model_Order $order)
19
+ {
20
+ $shipNoteId = $order->getData('ship_note_id');
21
+ if (null !== $shipNoteId) {
22
+ return Mage::getModel('shipnote/note')
23
+ ->load($shipNoteId);
24
+ }
25
+ return false;
26
+ }
27
+
28
+ /**
29
+ * Load a ship note by order id
30
+ *
31
+ * @param $orderId
32
+ * @return bool|Rvtech_Starshipit_Model_Note
33
+ */
34
+ public function loadByOrderId($orderId)
35
+ {
36
+ $order = Mage::getModel('sales/order')->load($orderId);
37
+ if (null !== $order->getId()) {
38
+ return $this->loadByOrder($order);
39
+ }
40
+ return false;
41
+ }
42
+
43
+ /**
44
+ * @return string
45
+ */
46
+ public function __toString()
47
+ {
48
+ if (is_null($this->getData('delivery_instructions'))) {
49
+ return '';
50
+ }
51
+ return $this->getData('delivery_instructions');
52
+ }
53
+ }
app/code/community/Rvtech/Starshipit/Model/Observer.php CHANGED
@@ -1,23 +1,18 @@
1
  <?php
 
 
 
 
 
2
 
3
- class Rvtech_Starshipit_Model_Observer {
4
-
5
- const STARSHIP_BASE = 'http://app.starshipit.com/Members/Search.aspx';
6
- protected $_noticeTitle = 'Starship Automatic Synchronization';
7
-
8
- protected $_noticeStatus;
9
-
10
- public function syncOrdersNow() {
11
-
12
- $noticeMsg = '';
13
- $helper = Mage::helper('starshipit/starship');
14
-
15
- $orderObj = Mage::getModel('starshipit/orders');
16
 
17
  //get the configuration array (username, apikey etc.)
18
  $para = $orderObj->getDataForExistingOredrs();
19
-
20
-
21
  //get existing orders from Starship
22
  $existingOrderRes = $helper->getExistingOrders($para);
23
 
@@ -75,40 +70,36 @@ class Rvtech_Starshipit_Model_Observer {
75
  }
76
  }
77
  }
78
- }else{
 
79
 
80
  $this->_noticeStatus = 3;
81
- $noticeMsg .= $existingOrderRes->GetExistingResult->ErrorMessage;
82
-
83
  }
84
-
85
  $this->_addNotice($noticeMsg);
 
86
 
87
- }
88
-
89
- protected function _addNotice($msg)
90
- {
91
- $notice = Mage::getModel('adminNotification/inbox');
92
-
93
- switch ($this->_noticeStatus) {
94
- case 0:
95
- $notice->add(2,$this->_noticeTitle,$msg);
96
- break;
97
- case 1:
98
- $notice->add(3,$this->_noticeTitle,$msg);
99
- break;
100
- case 3:
101
- $notice->add(1,$this->_noticeTitle,$msg);
102
- break;
103
-
104
- default:
105
- $notice->add(4,$this->_noticeTitle,$msg);
106
- break;
107
- }
108
-
109
- }
110
 
111
- public function addMassAction($observer)
112
  {
113
  $block = $observer->getEvent()->getBlock();
114
  $cur_url = Mage::helper('core/url')->getCurrentUrl();
@@ -121,11 +112,69 @@ class Rvtech_Starshipit_Model_Observer {
121
  if(get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
122
  && $block->getRequest()->getControllerName() == 'sales_order')
123
  {
124
- $block->addItem('starshipIt_multi', array(
125
- 'label' => 'StarShipIt',
126
- 'starshipIt_url' => $starshipUrl,
127
 
128
  ));
129
  }
130
  }
131
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ class Rvtech_Starshipit_Model_Observer extends Mage_Core_Helper_Abstract
3
+ {
4
+ const STARSHIP_BASE = 'http://app.starshipit.com/Members/Search.aspx';
5
+ protected $_noticeTitle = 'Starship Automatic Synchronization';
6
+ protected $_noticeStatus;
7
 
8
+ public function syncOrdersNow() {
9
+ $noticeMsg = '';
10
+ $helper = Mage::helper('shipit/starship');
11
+ $orderObj = Mage::getModel('shipit/orders');
 
 
 
 
 
 
 
 
 
12
 
13
  //get the configuration array (username, apikey etc.)
14
  $para = $orderObj->getDataForExistingOredrs();
15
+
 
16
  //get existing orders from Starship
17
  $existingOrderRes = $helper->getExistingOrders($para);
18
 
70
  }
71
  }
72
  }
73
+ }
74
+ else {
75
 
76
  $this->_noticeStatus = 3;
77
+ $noticeMsg .= $existingOrderRes->GetExistingResult->ErrorMessage;
 
78
  }
 
79
  $this->_addNotice($noticeMsg);
80
+ }
81
 
82
+ protected function _addNotice($msg)
83
+ {
84
+ $notice = Mage::getModel('adminNotification/inbox');
85
+
86
+ switch ($this->_noticeStatus) {
87
+ case 0:
88
+ $notice->add(2,$this->_noticeTitle,$msg);
89
+ break;
90
+ case 1:
91
+ $notice->add(3,$this->_noticeTitle,$msg);
92
+ break;
93
+ case 3:
94
+ $notice->add(1,$this->_noticeTitle,$msg);
95
+ break;
96
+ default:
97
+ $notice->add(4,$this->_noticeTitle,$msg);
98
+ break;
99
+ }
100
+ }
 
 
 
 
101
 
102
+ public function addMassAction($observer)
103
  {
104
  $block = $observer->getEvent()->getBlock();
105
  $cur_url = Mage::helper('core/url')->getCurrentUrl();
112
  if(get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
113
  && $block->getRequest()->getControllerName() == 'sales_order')
114
  {
115
+ $block->addItem('shipIt_multi', array(
116
+ 'label' => 'ShipIt',
117
+ 'shipIt_url' => $starshipUrl,
118
 
119
  ));
120
  }
121
  }
122
+ /**
123
+ * Take the note from post and and store it in the current quote.
124
+ *
125
+ * When the quote gets converted we will store the delivery note
126
+ * and assign to the order
127
+ *
128
+ * @param Varien_Event_Observer $observer
129
+ * @return Rvtech_Starshipit_Model_Observer
130
+ */
131
+ public function checkout_controller_onepage_save_shipping_method(Varien_Event_Observer $observer)
132
+ {
133
+ $shipSignatureRequiredInt = $observer->getEvent()->getRequest()->getParam('ship-signature-required');
134
+ $shipAuthorityToLeaveInt = 0;
135
+ $shipAuthorityToLeave = $observer->getEvent()->getRequest()->getParam('ship-authority-to-leave');
136
+ $shipNote = $observer->getEvent()->getRequest()->getParam('ship-note');
137
+
138
+ if (!empty($shipAuthorityToLeave)) {
139
+ if ($shipAuthorityToLeave == 'on') {
140
+ $shipAuthorityToLeaveInt = 1;
141
+ }
142
+ }
143
+ $shipNoteId = Mage::getModel('shipnote/note')
144
+ ->setDeliveryInstructions($shipNote)
145
+ ->setSignatureRequired($shipSignatureRequiredInt)
146
+ ->setAuthorityToLeave($shipAuthorityToLeaveInt)
147
+ ->save()
148
+ ->getId();
149
+ try {
150
+ $observer->getEvent()->getQuote()
151
+ ->setShipNote($shipNoteId)
152
+ ->save();
153
+ } catch (Exception $e) {
154
+ Mage::logException($e);
155
+ }
156
+
157
+ return $this;
158
+ }
159
+
160
+ /**
161
+ * If the quote has a delivery note then lets save that note and
162
+ * assign the id to the order
163
+ *
164
+ * @param Varien_Event_Observer $observer
165
+ * @return Rvtech_Starshipit_Model_Observer
166
+ */
167
+ public function sales_convert_quote_to_order(Varien_Event_Observer $observer)
168
+ {
169
+ if ($shipNoteId = $observer->getEvent()->getQuote()->getShipNote()) {
170
+ try {
171
+ $observer->getEvent()->getOrder()
172
+ ->setShipNoteId($shipNoteId);
173
+
174
+ } catch (Exception $e) {
175
+ Mage::logException($e);
176
+ }
177
+ }
178
+ return $this;
179
+ }
180
+ }
app/code/community/Rvtech/Starshipit/Model/Orders.php CHANGED
@@ -16,27 +16,27 @@ class Rvtech_Starshipit_Model_Orders extends Mage_Sales_Model_Order {
16
 
17
  public function _getUserName() {
18
 
19
- return Mage::getStoreConfig('starshipit_options/group1/username');
20
  }
21
 
22
  public function _getAPIKey() {
23
 
24
- return Mage::getStoreConfig('starshipit_options/group1/api_key');
25
  }
26
 
27
  protected function _getUpdateOrderConfig() {
28
 
29
- return Mage::getStoreConfig('starshipit_options/group1/update_orders');
30
  }
31
 
32
  protected function _getSyncOrderConfig() {
33
 
34
- return Mage::getStoreConfig('starshipit_options/group1/sync_orders');
35
  }
36
 
37
  protected function _getSyncOrderAutoConfig() {
38
 
39
- return Mage::getStoreConfig('starshipit_options/group1/sync_orders_yesno');
40
  }
41
 
42
  protected function _getFormattedTelephone($order){
@@ -48,15 +48,15 @@ class Rvtech_Starshipit_Model_Orders extends Mage_Sales_Model_Order {
48
 
49
  Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
50
  Mage::getModel('core/config')
51
- ->saveConfig('starshipit_options/group1/username', $postData['username']);
52
  Mage::getModel('core/config')
53
- ->saveConfig('starshipit_options/group1/api_key', $postData['api_key']);
54
  Mage::getModel('core/config')
55
- ->saveConfig('starshipit_options/group1/update_orders', $postData['update_orders']);
56
  Mage::getModel('core/config')
57
- ->saveConfig('starshipit_options/group1/sync_orders', $postData['sync_orders']);
58
  Mage::getModel('core/config')
59
- ->saveConfig('starshipit_options/group1/sync_orders_yesno', $postData['sync_orders_yesno']);
60
  }
61
 
62
 
16
 
17
  public function _getUserName() {
18
 
19
+ return Mage::getStoreConfig('shipit_options/group1/username');
20
  }
21
 
22
  public function _getAPIKey() {
23
 
24
+ return Mage::getStoreConfig('shipit_options/group1/api_key');
25
  }
26
 
27
  protected function _getUpdateOrderConfig() {
28
 
29
+ return Mage::getStoreConfig('shipit_options/group1/update_orders');
30
  }
31
 
32
  protected function _getSyncOrderConfig() {
33
 
34
+ return Mage::getStoreConfig('shipit_options/group1/sync_orders');
35
  }
36
 
37
  protected function _getSyncOrderAutoConfig() {
38
 
39
+ return Mage::getStoreConfig('shipit_options/group1/sync_orders_yesno');
40
  }
41
 
42
  protected function _getFormattedTelephone($order){
48
 
49
  Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
50
  Mage::getModel('core/config')
51
+ ->saveConfig('shipit_options/group1/username', $postData['username']);
52
  Mage::getModel('core/config')
53
+ ->saveConfig('shipit_options/group1/api_key', $postData['api_key']);
54
  Mage::getModel('core/config')
55
+ ->saveConfig('shipit_options/group1/update_orders', $postData['update_orders']);
56
  Mage::getModel('core/config')
57
+ ->saveConfig('shipit_options/group1/sync_orders', $postData['sync_orders']);
58
  Mage::getModel('core/config')
59
+ ->saveConfig('shipit_options/group1/sync_orders_yesno', $postData['sync_orders_yesno']);
60
  }
61
 
62
 
app/code/community/Rvtech/Starshipit/Model/Orders.php_ORG DELETED
@@ -1,437 +0,0 @@
1
- <?php
2
-
3
- class Rvtech_Starshipit_Model_Orders extends Mage_Sales_Model_Order {
4
-
5
- protected $_User;
6
-
7
- protected $_APIKey;
8
-
9
- protected $_auth = array();
10
-
11
- protected $_orderInMage = array();
12
-
13
- protected $_orderInStarShip = array();
14
-
15
- protected $_dataForExistingOredrs = array();
16
-
17
- public function _getUserName() {
18
-
19
- return Mage::getStoreConfig('starshipit_options/group1/username');
20
- }
21
-
22
- public function _getAPIKey() {
23
-
24
- return Mage::getStoreConfig('starshipit_options/group1/api_key');
25
- }
26
-
27
- protected function _getUpdateOrderConfig() {
28
-
29
- return Mage::getStoreConfig('starshipit_options/group1/update_orders');
30
- }
31
-
32
- protected function _getSyncOrderConfig() {
33
-
34
- return Mage::getStoreConfig('starshipit_options/group1/sync_orders');
35
- }
36
-
37
- protected function _getSyncOrderAutoConfig() {
38
-
39
- return Mage::getStoreConfig('starshipit_options/group1/sync_orders_yesno');
40
- }
41
-
42
- protected function _getFormattedTelephone($order){
43
-
44
- return str_replace('-', '', $order->getShippingAddress()->getData('telephone'));
45
- }
46
-
47
- public function getAuthDetails() {
48
-
49
- $this->_auth = array(
50
-
51
- 'userName' => $this->_getUserName(),
52
- 'apiKey' => $this->_getAPIKey()
53
- );
54
- return $this->_auth;
55
- }
56
-
57
- public function getDataForExistingOredrs() {
58
-
59
- $this->_dataForExistingOredrs = array(
60
-
61
- 'User' => $this->_getUserName(),
62
- 'APIKey' => $this->_getAPIKey(),
63
- 'Days' => $this->_getSyncOrderConfig(),
64
- 'Orders' => $this->_getUpdateOrderConfig(),
65
-
66
- );
67
-
68
- return $this->_dataForExistingOredrs;
69
- }
70
-
71
- /**
72
- * Convert date array to UTC
73
- * for comaprison purpose
74
- * @return array
75
- */
76
-
77
- protected function _formatDateUtc($dateArr = array()){
78
-
79
- $dateUtcArr = array();
80
- foreach ($dateArr as $id => $date) {
81
- $dateUtcArr[$id] = strtotime($date);
82
- }
83
- return $dateUtcArr;
84
- }
85
-
86
- /**
87
- * Convert date in Starship Accpetable Format
88
- *
89
- * @return string
90
- */
91
-
92
- protected function _formatDateStarShip($date){
93
-
94
- return date('d/m/Y h:i:s A',strtotime($date));
95
- }
96
-
97
- /**
98
- * Check all oredrs in Magento with status Processing
99
- * and set their Ids as key and Update_at as value in Protected array _orderInMage
100
- * @return none
101
- */
102
-
103
- protected function _checkOrdersInMage() {
104
-
105
- foreach ($this->getCollection() as $order) {
106
- if(strtolower($order->getStatusLabel()) === self::STATE_PROCESSING) {
107
- $this->_orderInMage[$order->getData('entity_id')] = $order->getData('updated_at');
108
- }
109
- }
110
-
111
- }
112
-
113
- /**
114
- * Prepare a final array of Oredrs via comparing Orders in Mage and Oredrs in Starship
115
- *
116
- * @return array
117
- */
118
-
119
-
120
- protected function _checkOrderToProcess($orders = array()) {
121
-
122
- $ordersToProcess = array();
123
- $this->_checkOrdersInMage();
124
- $orderInStarShipUtc = $this->_formatDateUtc($this->_orderInStarShip);
125
- $orderInMageUtc = $this->_formatDateUtc($this->_orderInMage);
126
-
127
- foreach ($orderInMageUtc as $key => $value) {
128
- if (array_key_exists($key,$orderInStarShipUtc)) {
129
- if($value >= $orderInStarShipUtc[$key]){
130
- $ordersToProcess[] = $key;
131
- }
132
- }else{
133
- $ordersToProcess[] = $key;
134
- }
135
-
136
- }
137
-
138
- return $ordersToProcess;
139
- }
140
-
141
- /**
142
- * Prepare Orders details to send over Starship
143
- *
144
- * @return array
145
- */
146
-
147
- protected function _orderShippedArr($ordersToProcess = array()){
148
-
149
- $orderList = array();
150
- foreach ($this->getCollection() as $order) {
151
-
152
- if(in_array($order->getData('entity_id'),$ordersToProcess)) {
153
-
154
- $orderData['Id'] = $order->getData('entity_id');
155
- $orderData['SequenceNumber'] = $order->getData('entity_id');
156
- $orderData['SequenceGuid'] = null;
157
- $orderData['OrginalSeqNumber'] = 0;
158
- $orderData['AccountingAppId'] = 3;
159
- $orderData['ShippedDate'] = $this->_getOrderShipmentCreatedDate($order);
160
- $orderData['Date'] = $this->_formatDateStarShip($order->getData('created_at'));
161
- $orderData['To'] = $this->_getOrderTo($order);
162
- $orderData['OurRef'] = (string) $order->getData('increment_id');
163
- $orderData['TheirRef'] = (string) $order->getData('entity_id');
164
- $orderData['ConsigneeCode'] = '';
165
- $orderData['Email'] = (string) $order->getData('customer_email');
166
- $orderData['Telephone'] = (string) $this->_getFormattedTelephone($order);
167
- $orderData['AddressString'] = (string) $this->_getOrderShippingAddress($order,true);
168
- $orderData['ItemsString'] = (string) $this->_getOrderItemsStr($order);
169
- $orderData['TrackingNumber'] = '';
170
- $orderData['CarrierCode'] = 0;
171
- $orderData['ProductName'] = 'P';
172
- $orderData['ErrorMessage'] = '';
173
- $orderData['Status'] = 0;
174
- $orderData['TrackingCode'] = '';
175
- $orderData['Invoiced'] = '';
176
- $orderData['OrderValue'] = (float) $order->getData('total_qty_ordered');
177
- $orderData['OrderCurrency'] = (string) $order->getData('global_currency_code');
178
- $orderData['AddressChecked'] = true;
179
- $orderData['AddressValidated'] = true;
180
- $orderData['ShipmentDescription'] = "ShipmentDescription";
181
- $orderData['Items'] = $this->_getOrderItemsArr($order);
182
- $orderData['AddressDetails'] = $this->_getOrderShippingAddress($order);
183
- $orderData['BillingAddress'] = (string) $this->_getOrderBillingAddress($order);
184
- $orderData['LastUpdatedatSource'] = (string) $this->_formatDateStarShip($order->getData('updated_at'));
185
- $orderList[] = $orderData;
186
-
187
- }
188
-
189
- }
190
-
191
- return $orderList;
192
- }
193
-
194
- /**
195
- * Get shipment created date
196
- *
197
- * @return string
198
- */
199
-
200
- protected function _getOrderShipmentCreatedDate($order){
201
-
202
- $date = '';
203
- if(!$order->canShip()){
204
- $shipData = $order->getShipmentsCollection()->getData();
205
- $date = $this->_formatDateStarShip($shipData[0]['created_at']);
206
- }
207
-
208
- return $date;
209
- }
210
-
211
- /**
212
- * Get person name
213
- *
214
- * @return string
215
- */
216
-
217
- protected function _getOrderTo($order){
218
-
219
- $firstName = $order->getShippingAddress()->getData('firstname');
220
- $lastName = $order->getShippingAddress()->getData('lastname');
221
- $name = $firstName." ".$lastName;
222
- return $name;
223
- }
224
-
225
- /**
226
- * Get country full name
227
- *
228
- * @return string
229
- */
230
-
231
- protected function _getCountryNameByCode($country_code){
232
-
233
- return Mage::app()->getLocale()->getCountryTranslation($country_code);
234
- }
235
-
236
- /**
237
- * Get shippment address
238
- *
239
- * @return string/array
240
- */
241
-
242
- protected function _getOrderShippingAddress($order, $string = false ) {
243
-
244
- $addArr = array();
245
- $AddressDTO = array();
246
- if($string){
247
- $streetAdd = $order->getShippingAddress()->getData('street');
248
- $street = trim(preg_replace('/\s+/', ' ', $streetAdd));
249
- $city = $order->getShippingAddress()->getData('city');
250
- $postcode = $order->getShippingAddress()->getData('postcode');
251
- $countryCode = $order->getShippingAddress()->getData('country_id');
252
- $country = $this->_getCountryNameByCode($countryCode);
253
- $addString = $street."k ".$city." ".$postcode." ".$country;
254
- return $addString;
255
- }
256
-
257
- $addArr['City'] = $order->getShippingAddress()->getData('city');
258
- $addArr['Company'] = $order->getShippingAddress()->getData('company');
259
- $addArr['Country'] = $this->_getCountryNameByCode($order->getShippingAddress()->getData('country_id'));
260
- $addArr['CountryId'] = $order->getShippingAddress()->getData('country_id');
261
- $addArr['Instructions'] = '';
262
- $addArr['PostCode'] = $order->getShippingAddress()->getData('postcode');
263
- $addArr['Region'] = $order->getShippingAddress()->getData('region');
264
- $addArr['State'] = '';
265
- $addArr['Street'] = $order->getShippingAddress()->getData('street');
266
- $addArr['Suburb'] = '';
267
- $AddressDTO['AddressDTO'] = $addArr;
268
- return $addArr;
269
-
270
- }
271
-
272
- /**
273
- * Get billing addresss
274
- *
275
- * @return string
276
- */
277
-
278
- protected function _getOrderBillingAddress($order) {
279
-
280
- $streetAdd = $order->getBillingAddress()->getData('street');
281
- $street = trim(preg_replace('/\s+/', ' ', $streetAdd));
282
- $city = $order->getBillingAddress()->getData('city');
283
- $postcode = $order->getBillingAddress()->getData('postcode');
284
- $country = $order->getBillingAddress()->getData('country_id');
285
- $add = $street." ".$city." ".$postcode." ".$country;
286
-
287
- return $add;
288
-
289
- }
290
-
291
- /**
292
- * Get Oredrs Items as string
293
- *
294
- * @return string
295
- */
296
- protected function _getOrderItemsStr($order) {
297
-
298
- $allItemsArr = $order->getAllVisibleItems();
299
- $itemsStr = '';
300
- $lastItemArr = end($allItemsArr);
301
- $count = count($allItemsArr);
302
- foreach ($allItemsArr as $item) {
303
- $itemsStr .= $item->getName();
304
- if( $count > 1 && $item->getId() != $lastItemArr->getId())
305
- $itemsStr .= ', ';
306
- }
307
-
308
- return $itemsStr;
309
-
310
- }
311
-
312
- /**
313
- * Get Order's items
314
- *
315
- * @return array
316
- */
317
-
318
- protected function _getOrderItemsArr($order, $string = false) {
319
-
320
- $ItemsArr = array();
321
- $shipmentitems = array();
322
- foreach ($order->getAllVisibleItems() as $item) {
323
- $ItemsArr['Description'] = (string)$item->getName();
324
- $ItemsArr['Country'] = (string)$order->getShippingAddress()->getData('country_id');;
325
- $ItemsArr['Price'] = (float)$item->getPrice();
326
- $ItemsArr['Quantity'] = (int)round($item->getQtyOrdered());
327
- $shipmentitems['ShipmentItem'][] = $ItemsArr;
328
- }
329
-
330
- return $shipmentitems;
331
-
332
- }
333
-
334
- /**
335
- * Prepare final Orders Array with auth details to pass
336
- * over the star ship
337
- * @return array
338
- */
339
-
340
- public function prepareOrderToPass($orders = array()) {
341
-
342
- $this->_orderInStarShip = $orders;
343
- $ordersToProcess = $this->_checkOrderToProcess($orders);
344
- $arrOrdersToPass['UserName'] = $this->_getUserName();
345
- $arrOrdersToPass['Password'] = $this->_getAPIKey();
346
- $arrOrdersToPass['Orders'] = $this->_orderShippedArr($ordersToProcess);
347
-
348
-
349
- return $arrOrdersToPass;
350
-
351
-
352
- }
353
-
354
- public function needToUpdateOredrsInMage(){
355
-
356
- return $this->_getUpdateOrderConfig();
357
- }
358
-
359
-
360
-
361
- /**
362
- * Create shippment and set the tracking info to ot
363
- *
364
- * @return
365
- */
366
-
367
- protected function _setAndSaveTrackingInfo($orderId,$orderCarrier,$orderTrackingNumber){
368
-
369
- foreach ($this->getCollection() as $order) {
370
- if($order->getData('entity_id') == $orderId && $order->canShip()){
371
-
372
- try {
373
-
374
- $shipment = $order->prepareShipment();
375
- $shipment->register();
376
- $order->setIsInProcess(true);
377
- $order->addStatusHistoryComment('Automatically SHIPPED by Starship.', false);
378
- $transactionSave = Mage::getModel('core/resource_transaction')
379
- ->addObject($shipment)
380
- ->addObject($shipment->getOrder())
381
- ->save();
382
-
383
- if($shipment->getId() != '') {
384
- try{
385
- $track = Mage::getModel('sales/order_shipment_track')
386
- ->setShipment($shipment)
387
- ->setData('number', $orderTrackingNumber)
388
- ->setData('carrier_code', strtolower($orderCarrier))
389
- ->setData('order_id', $shipment->getData('order_id'))
390
- ->save();
391
- return true;
392
- }catch(Exception $e){
393
-
394
- Mage::getSingleton('core/session')
395
- ->addError($this->__('Shipment added But Error while adding Tracking details Error is: ').$e->getMessage());
396
- }
397
- }
398
- }catch(Exception $e){
399
- $order->addStatusHistoryComment('Starship_Invoicer: Exception occurred during action. Exception message: '.$e->getMessage(), false);
400
- $order->save();
401
- Mage::getSingleton('core/session')->addError($this->__('Exception Occured: ').$e->getMessage());
402
- }
403
-
404
- }
405
- }
406
-
407
- }
408
-
409
- public function addTrackingInfo($trackingInfo) {
410
-
411
- $WritebackStruct = $trackingInfo->GetMagentoWritebacksResult->WritebackStruct;
412
-
413
- if(is_array($WritebackStruct)){
414
-
415
- foreach ($WritebackStruct as $orderTrackInfo) {
416
- $orderId = $orderTrackInfo->Sequence;
417
- $orderCarrier = $orderTrackInfo->Carrier;
418
- $orderTrackingNumber = $orderTrackInfo->TrackingNumber;
419
- $this->_setAndSaveTrackingInfo($orderId,$orderCarrier,$orderTrackingNumber);
420
- }
421
-
422
- return true;
423
-
424
- }else{
425
- $orderId = $WritebackStruct->Sequence;
426
- $orderCarrier = $WritebackStruct->Carrier;
427
- $orderTrackingNumber = $WritebackStruct->TrackingNumber;
428
- $this->_setAndSaveTrackingInfo($orderId,$orderCarrier,$orderTrackingNumber);
429
-
430
- return true;
431
- }
432
-
433
- return false;
434
-
435
-
436
- }
437
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Rvtech/Starshipit/Model/Resource/Note.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Rvtech_Starshipit_Model_Resource_Note extends Mage_Core_Model_Resource_Db_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init('shipnote/note', 'note_id');
7
+ }
8
+ }
app/code/community/Rvtech/Starshipit/Model/Resource/Note/Collection.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Rvtech_Starshipit_Model_Resource_Note_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init('shipnote/note');
7
+ }
8
+ }
app/code/community/Rvtech/Starshipit/controllers/Adminhtml/{StarshipitController.php → ShipItController.php} RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- class Rvtech_Starshipit_Adminhtml_StarshipitController extends Mage_Adminhtml_Controller_Action
3
  {
4
 
5
 
@@ -20,7 +20,7 @@ class Rvtech_Starshipit_Adminhtml_StarshipitController extends Mage_Adminhtml_Co
20
  );
21
  // $this->getResponse()->setBody(print_r($autoTo));
22
 
23
- $helper = Mage::helper('starshipit/starship');
24
  $resStarShip = $helper->validateUser($autoTo);
25
  if($resStarShip === 'Success'){
26
  Mage::getSingleton('core/session')->addSuccess('Valid UserName And APIKey');
@@ -54,10 +54,10 @@ class Rvtech_Starshipit_Adminhtml_StarshipitController extends Mage_Adminhtml_Co
54
 
55
 
56
 
57
- $helper = Mage::helper('starshipit/starship');
58
  $postData = $helper->arrangePostData($params);
59
  //$this->getResponse()->setBody(print_r($postData));
60
- $orderObj = Mage::getModel('starshipit/orders');
61
 
62
  //get the configuration array (username, apikey etc.)
63
  $para = $orderObj->getDataForExistingOredrs($postData);
1
  <?php
2
+ class Rvtech_Starshipit_Adminhtml_ShipItController extends Mage_Adminhtml_Controller_Action
3
  {
4
 
5
 
20
  );
21
  // $this->getResponse()->setBody(print_r($autoTo));
22
 
23
+ $helper = Mage::helper('shipit/starship');
24
  $resStarShip = $helper->validateUser($autoTo);
25
  if($resStarShip === 'Success'){
26
  Mage::getSingleton('core/session')->addSuccess('Valid UserName And APIKey');
54
 
55
 
56
 
57
+ $helper = Mage::helper('shipit/starship');
58
  $postData = $helper->arrangePostData($params);
59
  //$this->getResponse()->setBody(print_r($postData));
60
+ $orderObj = Mage::getModel('shipit/orders');
61
 
62
  //get the configuration array (username, apikey etc.)
63
  $para = $orderObj->getDataForExistingOredrs($postData);
app/code/community/Rvtech/Starshipit/controllers/Adminhtml/StarshipitController.php_ORG DELETED
@@ -1,101 +0,0 @@
1
- <?php
2
- class Rvtech_Starshipit_Adminhtml_StarshipitController extends Mage_Adminhtml_Controller_Action
3
- {
4
-
5
-
6
- /**
7
- * Return some checking result
8
- *
9
- * @return void
10
- */
11
- public function testAction()
12
- {
13
-
14
- $helper = Mage::helper('starshipit/starship');
15
- $resStarShip = $helper->validateUser();
16
- if($resStarShip === 'Success'){
17
- Mage::getSingleton('core/session')->addSuccess('Valid UserName And APIKey');
18
- }
19
- else{
20
- Mage::getSingleton('core/session')->addError($resStarShip);
21
- }
22
-
23
- Mage::app()->getResponse()->setBody(
24
- $this->getLayout()->getMessagesBlock()->getGroupedHtml()
25
- );
26
- }
27
-
28
- /**
29
- * will sync orders
30
- *
31
- * @return void
32
- */
33
-
34
- public function syncOrderAction(){
35
-
36
- $helper = Mage::helper('starshipit/starship');
37
-
38
- $orderObj = Mage::getModel('starshipit/orders');
39
-
40
- //get the configuration array (username, apikey etc.)
41
- $para = $orderObj->getDataForExistingOredrs();
42
-
43
-
44
- //get existing orders from Starship
45
- $existingOrderRes = $helper->getExistingOrders($para);
46
-
47
- if(empty($existingOrderRes->GetExistingResult->ErrorMessage)){
48
- $resOrders = $existingOrderRes
49
- ->GetExistingResult
50
- ->Orders;
51
- $odersArr = array();
52
- try{
53
- if(isset($resOrders->ExistingOrder)){
54
- $resExistingOrder = $resOrders->ExistingOrder;
55
- $odersArr = $helper->finalOrderArrOverStarShip($resExistingOrder);
56
- }
57
- }catch(Exception $e){
58
-
59
- Mage::getSingleton('core/session')->addError($e->getMessage());
60
- }
61
-
62
-
63
- //get Orders array to sync with StarShip
64
- $ordersToPass = $orderObj->prepareOrderToPass($odersArr);
65
-
66
- if(empty($ordersToPass['Orders'])) {
67
- Mage::getSingleton('core/session')->addNotice('No order found for sync to Starship');
68
- }else{
69
- Mage::getSingleton('core/session')->addSuccess('Orders sync to Starship ');
70
- }
71
-
72
- //Sync orders and store resonpse
73
- $resShipSync = $helper->addShipment($ordersToPass);
74
-
75
- //Change Order State and add Track Info
76
- if($helper->checkCondForMagentoWritebacks($resShipSync)) {
77
- $resWriteBack = $helper->getMagentoWritebacks();
78
- if(isset($resWriteBack->GetMagentoWritebacksResult->WritebackStruct)){
79
- $isTackadded = $orderObj->addTrackingInfo($resWriteBack);
80
- if($isTackadded) {
81
- Mage::getSingleton('core/session')->addSuccess('Tracking Info SAVED');
82
- }
83
- }else{
84
- Mage::getSingleton('core/session')->addNotice('No tracking info found on Starship');
85
- }
86
- }
87
-
88
- }else{
89
-
90
- Mage::getSingleton('core/session')->addError(
91
- $existingOrderRes->GetExistingResult->ErrorMessage
92
- );
93
- }
94
-
95
- Mage::app()->getResponse()->setBody(
96
- $this->getLayout()->getMessagesBlock()->getGroupedHtml()
97
- );
98
-
99
- }
100
-
101
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Rvtech/Starshipit/controllers/IndexController.php CHANGED
@@ -1,7 +1,5 @@
1
  <?php
2
- class Rvtech_Starshipit_IndexController extends Mage_Adminhtml_Controller_Action
3
  {
4
- public function indexAction() {
5
- // echo "hey there";
6
- }
7
  }
1
  <?php
2
+ class Rvtech_Starshipit_IndexController extends Mage_Core_Controller_Front_Action
3
  {
4
+
 
 
5
  }
app/code/community/Rvtech/Starshipit/etc/api.xml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <api>
3
+ <resources>
4
+ <shipnote translate="title" module="shipnote">
5
+ <model>Rvtech_Starshipit_Model_Api</model>
6
+ <title>ShipNote Resource</title>
7
+ <acl>shipnote</acl>
8
+ <methods>
9
+ <info translate="title" module="shipnote">
10
+ <title>Retrieve shipping note</title>
11
+ <acl>shipnote/info</acl>
12
+ <method>info</method>
13
+ </info>
14
+ </methods>
15
+ <faults module="shipnote">
16
+ <data_invalid> <!-- if we get invalid input data for shipnote -->
17
+ <code>100</code >
18
+ <!-- we cannot know all the errors that can appear, their details can be found in error message for call -->
19
+ <message>Invalid shipping note data. Details in error message.</message>
20
+ </data_invalid>
21
+ <filters_invalid>
22
+ <code>101</code >
23
+ <message>Invalid filters specified. Details in error message.</message>
24
+ </filters_invalid>
25
+ <not_exists>
26
+ <code>102</code >
27
+ <message>Shipping note doesn't exist.</message>
28
+ </not_exists>
29
+ <not_deleted>
30
+ <code>103</code >
31
+ <message>Shipping note was not deleted. Details in error message.</message>
32
+ </not_deleted>
33
+ </faults>
34
+ </shipnote>
35
+ </resources>
36
+ <acl>
37
+ <resources>
38
+ <shipnote translate="title" module="shipnote">
39
+ <title>ShipNotes</title>
40
+ <info translate="title" module="shipnote">
41
+ <title>Get Info</title>
42
+ </info>
43
+ </shipnote>
44
+ </resources>
45
+ </acl>
46
+ </api>
47
+ </config>
app/code/community/Rvtech/Starshipit/etc/config.xml CHANGED
@@ -1,87 +1,287 @@
1
- <config>
2
- <modules>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  <Rvtech_Starshipit>
4
- <version>1.0.0.0</version>
 
 
5
  </Rvtech_Starshipit>
6
- </modules>
7
- <admin>
8
- <routers>
9
- <adminhtml>
10
- <args>
11
- <modules>
12
- <starshipit after="Mage_Adminhtml">Rvtech_Starshipit</starshipit>
13
- </modules>
14
- </args>
15
- </adminhtml>
16
- </routers>
17
- </admin>
18
- <adminhtml>
19
- <acl>
20
- <resources>
21
- <admin>
22
- <children>
23
- <system>
24
- <children>
25
- <config>
26
- <children>
27
- <starshipit_options>
28
- <title>Starshipit Module Section</title>
29
- </starshipit_options>
30
- </children>
31
- </config>
32
- </children>
33
- </system>
34
- </children>
35
- </admin>
36
- </resources>
37
- </acl>
38
- <layout>
39
- <updates>
40
- <starshipit>
41
- <file>starshipit.xml</file>
42
- </starshipit>
43
- </updates>
44
- </layout>
45
- </adminhtml>
46
-   <global>
47
- <blocks>
48
- <starshipit>
49
- <class>Rvtech_Starshipit_Block</class>
50
- </starshipit>
51
- <adminhtml>
52
- <rewrite>
53
- <sales_order_view>Rvtech_Starshipit_Block_Sales_Order_View</sales_order_view>
54
- <!-- Massaction Done by Observer, check below -->
55
- <!-- <sales_order_grid>Rvtech_Starshipit_Block_Sales_Order_Grid</sales_order_grid> -->
56
- </rewrite>
57
- </adminhtml>
58
- </blocks>
59
- <models>
60
- <starshipit>
61
- <class>Rvtech_Starshipit_Model</class>
62
- </starshipit>
63
- </models>
64
- <helpers>
65
- <starshipit>
66
- <class>Rvtech_Starshipit_Helper</class>
67
- </starshipit>
68
- </helpers>
69
- <events>
70
- <core_block_abstract_prepare_layout_before>
71
- <observers>
72
- <starshipit_core_block_abstract_prepare_layout_before>
73
- <class>Rvtech_Starshipit_Model_Observer</class>
74
- <method>addMassAction</method>
75
- </starshipit_core_block_abstract_prepare_layout_before>
76
- </observers>
77
- </core_block_abstract_prepare_layout_before>
78
- </events>
79
- </global>
80
- <default>
81
- <starshipit_options>
82
- <group1>
83
- <sync_orders>5</sync_orders>
84
- </group1>
85
- </starshipit_options>
86
- </default>
87
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Rvtech_Starshipit>
5
+ <version>1.6.1</version>
6
+ </Rvtech_Starshipit>
7
+ </modules>
8
+ <admin>
9
+ <routers>
10
+ <adminhtml>
11
+ <args>
12
+ <modules>
13
+ <shipit after="Mage_Adminhtml">Rvtech_Starshipit</shipit>
14
+ </modules>
15
+ </args>
16
+ </adminhtml>
17
+ </routers>
18
+ </admin>
19
+ <adminhtml>
20
+ <acl>
21
+ <resources>
22
+ <admin>
23
+ <children>
24
+ <system>
25
+ <children>
26
+ <config>
27
+ <children>
28
+ <shipit_options>
29
+ <title>ShipIt Module Section</title>
30
+ </shipit_options>
31
+ <shipnote_options>
32
+ <title>Ship Notes</title>
33
+ </shipnote_options>
34
+ </children>
35
+ </config>
36
+ </children>
37
+ </system>
38
+ </children>
39
+ </admin>
40
+ </resources>
41
+ </acl>
42
+ <events>
43
+ <adminhtml_sales_order_create_process_data>
44
+ <observers>
45
+ <shipnote>
46
+ <class>Rvtech_Starshipit_Model_Adminhtml_Observer</class>
47
+ <method>adminhtml_sales_order_create_process_data</method>
48
+ </shipnote>
49
+ </observers>
50
+ </adminhtml_sales_order_create_process_data>
51
+ <sales_convert_quote_to_order>
52
+ <observers>
53
+ <shipnote>
54
+ <type>model</type>
55
+ <class>Rvtech_Starshipit_Model_Adminhtml_Observer</class>
56
+ <method>sales_convert_quote_to_order</method>
57
+ </shipnote>
58
+ </observers>
59
+ </sales_convert_quote_to_order>
60
+ </events>
61
+ <layout>
62
+ <updates>
63
+ <starshipit>
64
+ <file>shipit.xml</file>
65
+ </starshipit>
66
+ <shipnote>
67
+ <file>shipnote.xml</file>
68
+ </shipnote>
69
+ </updates>
70
+ </layout>
71
+ <translate>
72
+ <modules>
73
  <Rvtech_Starshipit>
74
+ <files>
75
+ <default>Rvtech_StarshipitNote.csv</default>
76
+ </files>
77
  </Rvtech_Starshipit>
78
+ </modules>
79
+ </translate>
80
+ </adminhtml>
81
+ <frontend>
82
+ <routers>
83
+ <ship>
84
+ <use>standard</use>
85
+ <args>
86
+ <module>Rvtech_Starshipit</module>
87
+ <frontName>ship</frontName>
88
+ </args>
89
+ </ship>
90
+ </routers>
91
+ <layout>
92
+ <updates>
93
+ <ship>
94
+ <file>ship.xml</file>
95
+ </ship>
96
+ <shipnote>
97
+ <file>shipnote.xml</file>
98
+ </shipnote>
99
+ <addressautocomplete>
100
+ <file>addressautocomplete.xml</file>
101
+ </addressautocomplete>
102
+ </updates>
103
+ </layout>
104
+ <translate>
105
+ <modules>
106
+ <Rvtech_Starshipit>
107
+ <files>
108
+ <default>Rvtech_StarshipitNote.csv</default>
109
+ </files>
110
+ </Rvtech_Starshipit>
111
+ </modules>
112
+ </translate>
113
+ </frontend>
114
+ <global>
115
+ <models>
116
+ <ship>
117
+ <class>Rvtech_Starshipit_Model</class>
118
+ <resourceModel>ship_mysql4</resourceModel>
119
+ </ship>
120
+ <shipnote>
121
+ <class>Rvtech_Starshipit_Model</class>
122
+ <resourceModel>shipnote_resource</resourceModel>
123
+ </shipnote>
124
+ <shipnote_resource>
125
+ <class>Rvtech_Starshipit_Model_Resource</class>
126
+ <entities>
127
+ <note>
128
+ <table>shipnote_note</table>
129
+ </note>
130
+ </entities>
131
+ </shipnote_resource>
132
+ <ship_mysql4>
133
+ <class>Rvtech_Starshipit_Model_Mysql4</class>
134
+ <entities>
135
+ <ship>
136
+ <table>ship</table>
137
+ </ship>
138
+ </entities>
139
+ </ship_mysql4>
140
+ </models>
141
+ <resources>
142
+ <ship_setup>
143
+ <setup>
144
+ <module>Rvtech_Starshipit</module>
145
+ </setup>
146
+ <connection>
147
+ <use>core_setup</use>
148
+ </connection>
149
+ </ship_setup>
150
+ <shipnote_setup>
151
+ <setup>
152
+ <module>Rvtech_Starshipit</module>
153
+ <class>Mage_Sales_Model_Resource_Setup</class>
154
+ </setup>
155
+ </shipnote_setup>
156
+ <ship_write>
157
+ <connection>
158
+ <use>core_write</use>
159
+ </connection>
160
+ </ship_write>
161
+ <ship_read>
162
+ <connection>
163
+ <use>core_read</use>
164
+ </connection>
165
+ </ship_read>
166
+ </resources>
167
+ <blocks>
168
+ <adminhtml>
169
+ <rewrite>
170
+ <sales_order_view>Rvtech_Starshipit_Block_Sales_Order_View</sales_order_view>
171
+ <!-- Massaction Done by Observer, check below -->
172
+ <!-- <sales_order_grid>Rvtech_Starshipit_Block_Sales_Order_Grid</sales_order_grid> -->
173
+ </rewrite>
174
+ </adminhtml>
175
+ <ship>
176
+ <class>Rvtech_Starshipit_Block</class>
177
+ </ship>
178
+ <shipnote>
179
+ <class>Rvtech_Starshipit_Block</class>
180
+ </shipnote>
181
+ </blocks>
182
+ <helpers>
183
+ <ship>
184
+ <class>Rvtech_Starshipit_Helper</class>
185
+ </ship>
186
+ <shipnote>
187
+ <class>Rvtech_Starshipit_Helper</class>
188
+ </shipnote>
189
+ <addressautocomplete>
190
+ <class>Rvtech_Starshipit_Helper</class>
191
+ </addressautocomplete>
192
+ </helpers>
193
+ <events>
194
+ <core_block_abstract_prepare_layout_before>
195
+ <observers>
196
+ <shipit_core_block_abstract_prepare_layout_before>
197
+ <class>Rvtech_Starshipit_Model_Observer</class>
198
+ <method>addMassAction</method>
199
+ </shipit_core_block_abstract_prepare_layout_before>
200
+ </observers>
201
+ </core_block_abstract_prepare_layout_before>
202
+ <sales_convert_quote_to_order>
203
+ <observers>
204
+ <shipnote>
205
+ <type>model</type>
206
+ <class>Rvtech_Starshipit_Model_Observer</class>
207
+ <method>sales_convert_quote_to_order</method>
208
+ </shipnote>
209
+ </observers>
210
+ </sales_convert_quote_to_order>
211
+ <checkout_controller_onepage_save_shipping_method>
212
+ <observers>
213
+ <shipnote>
214
+ <type>model</type>
215
+ <class>Rvtech_Starshipit_Model_Observer</class>
216
+ <method>checkout_controller_onepage_save_shipping_method</method>
217
+ </shipnote>
218
+ </observers>
219
+ </checkout_controller_onepage_save_shipping_method>
220
+ </events>
221
+ </global>
222
+ <default>
223
+ <shipit_options>
224
+ <group1>
225
+ <sync_orders>5</sync_orders>
226
+ </group1>
227
+ </shipit_options>
228
+ <shipnote_options>
229
+ <basic_settings>
230
+ <enabled>1</enabled>
231
+ <frontend_label>Shipping Instructions</frontend_label>
232
+ </basic_settings>
233
+ </shipnote_options>
234
+ <carriers>
235
+ <courierpost>
236
+ <active>0</active>
237
+ <model>ship/carrier_courierpost</model>
238
+ <title>CourierPost</title>
239
+ <name>Online Parcel</name>
240
+ <price>0.00</price>
241
+ <specificerrmsg>This shipping method is currently unavailable. If you would like to ship
242
+ using this shipping method, please contact us.</specificerrmsg>
243
+ <showmethod>1</showmethod>
244
+ </courierpost>
245
+ <auspost>
246
+ <active>0</active>
247
+ <model>ship/carrier_auspost</model>
248
+ <title>Australia Post</title>
249
+ <name>Standard</name>
250
+ <price>0.00</price>
251
+ <specificerrmsg>This shipping method is currently unavailable. If you would like to ship
252
+ using this shipping method, please contact us.</specificerrmsg>
253
+ <showmethod>1</showmethod>
254
+ </auspost>
255
+ <fastway>
256
+ <active>0</active>
257
+ <model>ship/carrier_fastway</model>
258
+ <title>Fastway</title>
259
+ <name>Fastway Parcel</name>
260
+ <price>0.00</price>
261
+ <specificerrmsg>This shipping method is currently unavailable. If you would like to ship
262
+ using this shipping method, please contact us.</specificerrmsg>
263
+ <showmethod>1</showmethod>
264
+ </fastway>
265
+ <nzpost>
266
+ <active>0</active>
267
+ <model>ship/carrier_nzpost</model>
268
+ <title>NZ Post</title>
269
+ <name>NZ Post</name>
270
+ <price>0.00</price>
271
+ <specificerrmsg>This shipping method is currently unavailable. If you would like to ship
272
+ using this shipping method, please contact us.</specificerrmsg>
273
+ <showmethod>1</showmethod>
274
+ </nzpost>
275
+ <dhlexpress>
276
+ <active>0</active>
277
+ <model>ship/carrier_dhlexpress</model>
278
+ <title>DHL Express</title>
279
+ <name>Express</name>
280
+ <price>0.00</price>
281
+ <specificerrmsg>This shipping method is currently unavailable. If you would like to ship
282
+ using this shipping method, please contact us.</specificerrmsg>
283
+ <showmethod>1</showmethod>
284
+ </dhlexpress>
285
+ </carriers>
286
+ </default>
287
+ </config>
app/code/community/Rvtech/Starshipit/etc/system.xml CHANGED
@@ -1,98 +1,477 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
-
3
  <config>
4
- <!-- <tabs>
5
- <starshipitconfig translate="label" module="starshipit">
6
- <label>Starshipit Configuration</label>
7
- <sort_order>200</sort_order>
8
- </starshipitconfig>
9
- </tabs>
10
- <sections>
11
- <starshipit_options translate="label" module="starshipit">
12
- <label>Starshipit Config Options</label>
13
- <tab>starshipitconfig</tab>
14
- <frontend_type>text</frontend_type>
15
- <sort_order>100</sort_order>
16
- <show_in_default>1</show_in_default>
17
- <show_in_website>1</show_in_website>
18
- <show_in_store>1</show_in_store>
19
- <groups>
20
- <group1 translate="label">
21
- <label>Configuration</label>
22
- <frontend_type>text</frontend_type>
23
- <sort_order>1</sort_order>
24
- <show_in_default>1</show_in_default>
25
- <show_in_website>1</show_in_website>
26
- <show_in_store>1</show_in_store>
27
- <fields>
28
- <username>
29
- <label>Username</label>
30
- <frontend_type>text</frontend_type>
31
- <comment><![CDATA[<i>UserName for the Starship</i>]]></comment>
32
- <sort_order>0</sort_order>
33
- <show_in_default>1</show_in_default>
34
- <show_in_website>1</show_in_website>
35
- <show_in_store>1</show_in_store>
36
- </username>
37
- <api_key>
38
- <label>API Key</label>
39
- <frontend_type>password</frontend_type>
40
- <comment><![CDATA[<i>APIKey for the Starship</i>]]></comment>
41
- <sort_order>1</sort_order>
42
- <show_in_default>1</show_in_default>
43
- <show_in_website>1</show_in_website>
44
- <show_in_store>1</show_in_store>
45
- </api_key>
46
- <test>
47
- <frontend_type>button</frontend_type>
48
- <frontend_model>starshipit/adminhtml_system_config_form_button</frontend_model>
49
- <comment><![CDATA[<i>Click here to test that above UserName and APIKey are valid or not</i>]]></comment>
50
- <sort_order>3</sort_order>
51
- <show_in_default>1</show_in_default>
52
- <show_in_website>1</show_in_website>
53
- <show_in_store>1</show_in_store>
54
- </test>
55
- <syncbutton>
56
- <frontend_type>button</frontend_type>
57
- <frontend_model>starshipit/adminhtml_system_config_form_syncbutton</frontend_model>
58
- <sort_order>6</sort_order>
59
- <show_in_default>1</show_in_default>
60
- <show_in_website>1</show_in_website>
61
- <show_in_store>1</show_in_store>
62
- </syncbutton>
63
- <update_orders>
64
- <label>Update orders to complete once shipped</label>
65
- <frontend_type>select</frontend_type>
66
- <source_model>adminhtml/system_config_source_yesno</source_model>
67
- <sort_order>4</sort_order>
68
- <tooltip><![CDATA[<i>If set to YES, it will automatically create shipment and and update track info received from StartShip</i>]]></tooltip>
69
- <show_in_default>1</show_in_default>
70
- <show_in_website>1</show_in_website>
71
- <show_in_store>1</show_in_store>
72
- </update_orders>
73
- <sync_orders_yesno>
74
- <label>Sync orders automatically</label>
75
- <frontend_type>select</frontend_type>
76
- <tooltip><![CDATA[<i>If set to YES, it will automatically sync order after every 'x' minute (mentioned below)</i>]]></tooltip>
77
- <source_model>adminhtml/system_config_source_yesno</source_model>
78
- <sort_order>5</sort_order>
79
- <show_in_default>1</show_in_default>
80
- <show_in_website>1</show_in_website>
81
- <show_in_store>1</show_in_store>
82
- </sync_orders_yesno>
83
- <sync_orders>
84
- <label>Time period to sync orders</label>
85
- <frontend_type>text</frontend_type>
86
- <comment><![CDATA[<i><b>Note:</b>Time Period is in Minutes</i>]]></comment>
87
- <default>5</default>
88
- <sort_order>6</sort_order>
89
- <show_in_default>1</show_in_default>
90
- <show_in_website>1</show_in_website>
91
- <show_in_store>1</show_in_store>
92
- </sync_orders>
93
- </fields>
94
- </group1>
95
- </groups>
96
- </starshipit_options>
97
- </sections> -->
98
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
 
2
  <config>
3
+ <tabs>
4
+ <shipnotes translate="label" module="shipnote">
5
+ <label>ShipIt</label>
6
+ <sort_order>99999</sort_order>
7
+ </shipnotes>
8
+ </tabs>
9
+ <sections>
10
+ <shipnote_options translate="label" module="shipnote">
11
+ <label>ShipIt Settings</label>
12
+ <tab>shipnotes</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>10</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <shipit_settings translate="label">
20
+ <label>ShipIt Details</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>10</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <shipit_api_key translate="label">
28
+ <label>Api Key</label>
29
+ <frontend_type>text</frontend_type>
30
+ <sort_order>10</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ </shipit_api_key>
35
+ </fields>
36
+ </shipit_settings>
37
+ <basic_settings translate="label">
38
+ <label>Shipping Notes</label>
39
+ <frontend_type>text</frontend_type>
40
+ <sort_order>20</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ <fields>
45
+ <enabled translate="label">
46
+ <label>Enabled</label>
47
+ <frontend_type>select</frontend_type>
48
+ <source_model>adminhtml/system_config_source_yesno</source_model>
49
+ <sort_order>10</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ </enabled>
54
+ <frontend_label translate="label">
55
+ <label>Frontend Label (Delivery Instructions)</label>
56
+ <frontend_type>text</frontend_type>
57
+ <sort_order>20</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ <comment>This will be the label shown to users during the checkout process</comment>
62
+ </frontend_label>
63
+ </fields>
64
+ </basic_settings>
65
+ </groups>
66
+ </shipnote_options>
67
+ <carriers>
68
+ <groups>
69
+ <courierpost translate="label" module="ship">
70
+ <label>ShipIt (CourierPost)</label>
71
+ <frontend_type>text</frontend_type>
72
+ <sort_order>99</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ <fields>
77
+ <active translate="label">
78
+ <label>Enabled</label>
79
+ <frontend_type>select</frontend_type>
80
+ <source_model>adminhtml/system_config_source_yesno</source_model>
81
+ <sort_order>1</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ </active>
86
+ <title translate="label">
87
+ <label>Title</label>
88
+ <frontend_type>text</frontend_type>
89
+ <sort_order>2</sort_order>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>1</show_in_store>
93
+ </title>
94
+ <name translate="label">
95
+ <label>Method Name</label>
96
+ <frontend_type>text</frontend_type>
97
+ <sort_order>2</sort_order>
98
+ <show_in_default>1</show_in_default>
99
+ <show_in_website>1</show_in_website>
100
+ <show_in_store>1</show_in_store>
101
+ </name>
102
+ <calculate translate="label">
103
+ <label>Calculate (otherwise flat rate below)</label>
104
+ <frontend_type>select</frontend_type>
105
+ <source_model>adminhtml/system_config_source_yesno</source_model>
106
+ <sort_order>3</sort_order>
107
+ <show_in_default>1</show_in_default>
108
+ <show_in_website>1</show_in_website>
109
+ <show_in_store>0</show_in_store>
110
+ </calculate>
111
+ <price translate="label">
112
+ <label>Flat Rate Price</label>
113
+ <frontend_type>text</frontend_type>
114
+ <sort_order>4</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
+ </price>
119
+ <specificerrmsg translate="label">
120
+ <label>Displayed Error Message</label>
121
+ <frontend_type>textarea</frontend_type>
122
+ <sort_order>6</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>1</show_in_store>
126
+ </specificerrmsg>
127
+ <sallowspecific translate="label">
128
+ <label>Ship to Applicable Countries</label>
129
+ <frontend_type>select</frontend_type>
130
+ <sort_order>90</sort_order>
131
+ <frontend_class>shipping-applicable-country</frontend_class>
132
+ <source_model>
133
+ adminhtml/system_config_source_shipping_allspecificcountries</source_model>
134
+ <show_in_default>1</show_in_default>
135
+ <show_in_website>1</show_in_website>
136
+ <show_in_store>0</show_in_store>
137
+ </sallowspecific>
138
+ <specificcountry translate="label">
139
+ <label>Ship to Specific Countries</label>
140
+ <frontend_type>multiselect</frontend_type>
141
+ <sort_order>91</sort_order>
142
+ <source_model>adminhtml/system_config_source_country</source_model>
143
+ <show_in_default>1</show_in_default>
144
+ <show_in_website>1</show_in_website>
145
+ <show_in_store>0</show_in_store>
146
+ <can_be_empty>1</can_be_empty>
147
+ </specificcountry>
148
+ </fields>
149
+ </courierpost>
150
+ <auspost translate="label" module="ship">
151
+ <label>ShipIt (Australia Post)</label>
152
+ <frontend_type>text</frontend_type>
153
+ <sort_order>99</sort_order>
154
+ <show_in_default>1</show_in_default>
155
+ <show_in_website>1</show_in_website>
156
+ <show_in_store>1</show_in_store>
157
+ <fields>
158
+ <active translate="label">
159
+ <label>Enabled</label>
160
+ <frontend_type>select</frontend_type>
161
+ <source_model>adminhtml/system_config_source_yesno</source_model>
162
+ <sort_order>1</sort_order>
163
+ <show_in_default>1</show_in_default>
164
+ <show_in_website>1</show_in_website>
165
+ <show_in_store>1</show_in_store>
166
+ </active>
167
+ <title translate="label">
168
+ <label>Title</label>
169
+ <frontend_type>text</frontend_type>
170
+ <sort_order>2</sort_order>
171
+ <show_in_default>1</show_in_default>
172
+ <show_in_website>1</show_in_website>
173
+ <show_in_store>1</show_in_store>
174
+ </title>
175
+ <name translate="label">
176
+ <label>Method Name</label>
177
+ <frontend_type>text</frontend_type>
178
+ <sort_order>2</sort_order>
179
+ <show_in_default>1</show_in_default>
180
+ <show_in_website>1</show_in_website>
181
+ <show_in_store>1</show_in_store>
182
+ </name>
183
+ <calculate translate="label">
184
+ <label>Calculate (otherwise flat rate below)</label>
185
+ <frontend_type>select</frontend_type>
186
+ <source_model>adminhtml/system_config_source_yesno</source_model>
187
+ <sort_order>3</sort_order>
188
+ <show_in_default>1</show_in_default>
189
+ <show_in_website>1</show_in_website>
190
+ <show_in_store>0</show_in_store>
191
+ </calculate>
192
+ <price translate="label">
193
+ <label>Flat Rate Price</label>
194
+ <frontend_type>text</frontend_type>
195
+ <sort_order>4</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
+ </price>
200
+ <specificerrmsg translate="label">
201
+ <label>Displayed Error Message</label>
202
+ <frontend_type>textarea</frontend_type>
203
+ <sort_order>6</sort_order>
204
+ <show_in_default>1</show_in_default>
205
+ <show_in_website>1</show_in_website>
206
+ <show_in_store>1</show_in_store>
207
+ </specificerrmsg>
208
+ <sallowspecific translate="label">
209
+ <label>Ship to Applicable Countries</label>
210
+ <frontend_type>select</frontend_type>
211
+ <sort_order>90</sort_order>
212
+ <frontend_class>shipping-applicable-country</frontend_class>
213
+ <source_model>
214
+ adminhtml/system_config_source_shipping_allspecificcountries</source_model>
215
+ <show_in_default>1</show_in_default>
216
+ <show_in_website>1</show_in_website>
217
+ <show_in_store>0</show_in_store>
218
+ </sallowspecific>
219
+ <specificcountry translate="label">
220
+ <label>Ship to Specific Countries</label>
221
+ <frontend_type>multiselect</frontend_type>
222
+ <sort_order>91</sort_order>
223
+ <source_model>adminhtml/system_config_source_country</source_model>
224
+ <show_in_default>1</show_in_default>
225
+ <show_in_website>1</show_in_website>
226
+ <show_in_store>0</show_in_store>
227
+ <can_be_empty>1</can_be_empty>
228
+ </specificcountry>
229
+ </fields>
230
+ </auspost>
231
+ <nzpost translate="label" module="ship">
232
+ <label>ShipIt (New Zealand Post)</label>
233
+ <frontend_type>text</frontend_type>
234
+ <sort_order>99</sort_order>
235
+ <show_in_default>1</show_in_default>
236
+ <show_in_website>1</show_in_website>
237
+ <show_in_store>1</show_in_store>
238
+ <fields>
239
+ <active translate="label">
240
+ <label>Enabled</label>
241
+ <frontend_type>select</frontend_type>
242
+ <source_model>adminhtml/system_config_source_yesno</source_model>
243
+ <sort_order>1</sort_order>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>1</show_in_website>
246
+ <show_in_store>1</show_in_store>
247
+ </active>
248
+ <title translate="label">
249
+ <label>Title</label>
250
+ <frontend_type>text</frontend_type>
251
+ <sort_order>2</sort_order>
252
+ <show_in_default>1</show_in_default>
253
+ <show_in_website>1</show_in_website>
254
+ <show_in_store>1</show_in_store>
255
+ </title>
256
+ <name translate="label">
257
+ <label>Method Name</label>
258
+ <frontend_type>text</frontend_type>
259
+ <sort_order>2</sort_order>
260
+ <show_in_default>1</show_in_default>
261
+ <show_in_website>1</show_in_website>
262
+ <show_in_store>1</show_in_store>
263
+ </name>
264
+ <calculate translate="label">
265
+ <label>Calculate (otherwise flat rate below)</label>
266
+ <frontend_type>select</frontend_type>
267
+ <source_model>adminhtml/system_config_source_yesno</source_model>
268
+ <sort_order>3</sort_order>
269
+ <show_in_default>1</show_in_default>
270
+ <show_in_website>1</show_in_website>
271
+ <show_in_store>0</show_in_store>
272
+ </calculate>
273
+ <price translate="label">
274
+ <label>Flat Rate Price</label>
275
+ <frontend_type>text</frontend_type>
276
+ <sort_order>4</sort_order>
277
+ <show_in_default>1</show_in_default>
278
+ <show_in_website>1</show_in_website>
279
+ <show_in_store>1</show_in_store>
280
+ </price>
281
+ <specificerrmsg translate="label">
282
+ <label>Displayed Error Message</label>
283
+ <frontend_type>textarea</frontend_type>
284
+ <sort_order>6</sort_order>
285
+ <show_in_default>1</show_in_default>
286
+ <show_in_website>1</show_in_website>
287
+ <show_in_store>1</show_in_store>
288
+ </specificerrmsg>
289
+ <sallowspecific translate="label">
290
+ <label>Ship to Applicable Countries</label>
291
+ <frontend_type>select</frontend_type>
292
+ <sort_order>90</sort_order>
293
+ <frontend_class>shipping-applicable-country</frontend_class>
294
+ <source_model>
295
+ adminhtml/system_config_source_shipping_allspecificcountries</source_model>
296
+ <show_in_default>1</show_in_default>
297
+ <show_in_website>1</show_in_website>
298
+ <show_in_store>0</show_in_store>
299
+ </sallowspecific>
300
+ <specificcountry translate="label">
301
+ <label>Ship to Specific Countries</label>
302
+ <frontend_type>multiselect</frontend_type>
303
+ <sort_order>91</sort_order>
304
+ <source_model>adminhtml/system_config_source_country</source_model>
305
+ <show_in_default>1</show_in_default>
306
+ <show_in_website>1</show_in_website>
307
+ <show_in_store>0</show_in_store>
308
+ <can_be_empty>1</can_be_empty>
309
+ </specificcountry>
310
+ </fields>
311
+ </nzpost>
312
+ <fastway translate="label" module="ship">
313
+ <label>ShipIt (Fastway)</label>
314
+ <frontend_type>text</frontend_type>
315
+ <sort_order>99</sort_order>
316
+ <show_in_default>1</show_in_default>
317
+ <show_in_website>1</show_in_website>
318
+ <show_in_store>1</show_in_store>
319
+ <fields>
320
+ <active translate="label">
321
+ <label>Enabled</label>
322
+ <frontend_type>select</frontend_type>
323
+ <source_model>adminhtml/system_config_source_yesno</source_model>
324
+ <sort_order>1</sort_order>
325
+ <show_in_default>1</show_in_default>
326
+ <show_in_website>1</show_in_website>
327
+ <show_in_store>1</show_in_store>
328
+ </active>
329
+ <title translate="label">
330
+ <label>Title</label>
331
+ <frontend_type>text</frontend_type>
332
+ <sort_order>2</sort_order>
333
+ <show_in_default>1</show_in_default>
334
+ <show_in_website>1</show_in_website>
335
+ <show_in_store>1</show_in_store>
336
+ </title>
337
+ <name translate="label">
338
+ <label>Method Name</label>
339
+ <frontend_type>text</frontend_type>
340
+ <sort_order>2</sort_order>
341
+ <show_in_default>1</show_in_default>
342
+ <show_in_website>1</show_in_website>
343
+ <show_in_store>1</show_in_store>
344
+ </name>
345
+ <calculate translate="label">
346
+ <label>Calculate (otherwise flat rate below)</label>
347
+ <frontend_type>select</frontend_type>
348
+ <source_model>adminhtml/system_config_source_yesno</source_model>
349
+ <sort_order>3</sort_order>
350
+ <show_in_default>1</show_in_default>
351
+ <show_in_website>1</show_in_website>
352
+ <show_in_store>0</show_in_store>
353
+ </calculate>
354
+ <price translate="label">
355
+ <label>Flat Rate Price</label>
356
+ <frontend_type>text</frontend_type>
357
+ <sort_order>4</sort_order>
358
+ <show_in_default>1</show_in_default>
359
+ <show_in_website>1</show_in_website>
360
+ <show_in_store>1</show_in_store>
361
+ </price>
362
+ <specificerrmsg translate="label">
363
+ <label>Displayed Error Message</label>
364
+ <frontend_type>textarea</frontend_type>
365
+ <sort_order>6</sort_order>
366
+ <show_in_default>1</show_in_default>
367
+ <show_in_website>1</show_in_website>
368
+ <show_in_store>1</show_in_store>
369
+ </specificerrmsg>
370
+ <sallowspecific translate="label">
371
+ <label>Ship to Applicable Countries</label>
372
+ <frontend_type>select</frontend_type>
373
+ <sort_order>90</sort_order>
374
+ <frontend_class>shipping-applicable-country</frontend_class>
375
+ <source_model>
376
+ adminhtml/system_config_source_shipping_allspecificcountries</source_model>
377
+ <show_in_default>1</show_in_default>
378
+ <show_in_website>1</show_in_website>
379
+ <show_in_store>0</show_in_store>
380
+ </sallowspecific>
381
+ <specificcountry translate="label">
382
+ <label>Ship to Specific Countries</label>
383
+ <frontend_type>multiselect</frontend_type>
384
+ <sort_order>91</sort_order>
385
+ <source_model>adminhtml/system_config_source_country</source_model>
386
+ <show_in_default>1</show_in_default>
387
+ <show_in_website>1</show_in_website>
388
+ <show_in_store>0</show_in_store>
389
+ <can_be_empty>1</can_be_empty>
390
+ </specificcountry>
391
+ </fields>
392
+ </fastway>
393
+ <dhlexpress translate="label" module="ship">
394
+ <label>ShipIt (DHL Express)</label>
395
+ <frontend_type>text</frontend_type>
396
+ <sort_order>99</sort_order>
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
+ <fields>
401
+ <active translate="label">
402
+ <label>Enabled</label>
403
+ <frontend_type>select</frontend_type>
404
+ <source_model>adminhtml/system_config_source_yesno</source_model>
405
+ <sort_order>1</sort_order>
406
+ <show_in_default>1</show_in_default>
407
+ <show_in_website>1</show_in_website>
408
+ <show_in_store>1</show_in_store>
409
+ </active>
410
+ <title translate="label">
411
+ <label>Title</label>
412
+ <frontend_type>text</frontend_type>
413
+ <sort_order>2</sort_order>
414
+ <show_in_default>1</show_in_default>
415
+ <show_in_website>1</show_in_website>
416
+ <show_in_store>1</show_in_store>
417
+ </title>
418
+ <name translate="label">
419
+ <label>Method Name</label>
420
+ <frontend_type>text</frontend_type>
421
+ <sort_order>2</sort_order>
422
+ <show_in_default>1</show_in_default>
423
+ <show_in_website>1</show_in_website>
424
+ <show_in_store>1</show_in_store>
425
+ </name>
426
+ <calculate translate="label">
427
+ <label>Calculate (otherwise flat rate below)</label>
428
+ <frontend_type>select</frontend_type>
429
+ <source_model>adminhtml/system_config_source_yesno</source_model>
430
+ <sort_order>3</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
+ </calculate>
435
+ <price translate="label">
436
+ <label>Flat Rate Price</label>
437
+ <frontend_type>text</frontend_type>
438
+ <sort_order>4</sort_order>
439
+ <show_in_default>1</show_in_default>
440
+ <show_in_website>1</show_in_website>
441
+ <show_in_store>1</show_in_store>
442
+ </price>
443
+ <specificerrmsg translate="label">
444
+ <label>Displayed Error Message</label>
445
+ <frontend_type>textarea</frontend_type>
446
+ <sort_order>6</sort_order>
447
+ <show_in_default>1</show_in_default>
448
+ <show_in_website>1</show_in_website>
449
+ <show_in_store>1</show_in_store>
450
+ </specificerrmsg>
451
+ <sallowspecific translate="label">
452
+ <label>Ship to Applicable Countries</label>
453
+ <frontend_type>select</frontend_type>
454
+ <sort_order>90</sort_order>
455
+ <frontend_class>shipping-applicable-country</frontend_class>
456
+ <source_model>
457
+ adminhtml/system_config_source_shipping_allspecificcountries</source_model>
458
+ <show_in_default>1</show_in_default>
459
+ <show_in_website>1</show_in_website>
460
+ <show_in_store>0</show_in_store>
461
+ </sallowspecific>
462
+ <specificcountry translate="label">
463
+ <label>Ship to Specific Countries</label>
464
+ <frontend_type>multiselect</frontend_type>
465
+ <sort_order>91</sort_order>
466
+ <source_model>adminhtml/system_config_source_country</source_model>
467
+ <show_in_default>1</show_in_default>
468
+ <show_in_website>1</show_in_website>
469
+ <show_in_store>0</show_in_store>
470
+ <can_be_empty>1</can_be_empty>
471
+ </specificcountry>
472
+ </fields>
473
+ </dhlexpress>
474
+ </groups>
475
+ </carriers>
476
+ </sections>
477
+ </config>
app/code/community/Rvtech/Starshipit/sql/shipnote_setup/install-1.0.0.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @var Rvtech_Starshipit_Model_Resource_Setup
5
+ */
6
+ $installer = $this;
7
+
8
+ /**
9
+ * Create table: shipnote_note
10
+ */
11
+ if (false === $installer->getConnection()->isTableExists($installer->getTable('shipnote/note'))) {
12
+ $table = $installer->getConnection()
13
+ ->newTable($installer->getTable('shipnote/note'))
14
+ ->addColumn('note_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null,
15
+ array(
16
+ 'identity' => true,
17
+ 'unsigned' => true,
18
+ 'nullable' => false,
19
+ 'primary' => true
20
+ ),'Note Id')
21
+ ->addColumn('signature_required', Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
22
+ array(
23
+ 'unsigned' => true,
24
+ 'nullable' => false,
25
+ 'default' => '0',
26
+ ), 'Signature Required')
27
+ ->addColumn('authority_to_leave', Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
28
+ array(
29
+ 'unsigned' => true,
30
+ 'nullable' => false,
31
+ 'default' => '0',
32
+ ), 'Authority to Leave')
33
+ ->addColumn('delivery_instructions', Varien_Db_Ddl_Table::TYPE_TEXT, 1024, array(), 'Delivery Instructions');
34
+ $installer->getConnection()->createTable($table);
35
+ }
36
+
37
+ $installer->addAttribute('quote', 'ship_note', array('type' => 'text'));
38
+ $installer->addAttribute('order', 'ship_note_id', array('type' => 'int'));
app/code/community/Starshipit/Ship/Block/Ship.php DELETED
@@ -1,5 +0,0 @@
1
- <?php
2
- class Starshipit_Ship_Block_Ship extends Mage_Core_Block_Template
3
- {
4
-
5
- }
 
 
 
 
 
app/code/community/Starshipit/Ship/Helper/Data.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
-
3
- class Starshipit_Ship_Helper_Data extends Mage_Core_Helper_Abstract
4
- {
5
-
6
- }
 
 
 
 
 
 
app/code/community/Starshipit/Ship/Model/Carrier/Button.php DELETED
@@ -1,51 +0,0 @@
1
- <?php
2
- class Rvtech_Starshipit_Block_Adminhtml_System_Config_Form_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
3
- {
4
- /*
5
- * Set template
6
- */
7
- protected function _construct()
8
- {
9
- parent::_construct();
10
- $this->setTemplate('starshipit/system/config/button.phtml');
11
- }
12
-
13
- /**
14
- * Return element html
15
- *
16
- * @param Varien_Data_Form_Element_Abstract $element
17
- * @return string
18
- */
19
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
20
- {
21
- return $this->_toHtml();
22
- }
23
-
24
- /**
25
- * Return ajax url for button
26
- *
27
- * @return string
28
- */
29
- public function getAjaxCheckUrl()
30
- {
31
- return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_starshipit/test');
32
- }
33
-
34
- /**
35
- * Generate button html
36
- *
37
- * @return string
38
- */
39
- public function getButtonHtml()
40
- {
41
- $button = $this->getLayout()->createBlock('adminhtml/widget_button')
42
- ->setData(array(
43
- 'id' => 'starshipit_test_button',
44
- 'label' => $this->helper('adminhtml')->__('Test'),
45
- 'onclick' => 'javascript:test(); return false;'
46
- ));
47
-
48
- return $button->toHtml();
49
- }
50
-
51
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Starshipit/Ship/Model/Carrier/Grid.php DELETED
@@ -1,226 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category Mage
22
- * @package Mage_Adminhtml
23
- * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
- /**
28
- * Adminhtml sales orders grid
29
- *
30
- * @category Mage
31
- * @package Mage_Adminhtml
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Rvtech_Starshipit_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
35
- {
36
-
37
- public function __construct()
38
- {
39
- parent::__construct();
40
- $this->setId('sales_order_grid');
41
- $this->setUseAjax(true);
42
- $this->setDefaultSort('created_at');
43
- $this->setDefaultDir('DESC');
44
- $this->setSaveParametersInSession(true);
45
- }
46
-
47
- /**
48
- * Retrieve collection class
49
- *
50
- * @return string
51
- */
52
- protected function _getCollectionClass()
53
- {
54
- return 'sales/order_grid_collection';
55
- }
56
-
57
- protected function _prepareCollection()
58
- {
59
- $collection = Mage::getResourceModel($this->_getCollectionClass());
60
- $this->setCollection($collection);
61
- return parent::_prepareCollection();
62
- }
63
-
64
- protected function _prepareColumns()
65
- {
66
-
67
- $this->addColumn('real_order_id', array(
68
- 'header'=> Mage::helper('sales')->__('Order #'),
69
- 'width' => '80px',
70
- 'type' => 'text',
71
- 'index' => 'increment_id',
72
- ));
73
-
74
- if (!Mage::app()->isSingleStoreMode()) {
75
- $this->addColumn('store_id', array(
76
- 'header' => Mage::helper('sales')->__('Purchased From (Store)'),
77
- 'index' => 'store_id',
78
- 'type' => 'store',
79
- 'store_view'=> true,
80
- 'display_deleted' => true,
81
- ));
82
- }
83
-
84
- $this->addColumn('created_at', array(
85
- 'header' => Mage::helper('sales')->__('Purchased On'),
86
- 'index' => 'created_at',
87
- 'type' => 'datetime',
88
- 'width' => '100px',
89
- ));
90
-
91
- $this->addColumn('billing_name', array(
92
- 'header' => Mage::helper('sales')->__('Bill to Name'),
93
- 'index' => 'billing_name',
94
- ));
95
-
96
- $this->addColumn('shipping_name', array(
97
- 'header' => Mage::helper('sales')->__('Ship to Name'),
98
- 'index' => 'shipping_name',
99
- ));
100
-
101
- $this->addColumn('base_grand_total', array(
102
- 'header' => Mage::helper('sales')->__('G.T. (Base)'),
103
- 'index' => 'base_grand_total',
104
- 'type' => 'currency',
105
- 'currency' => 'base_currency_code',
106
- ));
107
-
108
- $this->addColumn('grand_total', array(
109
- 'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
110
- 'index' => 'grand_total',
111
- 'type' => 'currency',
112
- 'currency' => 'order_currency_code',
113
- ));
114
-
115
- $this->addColumn('status', array(
116
- 'header' => Mage::helper('sales')->__('Status'),
117
- 'index' => 'status',
118
- 'type' => 'options',
119
- 'width' => '70px',
120
- 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
121
- ));
122
-
123
- if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
124
- $this->addColumn('action',
125
- array(
126
- 'header' => Mage::helper('sales')->__('Action'),
127
- 'width' => '50px',
128
- 'type' => 'action',
129
- 'getter' => 'getId',
130
- 'actions' => array(
131
- array(
132
- 'caption' => Mage::helper('sales')->__('View'),
133
- 'url' => array('base'=>'*/sales_order/view'),
134
- 'field' => 'order_id'
135
- )
136
- ),
137
- 'filter' => false,
138
- 'sortable' => false,
139
- 'index' => 'stores',
140
- 'is_system' => true,
141
- ));
142
- }
143
- $this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
144
-
145
- $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
146
- $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
147
-
148
- return parent::_prepareColumns();
149
- }
150
-
151
- protected function _prepareMassaction()
152
- {
153
- $this->setMassactionIdField('entity_id');
154
- $this->getMassactionBlock()->setFormFieldName('order_ids');
155
- $this->getMassactionBlock()->setUseSelectAll(false);
156
-
157
- if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
158
- $this->getMassactionBlock()->addItem('cancel_order', array(
159
- 'label'=> Mage::helper('sales')->__('Cancel'),
160
- 'url' => $this->getUrl('*/sales_order/massCancel'),
161
- ));
162
- }
163
-
164
- if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
165
- $this->getMassactionBlock()->addItem('hold_order', array(
166
- 'label'=> Mage::helper('sales')->__('Hold'),
167
- 'url' => $this->getUrl('*/sales_order/massHold'),
168
- ));
169
- }
170
-
171
- if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
172
- $this->getMassactionBlock()->addItem('unhold_order', array(
173
- 'label'=> Mage::helper('sales')->__('Unhold'),
174
- 'url' => $this->getUrl('*/sales_order/massUnhold'),
175
- ));
176
- }
177
-
178
- $this->getMassactionBlock()->addItem('pdfinvoices_order', array(
179
- 'label'=> Mage::helper('sales')->__('Print Invoices'),
180
- 'url' => $this->getUrl('*/sales_order/pdfinvoices'),
181
- ));
182
-
183
- $this->getMassactionBlock()->addItem('pdfshipments_order', array(
184
- 'label'=> Mage::helper('sales')->__('Print Packingslips'),
185
- 'url' => $this->getUrl('*/sales_order/pdfshipments'),
186
- ));
187
-
188
- $this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
189
- 'label'=> Mage::helper('sales')->__('Print Credit Memos'),
190
- 'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
191
- ));
192
-
193
- $this->getMassactionBlock()->addItem('pdfdocs_order', array(
194
- 'label'=> Mage::helper('sales')->__('Print All'),
195
- 'url' => $this->getUrl('*/sales_order/pdfdocs'),
196
- ));
197
-
198
- $this->getMassactionBlock()->addItem('print_shipping_label', array(
199
- 'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
200
- 'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
201
- ));
202
-
203
- $this->getMassactionBlock()->addItem('starshipIt_multi', array(
204
- 'label'=> Mage::helper('sales')->__('StarShipIt'),
205
- 'url' => $this->getUrl('http://www.google.com'),
206
- 'confirm' => Mage::helper('sales')->__('You Sure !!'),
207
- 'startshipiturl' => true,
208
- ));
209
-
210
- return $this;
211
- }
212
-
213
- public function getRowUrl($row)
214
- {
215
- if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
216
- return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
217
- }
218
- return false;
219
- }
220
-
221
- public function getGridUrl()
222
- {
223
- return $this->getUrl('*/*/grid', array('_current'=>true));
224
- }
225
-
226
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Starshipit/Ship/Model/Carrier/View.php DELETED
@@ -1,347 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category Mage
22
- * @package Mage_Adminhtml
23
- * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
- /**
28
- * Adminhtml sales order view
29
- *
30
- * @category Mage
31
- * @package Mage_Adminhtml
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Rvtech_Starshipit_Block_Sales_Order_View extends Mage_Adminhtml_Block_Widget_Form_Container
35
- {
36
-
37
- const STARSHIP_BASE = 'https://go.starshipit.com/templates/admin4/ship.aspx';
38
-
39
- public function __construct()
40
- {
41
- $this->_objectId = 'order_id';
42
- $this->_controller = 'sales_order';
43
- $this->_mode = 'view';
44
-
45
- parent::__construct();
46
-
47
- $this->_removeButton('delete');
48
- $this->_removeButton('reset');
49
- $this->_removeButton('save');
50
- $this->setId('sales_order_view');
51
- $order = $this->getOrder();
52
-
53
- if ($this->_isAllowedAction('edit') && $order->canEdit()) {
54
- $onclickJs = 'deleteConfirm(\''
55
- . Mage::helper('sales')->__('Are you sure? This order will be canceled and a new one will be created instead')
56
- . '\', \'' . $this->getEditUrl() . '\');';
57
- $this->_addButton('order_edit', array(
58
- 'label' => Mage::helper('sales')->__('Edit'),
59
- 'onclick' => $onclickJs,
60
- ));
61
- // see if order has non-editable products as items
62
- $nonEditableTypes = array_keys($this->getOrder()->getResource()->aggregateProductsByTypes(
63
- $order->getId(),
64
- array_keys(Mage::getConfig()
65
- ->getNode('adminhtml/sales/order/create/available_product_types')
66
- ->asArray()
67
- ),
68
- false
69
- ));
70
- if ($nonEditableTypes) {
71
- $this->_updateButton('order_edit', 'onclick',
72
- 'if (!confirm(\'' .
73
- Mage::helper('sales')->__('This order contains (%s) items and therefore cannot be edited through the admin interface at this time, if you wish to continue editing the (%s) items will be removed, the order will be canceled and a new order will be placed.', implode(', ', $nonEditableTypes), implode(', ', $nonEditableTypes)) . '\')) return false;' . $onclickJs
74
- );
75
- }
76
- }
77
-
78
- if ($this->_isAllowedAction('cancel') && $order->canCancel()) {
79
- $message = Mage::helper('sales')->__('Are you sure you want to cancel this order?');
80
- $this->_addButton('order_cancel', array(
81
- 'label' => Mage::helper('sales')->__('Cancel'),
82
- 'onclick' => 'deleteConfirm(\''.$message.'\', \'' . $this->getCancelUrl() . '\')',
83
- ));
84
- }
85
-
86
- if ($this->_isAllowedAction('emails') && !$order->isCanceled()) {
87
- $message = Mage::helper('sales')->__('Are you sure you want to send order email to customer?');
88
- $this->addButton('send_notification', array(
89
- 'label' => Mage::helper('sales')->__('Send Email'),
90
- 'onclick' => "confirmSetLocation('{$message}', '{$this->getEmailUrl()}')",
91
- ));
92
- }
93
-
94
- if ($this->_isAllowedAction('creditmemo') && $order->canCreditmemo()) {
95
- $message = Mage::helper('sales')->__('This will create an offline refund. To create an online refund, open an invoice and create credit memo for it. Do you wish to proceed?');
96
- $onClick = "setLocation('{$this->getCreditmemoUrl()}')";
97
- if ($order->getPayment()->getMethodInstance()->isGateway()) {
98
- $onClick = "confirmSetLocation('{$message}', '{$this->getCreditmemoUrl()}')";
99
- }
100
- $this->_addButton('order_creditmemo', array(
101
- 'label' => Mage::helper('sales')->__('Credit Memo'),
102
- 'onclick' => $onClick,
103
- 'class' => 'go'
104
- ));
105
- }
106
-
107
- // invoice action intentionally
108
- if ($this->_isAllowedAction('invoice') && $order->canVoidPayment()) {
109
- $message = Mage::helper('sales')->__('Are you sure you want to void the payment?');
110
- $this->addButton('void_payment', array(
111
- 'label' => Mage::helper('sales')->__('Void'),
112
- 'onclick' => "confirmSetLocation('{$message}', '{$this->getVoidPaymentUrl()}')",
113
- ));
114
- }
115
-
116
- if ($this->_isAllowedAction('hold') && $order->canHold()) {
117
- $this->_addButton('order_hold', array(
118
- 'label' => Mage::helper('sales')->__('Hold'),
119
- 'onclick' => 'setLocation(\'' . $this->getHoldUrl() . '\')',
120
- ));
121
- }
122
-
123
- if ($this->_isAllowedAction('unhold') && $order->canUnhold()) {
124
- $this->_addButton('order_unhold', array(
125
- 'label' => Mage::helper('sales')->__('Unhold'),
126
- 'onclick' => 'setLocation(\'' . $this->getUnholdUrl() . '\')',
127
- ));
128
- }
129
-
130
- if ($this->_isAllowedAction('review_payment')) {
131
- if ($order->canReviewPayment()) {
132
- $message = Mage::helper('sales')->__('Are you sure you want to accept this payment?');
133
- $this->_addButton('accept_payment', array(
134
- 'label' => Mage::helper('sales')->__('Accept Payment'),
135
- 'onclick' => "confirmSetLocation('{$message}', '{$this->getReviewPaymentUrl('accept')}')",
136
- ));
137
- $message = Mage::helper('sales')->__('Are you sure you want to deny this payment?');
138
- $this->_addButton('deny_payment', array(
139
- 'label' => Mage::helper('sales')->__('Deny Payment'),
140
- 'onclick' => "confirmSetLocation('{$message}', '{$this->getReviewPaymentUrl('deny')}')",
141
- ));
142
- }
143
- if ($order->canFetchPaymentReviewUpdate()) {
144
- $this->_addButton('get_review_payment_update', array(
145
- 'label' => Mage::helper('sales')->__('Get Payment Update'),
146
- 'onclick' => 'setLocation(\'' . $this->getReviewPaymentUrl('update') . '\')',
147
- ));
148
- }
149
- }
150
-
151
- if ($this->_isAllowedAction('invoice') && $order->canInvoice()) {
152
- $_label = $order->getForcedDoShipmentWithInvoice() ?
153
- Mage::helper('sales')->__('Invoice and Ship') :
154
- Mage::helper('sales')->__('Invoice');
155
- $this->_addButton('order_invoice', array(
156
- 'label' => $_label,
157
- 'onclick' => 'setLocation(\'' . $this->getInvoiceUrl() . '\')',
158
- 'class' => 'go'
159
- ));
160
- }
161
-
162
- if ($this->_isAllowedAction('ship') && $order->canShip()
163
- && !$order->getForcedDoShipmentWithInvoice()) {
164
- $this->_addButton('order_ship', array(
165
- 'label' => Mage::helper('sales')->__('Ship'),
166
- 'onclick' => 'setLocation(\'' . $this->getShipUrl() . '\')',
167
- 'class' => 'go'
168
- ));
169
- }
170
-
171
- if ($this->_isAllowedAction('reorder')
172
- && $this->helper('sales/reorder')->isAllowed($order->getStore())
173
- && $order->canReorderIgnoreSalable()
174
- ) {
175
- $this->_addButton('order_reorder', array(
176
- 'label' => Mage::helper('sales')->__('Reorder'),
177
- 'onclick' => 'setLocation(\'' . $this->getReorderUrl() . '\')',
178
- 'class' => 'go'
179
- ));
180
- }
181
-
182
- // Starship Button
183
- $this->_addButton('order_starship', array(
184
- 'label' => Mage::helper('sales')->__('StarShipIt'),
185
- 'onclick' => 'popWin('http://www.mysite.com.au/delpopup.php', 'deliveryinfo', 'width=300,height=300,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;',
186
- 'class' => 'go'
187
- ));
188
- }
189
-
190
- public function getStarshipUrl()
191
- {
192
- $cur_url = Mage::helper('core/url')->getCurrentUrl();
193
- $starshipUrl = Mage::helper('core/url')->addRequestParam(
194
- self::STARSHIP_BASE,
195
- array(
196
- 'ReturnURL' => $cur_url,
197
- 'Order' => $this->getOrder()->getData('increment_id'),
198
- 'source' => 'magento'
199
- )
200
- );
201
-
202
- return $starshipUrl;
203
- }
204
- /**
205
- * Retrieve order model object
206
- *
207
- * @return Mage_Sales_Model_Order
208
- */
209
- public function getOrder()
210
- {
211
- return Mage::registry('sales_order');
212
- }
213
-
214
- /**
215
- * Retrieve Order Identifier
216
- *
217
- * @return int
218
- */
219
- public function getOrderId()
220
- {
221
- return $this->getOrder()->getId();
222
- }
223
-
224
- public function getHeaderText()
225
- {
226
- if ($_extOrderId = $this->getOrder()->getExtOrderId()) {
227
- $_extOrderId = '[' . $_extOrderId . '] ';
228
- } else {
229
- $_extOrderId = '';
230
- }
231
- return Mage::helper('sales')->__('Order # %s %s | %s', $this->getOrder()->getRealOrderId(), $_extOrderId, $this->formatDate($this->getOrder()->getCreatedAtDate(), 'medium', true));
232
- }
233
-
234
- public function getUrl($params='', $params2=array())
235
- {
236
- $params2['order_id'] = $this->getOrderId();
237
- return parent::getUrl($params, $params2);
238
- }
239
-
240
- public function getEditUrl()
241
- {
242
- return $this->getUrl('*/sales_order_edit/start');
243
- }
244
-
245
- public function getEmailUrl()
246
- {
247
- return $this->getUrl('*/*/email');
248
- }
249
-
250
- public function getCancelUrl()
251
- {
252
- return $this->getUrl('*/*/cancel');
253
- }
254
-
255
- public function getInvoiceUrl()
256
- {
257
- return $this->getUrl('*/sales_order_invoice/start');
258
- }
259
-
260
- public function getCreditmemoUrl()
261
- {
262
- return $this->getUrl('*/sales_order_creditmemo/start');
263
- }
264
-
265
- public function getHoldUrl()
266
- {
267
- return $this->getUrl('*/*/hold');
268
- }
269
-
270
- public function getUnholdUrl()
271
- {
272
- return $this->getUrl('*/*/unhold');
273
- }
274
-
275
- public function getShipUrl()
276
- {
277
- return $this->getUrl('*/sales_order_shipment/start');
278
- }
279
-
280
- public function getCommentUrl()
281
- {
282
- return $this->getUrl('*/*/comment');
283
- }
284
-
285
- public function getReorderUrl()
286
- {
287
- return $this->getUrl('*/sales_order_create/reorder');
288
- }
289
-
290
- /**
291
- * Payment void URL getter
292
- */
293
- public function getVoidPaymentUrl()
294
- {
295
- return $this->getUrl('*/*/voidPayment');
296
- }
297
-
298
- protected function _isAllowedAction($action)
299
- {
300
- return Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/' . $action);
301
- }
302
-
303
- /**
304
- * Return back url for view grid
305
- *
306
- * @return string
307
- */
308
- public function getBackUrl()
309
- {
310
- if ($this->getOrder()->getBackUrl()) {
311
- return $this->getOrder()->getBackUrl();
312
- }
313
-
314
- return $this->getUrl('*/*/');
315
- }
316
-
317
- public function getReviewPaymentUrl($action)
318
- {
319
- return $this->getUrl('*/*/reviewPayment', array('action' => $action));
320
- }
321
- //
322
- // /**
323
- // * Return URL for accept payment action
324
- // *
325
- // * @return string
326
- // */
327
- // public function getAcceptPaymentUrl()
328
- // {
329
- // return $this->getUrl('*/*/reviewPayment', array('action' => 'accept'));
330
- // }
331
- //
332
- // /**
333
- // * Return URL for deny payment action
334
- // *
335
- // * @return string
336
- // */
337
- // public function getDenyPaymentUrl()
338
- // {
339
- // return $this->getUrl('*/*/reviewPayment', array('action' => 'deny'));
340
- // }
341
- //
342
- // public function getPaymentReviewUpdateUrl()
343
- // {
344
- // return $this->getUrl('*/*/reviewPaymentUpdate');
345
- // }
346
-
347
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Starshipit/Ship/controllers/IndexController.php DELETED
@@ -1,5 +0,0 @@
1
- <?php
2
- class Starshipit_Ship_IndexController extends Mage_Core_Controller_Front_Action
3
- {
4
-
5
- }
 
 
 
 
 
app/code/community/Starshipit/Ship/etc/config.xml DELETED
@@ -1,116 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Starshipit_Ship>
5
- <version>0.1.0</version>
6
- </Starshipit_Ship>
7
- </modules>
8
- <frontend>
9
- <routers>
10
- <ship>
11
- <use>standard</use>
12
- <args>
13
- <module>StarShipIt_Ship</module>
14
- <frontName>ship</frontName>
15
- </args>
16
- </ship>
17
- </routers>
18
- <layout>
19
- <updates>
20
- <ship>
21
- <file>ship.xml</file>
22
- </ship>
23
- </updates>
24
- </layout>
25
- </frontend>
26
- <global>
27
- <models>
28
- <ship>
29
- <class>Starshipit_Ship_Model</class>
30
- <resourceModel>ship_mysql4</resourceModel>
31
- </ship>
32
- <ship_mysql4>
33
- <class>Starshipit_Ship_Model_Mysql4</class>
34
- <entities>
35
- <ship>
36
- <table>ship</table>
37
- </ship>
38
- </entities>
39
- </ship_mysql4>
40
- </models>
41
- <resources>
42
- <ship_setup>
43
- <setup>
44
- <module>Starshipit_Ship</module>
45
- </setup>
46
- <connection>
47
- <use>core_setup</use>
48
- </connection>
49
- </ship_setup>
50
- <ship_write>
51
- <connection>
52
- <use>core_write</use>
53
- </connection>
54
- </ship_write>
55
- <ship_read>
56
- <connection>
57
- <use>core_read</use>
58
- </connection>
59
- </ship_read>
60
- </resources>
61
- <blocks>
62
- <ship>
63
- <class>Starshipit_Ship_Block</class>
64
- </ship>
65
- </blocks>
66
- <helpers>
67
- <ship>
68
- <class>Starshipit_Ship_Helper</class>
69
- </ship>
70
- </helpers>
71
- </global>
72
- <default>
73
- <carriers>
74
- <courierpost>
75
- <active>0</active>
76
- <model>ship/carrier_courierpost</model>
77
- <title>CourierPost</title>
78
- <name>Online Parcel</name>
79
- <price>0.00</price>
80
- <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
81
- </courierpost>
82
- <auspost>
83
- <active>0</active>
84
- <model>ship/carrier_auspost</model>
85
- <title>Australia Post</title>
86
- <name>Standard</name>
87
- <price>0.00</price>
88
- <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
89
- </auspost>
90
- <fastway>
91
- <active>0</active>
92
- <model>ship/carrier_fastway</model>
93
- <title>Fastway</title>
94
- <name>Fastway Parcel</name>
95
- <price>0.00</price>
96
- <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
97
- </fastway>
98
- <nzpost>
99
- <active>0</active>
100
- <model>ship/carrier_nzpost</model>
101
- <title>NZ Post</title>
102
- <name>NZ Post</name>
103
- <price>0.00</price>
104
- <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
105
- </nzpost>
106
- <dhlexpress>
107
- <active>0</active>
108
- <model>ship/carrier_dhlexpress</model>
109
- <title>DHL Express</title>
110
- <name>Express</name>
111
- <price>0.00</price>
112
- <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
113
- </dhlexpress>
114
- </carriers>
115
- </default>
116
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Starshipit/Ship/etc/system.xml DELETED
@@ -1,449 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
- <sections>
4
- <carriers>
5
- <groups>
6
- <courierpost translate="label" module="ship">
7
- <label>CourierPost</label>
8
- <frontend_type>text</frontend_type>
9
- <sort_order>99</sort_order>
10
- <show_in_default>1</show_in_default>
11
- <show_in_website>1</show_in_website>
12
- <show_in_store>1</show_in_store>
13
- <fields>
14
- <active translate="label">
15
- <label>Enabled</label>
16
- <frontend_type>select</frontend_type>
17
- <source_model>adminhtml/system_config_source_yesno</source_model>
18
- <sort_order>1</sort_order>
19
- <show_in_default>1</show_in_default>
20
- <show_in_website>1</show_in_website>
21
- <show_in_store>1</show_in_store>
22
- </active>
23
- <title translate="label">
24
- <label>Title</label>
25
- <frontend_type>text</frontend_type>
26
- <sort_order>2</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
- </title>
31
- <name translate="label">
32
- <label>Method Name</label>
33
- <frontend_type>text</frontend_type>
34
- <sort_order>2</sort_order>
35
- <show_in_default>1</show_in_default>
36
- <show_in_website>1</show_in_website>
37
- <show_in_store>1</show_in_store>
38
- </name>
39
- <calculate translate="label">
40
- <label>Calculate (otherwise flat rate below)</label>
41
- <frontend_type>select</frontend_type>
42
- <source_model>adminhtml/system_config_source_yesno</source_model>
43
- <sort_order>3</sort_order>
44
- <show_in_default>1</show_in_default>
45
- <show_in_website>1</show_in_website>
46
- <show_in_store>0</show_in_store>
47
- </calculate>
48
- <price translate="label">
49
- <label>Flat Rate Price</label>
50
- <frontend_type>text</frontend_type>
51
- <sort_order>4</sort_order>
52
- <show_in_default>1</show_in_default>
53
- <show_in_website>1</show_in_website>
54
- <show_in_store>1</show_in_store>
55
- </price>
56
- <apiKey translate="label">
57
- <label>Api Key</label>
58
- <frontend_type>text</frontend_type>
59
- <sort_order>5</sort_order>
60
- <show_in_default>1</show_in_default>
61
- <show_in_website>1</show_in_website>
62
- <show_in_store>1</show_in_store>
63
- </apiKey>
64
- <specificerrmsg translate="label">
65
- <label>Displayed Error Message</label>
66
- <frontend_type>textarea</frontend_type>
67
- <sort_order>6</sort_order>
68
- <show_in_default>1</show_in_default>
69
- <show_in_website>1</show_in_website>
70
- <show_in_store>1</show_in_store>
71
- </specificerrmsg>
72
- <sallowspecific translate="label">
73
- <label>Ship to Applicable Countries</label>
74
- <frontend_type>select</frontend_type>
75
- <sort_order>90</sort_order>
76
- <frontend_class>shipping-applicable-country</frontend_class>
77
- <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
78
- <show_in_default>1</show_in_default>
79
- <show_in_website>1</show_in_website>
80
- <show_in_store>0</show_in_store>
81
- </sallowspecific>
82
- <specificcountry translate="label">
83
- <label>Ship to Specific Countries</label>
84
- <frontend_type>multiselect</frontend_type>
85
- <sort_order>91</sort_order>
86
- <source_model>adminhtml/system_config_source_country</source_model>
87
- <show_in_default>1</show_in_default>
88
- <show_in_website>1</show_in_website>
89
- <show_in_store>0</show_in_store>
90
- <can_be_empty>1</can_be_empty>
91
- </specificcountry>
92
- </fields>
93
- </courierpost>
94
- <auspost translate="label" module="ship">
95
- <label>Australia Post</label>
96
- <frontend_type>text</frontend_type>
97
- <sort_order>99</sort_order>
98
- <show_in_default>1</show_in_default>
99
- <show_in_website>1</show_in_website>
100
- <show_in_store>1</show_in_store>
101
- <fields>
102
- <active translate="label">
103
- <label>Enabled</label>
104
- <frontend_type>select</frontend_type>
105
- <source_model>adminhtml/system_config_source_yesno</source_model>
106
- <sort_order>1</sort_order>
107
- <show_in_default>1</show_in_default>
108
- <show_in_website>1</show_in_website>
109
- <show_in_store>1</show_in_store>
110
- </active>
111
- <title translate="label">
112
- <label>Title</label>
113
- <frontend_type>text</frontend_type>
114
- <sort_order>2</sort_order>
115
- <show_in_default>1</show_in_default>
116
- <show_in_website>1</show_in_website>
117
- <show_in_store>1</show_in_store>
118
- </title>
119
- <name translate="label">
120
- <label>Method Name</label>
121
- <frontend_type>text</frontend_type>
122
- <sort_order>2</sort_order>
123
- <show_in_default>1</show_in_default>
124
- <show_in_website>1</show_in_website>
125
- <show_in_store>1</show_in_store>
126
- </name>
127
- <calculate translate="label">
128
- <label>Calculate (otherwise flat rate below)</label>
129
- <frontend_type>select</frontend_type>
130
- <source_model>adminhtml/system_config_source_yesno</source_model>
131
- <sort_order>3</sort_order>
132
- <show_in_default>1</show_in_default>
133
- <show_in_website>1</show_in_website>
134
- <show_in_store>0</show_in_store>
135
- </calculate>
136
- <price translate="label">
137
- <label>Flat Rate Price</label>
138
- <frontend_type>text</frontend_type>
139
- <sort_order>4</sort_order>
140
- <show_in_default>1</show_in_default>
141
- <show_in_website>1</show_in_website>
142
- <show_in_store>1</show_in_store>
143
- </price>
144
- <apiKey translate="label">
145
- <label>Api Key</label>
146
- <frontend_type>text</frontend_type>
147
- <sort_order>5</sort_order>
148
- <show_in_default>1</show_in_default>
149
- <show_in_website>1</show_in_website>
150
- <show_in_store>1</show_in_store>
151
- </apiKey>
152
- <specificerrmsg translate="label">
153
- <label>Displayed Error Message</label>
154
- <frontend_type>textarea</frontend_type>
155
- <sort_order>6</sort_order>
156
- <show_in_default>1</show_in_default>
157
- <show_in_website>1</show_in_website>
158
- <show_in_store>1</show_in_store>
159
- </specificerrmsg>
160
- <sallowspecific translate="label">
161
- <label>Ship to Applicable Countries</label>
162
- <frontend_type>select</frontend_type>
163
- <sort_order>90</sort_order>
164
- <frontend_class>shipping-applicable-country</frontend_class>
165
- <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
166
- <show_in_default>1</show_in_default>
167
- <show_in_website>1</show_in_website>
168
- <show_in_store>0</show_in_store>
169
- </sallowspecific>
170
- <specificcountry translate="label">
171
- <label>Ship to Specific Countries</label>
172
- <frontend_type>multiselect</frontend_type>
173
- <sort_order>91</sort_order>
174
- <source_model>adminhtml/system_config_source_country</source_model>
175
- <show_in_default>1</show_in_default>
176
- <show_in_website>1</show_in_website>
177
- <show_in_store>0</show_in_store>
178
- <can_be_empty>1</can_be_empty>
179
- </specificcountry>
180
- </fields>
181
- </auspost>
182
- <nzpost translate="label" module="ship">
183
- <label>New Zealand Post</label>
184
- <frontend_type>text</frontend_type>
185
- <sort_order>99</sort_order>
186
- <show_in_default>1</show_in_default>
187
- <show_in_website>1</show_in_website>
188
- <show_in_store>1</show_in_store>
189
- <fields>
190
- <active translate="label">
191
- <label>Enabled</label>
192
- <frontend_type>select</frontend_type>
193
- <source_model>adminhtml/system_config_source_yesno</source_model>
194
- <sort_order>1</sort_order>
195
- <show_in_default>1</show_in_default>
196
- <show_in_website>1</show_in_website>
197
- <show_in_store>1</show_in_store>
198
- </active>
199
- <title translate="label">
200
- <label>Title</label>
201
- <frontend_type>text</frontend_type>
202
- <sort_order>2</sort_order>
203
- <show_in_default>1</show_in_default>
204
- <show_in_website>1</show_in_website>
205
- <show_in_store>1</show_in_store>
206
- </title>
207
- <name translate="label">
208
- <label>Method Name</label>
209
- <frontend_type>text</frontend_type>
210
- <sort_order>2</sort_order>
211
- <show_in_default>1</show_in_default>
212
- <show_in_website>1</show_in_website>
213
- <show_in_store>1</show_in_store>
214
- </name>
215
- <calculate translate="label">
216
- <label>Calculate (otherwise flat rate below)</label>
217
- <frontend_type>select</frontend_type>
218
- <source_model>adminhtml/system_config_source_yesno</source_model>
219
- <sort_order>3</sort_order>
220
- <show_in_default>1</show_in_default>
221
- <show_in_website>1</show_in_website>
222
- <show_in_store>0</show_in_store>
223
- </calculate>
224
- <price translate="label">
225
- <label>Flat Rate Price</label>
226
- <frontend_type>text</frontend_type>
227
- <sort_order>4</sort_order>
228
- <show_in_default>1</show_in_default>
229
- <show_in_website>1</show_in_website>
230
- <show_in_store>1</show_in_store>
231
- </price>
232
- <apiKey translate="label">
233
- <label>Api Key</label>
234
- <frontend_type>text</frontend_type>
235
- <sort_order>5</sort_order>
236
- <show_in_default>1</show_in_default>
237
- <show_in_website>1</show_in_website>
238
- <show_in_store>1</show_in_store>
239
- </apiKey>
240
- <specificerrmsg translate="label">
241
- <label>Displayed Error Message</label>
242
- <frontend_type>textarea</frontend_type>
243
- <sort_order>6</sort_order>
244
- <show_in_default>1</show_in_default>
245
- <show_in_website>1</show_in_website>
246
- <show_in_store>1</show_in_store>
247
- </specificerrmsg>
248
- <sallowspecific translate="label">
249
- <label>Ship to Applicable Countries</label>
250
- <frontend_type>select</frontend_type>
251
- <sort_order>90</sort_order>
252
- <frontend_class>shipping-applicable-country</frontend_class>
253
- <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
254
- <show_in_default>1</show_in_default>
255
- <show_in_website>1</show_in_website>
256
- <show_in_store>0</show_in_store>
257
- </sallowspecific>
258
- <specificcountry translate="label">
259
- <label>Ship to Specific Countries</label>
260
- <frontend_type>multiselect</frontend_type>
261
- <sort_order>91</sort_order>
262
- <source_model>adminhtml/system_config_source_country</source_model>
263
- <show_in_default>1</show_in_default>
264
- <show_in_website>1</show_in_website>
265
- <show_in_store>0</show_in_store>
266
- <can_be_empty>1</can_be_empty>
267
- </specificcountry>
268
- </fields>
269
- </nzpost>
270
- <fastway translate="label" module="ship">
271
- <label>Fastway</label>
272
- <frontend_type>text</frontend_type>
273
- <sort_order>99</sort_order>
274
- <show_in_default>1</show_in_default>
275
- <show_in_website>1</show_in_website>
276
- <show_in_store>1</show_in_store>
277
- <fields>
278
- <active translate="label">
279
- <label>Enabled</label>
280
- <frontend_type>select</frontend_type>
281
- <source_model>adminhtml/system_config_source_yesno</source_model>
282
- <sort_order>1</sort_order>
283
- <show_in_default>1</show_in_default>
284
- <show_in_website>1</show_in_website>
285
- <show_in_store>1</show_in_store>
286
- </active>
287
- <title translate="label">
288
- <label>Title</label>
289
- <frontend_type>text</frontend_type>
290
- <sort_order>2</sort_order>
291
- <show_in_default>1</show_in_default>
292
- <show_in_website>1</show_in_website>
293
- <show_in_store>1</show_in_store>
294
- </title>
295
- <name translate="label">
296
- <label>Method Name</label>
297
- <frontend_type>text</frontend_type>
298
- <sort_order>2</sort_order>
299
- <show_in_default>1</show_in_default>
300
- <show_in_website>1</show_in_website>
301
- <show_in_store>1</show_in_store>
302
- </name>
303
- <calculate translate="label">
304
- <label>Calculate (otherwise flat rate below)</label>
305
- <frontend_type>select</frontend_type>
306
- <source_model>adminhtml/system_config_source_yesno</source_model>
307
- <sort_order>3</sort_order>
308
- <show_in_default>1</show_in_default>
309
- <show_in_website>1</show_in_website>
310
- <show_in_store>0</show_in_store>
311
- </calculate>
312
- <price translate="label">
313
- <label>Flat Rate Price</label>
314
- <frontend_type>text</frontend_type>
315
- <sort_order>4</sort_order>
316
- <show_in_default>1</show_in_default>
317
- <show_in_website>1</show_in_website>
318
- <show_in_store>1</show_in_store>
319
- </price>
320
- <apiKey translate="label">
321
- <label>Api Key</label>
322
- <frontend_type>text</frontend_type>
323
- <sort_order>5</sort_order>
324
- <show_in_default>1</show_in_default>
325
- <show_in_website>1</show_in_website>
326
- <show_in_store>1</show_in_store>
327
- </apiKey>
328
- <specificerrmsg translate="label">
329
- <label>Displayed Error Message</label>
330
- <frontend_type>textarea</frontend_type>
331
- <sort_order>6</sort_order>
332
- <show_in_default>1</show_in_default>
333
- <show_in_website>1</show_in_website>
334
- <show_in_store>1</show_in_store>
335
- </specificerrmsg>
336
- <sallowspecific translate="label">
337
- <label>Ship to Applicable Countries</label>
338
- <frontend_type>select</frontend_type>
339
- <sort_order>90</sort_order>
340
- <frontend_class>shipping-applicable-country</frontend_class>
341
- <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
342
- <show_in_default>1</show_in_default>
343
- <show_in_website>1</show_in_website>
344
- <show_in_store>0</show_in_store>
345
- </sallowspecific>
346
- <specificcountry translate="label">
347
- <label>Ship to Specific Countries</label>
348
- <frontend_type>multiselect</frontend_type>
349
- <sort_order>91</sort_order>
350
- <source_model>adminhtml/system_config_source_country</source_model>
351
- <show_in_default>1</show_in_default>
352
- <show_in_website>1</show_in_website>
353
- <show_in_store>0</show_in_store>
354
- <can_be_empty>1</can_be_empty>
355
- </specificcountry>
356
- </fields>
357
- </fastway>
358
- <dhlexpress translate="label" module="ship">
359
- <label>DHL Express</label>
360
- <frontend_type>text</frontend_type>
361
- <sort_order>99</sort_order>
362
- <show_in_default>1</show_in_default>
363
- <show_in_website>1</show_in_website>
364
- <show_in_store>1</show_in_store>
365
- <fields>
366
- <active translate="label">
367
- <label>Enabled</label>
368
- <frontend_type>select</frontend_type>
369
- <source_model>adminhtml/system_config_source_yesno</source_model>
370
- <sort_order>1</sort_order>
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
- </active>
375
- <title translate="label">
376
- <label>Title</label>
377
- <frontend_type>text</frontend_type>
378
- <sort_order>2</sort_order>
379
- <show_in_default>1</show_in_default>
380
- <show_in_website>1</show_in_website>
381
- <show_in_store>1</show_in_store>
382
- </title>
383
- <name translate="label">
384
- <label>Method Name</label>
385
- <frontend_type>text</frontend_type>
386
- <sort_order>2</sort_order>
387
- <show_in_default>1</show_in_default>
388
- <show_in_website>1</show_in_website>
389
- <show_in_store>1</show_in_store>
390
- </name>
391
- <calculate translate="label">
392
- <label>Calculate (otherwise flat rate below)</label>
393
- <frontend_type>select</frontend_type>
394
- <source_model>adminhtml/system_config_source_yesno</source_model>
395
- <sort_order>3</sort_order>
396
- <show_in_default>1</show_in_default>
397
- <show_in_website>1</show_in_website>
398
- <show_in_store>1</show_in_store>
399
- </calculate>
400
- <price translate="label">
401
- <label>Flat Rate Price</label>
402
- <frontend_type>text</frontend_type>
403
- <sort_order>4</sort_order>
404
- <show_in_default>1</show_in_default>
405
- <show_in_website>1</show_in_website>
406
- <show_in_store>1</show_in_store>
407
- </price>
408
- <apiKey translate="label">
409
- <label>Api Key</label>
410
- <frontend_type>text</frontend_type>
411
- <sort_order>5</sort_order>
412
- <show_in_default>1</show_in_default>
413
- <show_in_website>1</show_in_website>
414
- <show_in_store>1</show_in_store>
415
- </apiKey>
416
- <specificerrmsg translate="label">
417
- <label>Displayed Error Message</label>
418
- <frontend_type>textarea</frontend_type>
419
- <sort_order>6</sort_order>
420
- <show_in_default>1</show_in_default>
421
- <show_in_website>1</show_in_website>
422
- <show_in_store>1</show_in_store>
423
- </specificerrmsg>
424
- <sallowspecific translate="label">
425
- <label>Ship to Applicable Countries</label>
426
- <frontend_type>select</frontend_type>
427
- <sort_order>90</sort_order>
428
- <frontend_class>shipping-applicable-country</frontend_class>
429
- <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
430
- <show_in_default>1</show_in_default>
431
- <show_in_website>1</show_in_website>
432
- <show_in_store>0</show_in_store>
433
- </sallowspecific>
434
- <specificcountry translate="label">
435
- <label>Ship to Specific Countries</label>
436
- <frontend_type>multiselect</frontend_type>
437
- <sort_order>91</sort_order>
438
- <source_model>adminhtml/system_config_source_country</source_model>
439
- <show_in_default>1</show_in_default>
440
- <show_in_website>1</show_in_website>
441
- <show_in_store>0</show_in_store>
442
- <can_be_empty>1</can_be_empty>
443
- </specificcountry>
444
- </fields>
445
- </dhlexpress>
446
- </groups>
447
- </carriers>
448
- </sections>
449
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/layout/{starshipit.xml → shipit.xml} RENAMED
@@ -2,7 +2,7 @@
2
  <layout>
3
  <adminhtml_sales_order_index>
4
  <reference name="head">
5
- <action method="addJs"><script>mage/adminhtml/starshipgrid.js</script></action>
6
  </reference>
7
  </adminhtml_sales_order_index>
8
  </layout>
2
  <layout>
3
  <adminhtml_sales_order_index>
4
  <reference name="head">
5
+ <action method="addJs"><script>shipit/adminhtml/grid.js</script></action>
6
  </reference>
7
  </adminhtml_sales_order_index>
8
  </layout>
app/design/adminhtml/default/default/layout/shipnote.xml ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <!-- Orders -->
4
+ <adminhtml_sales_order_view>
5
+ <reference name="order_tab_info">
6
+ <action method="setTemplate">
7
+ <template>shipnote/sales/order/view/tab/info.phtml</template>
8
+ </action>
9
+ <block type="shipnote/adminhtml_sales_order_note" name="shipnote" template="shipnote/note.phtml"/>
10
+ </reference>
11
+ </adminhtml_sales_order_view>
12
+
13
+ <!-- Invoices -->
14
+ <adminhtml_sales_order_invoice_new>
15
+ <reference name='form'>
16
+ <action method="setTemplate">
17
+ <template>shipnote/sales/order/invoice/create/form.phtml</template>
18
+ </action>
19
+ <block type="shipnote/adminhtml_sales_order_note" name="shipnote" template="shipnote/note.phtml"/>
20
+ </reference>
21
+ </adminhtml_sales_order_invoice_new>
22
+ <adminhtml_sales_order_invoice_view>
23
+ <reference name='form'>
24
+ <action method="setTemplate">
25
+ <template>shipnote/sales/order/invoice/view/form.phtml</template>
26
+ </action>
27
+ <block type="shipnote/adminhtml_sales_order_note" name="shipnote" template="shipnote/note.phtml"/>
28
+ </reference>
29
+ </adminhtml_sales_order_invoice_view>
30
+
31
+ <!-- Shipments -->
32
+ <adminhtml_sales_order_shipment_new>
33
+ <reference name='form'>
34
+ <action method="setTemplate">
35
+ <template>shipnote/sales/order/shipment/create/form.phtml</template>
36
+ </action>
37
+ <block type="shipnote/adminhtml_sales_order_note" name="shipnote" template="shipnote/note.phtml"/>
38
+ </reference>
39
+ </adminhtml_sales_order_shipment_new>
40
+ <adminhtml_sales_order_shipment_view>
41
+ <reference name='form'>
42
+ <action method="setTemplate">
43
+ <template>shipnote/sales/order/shipment/view/form.phtml</template>
44
+ </action>
45
+ <block type="shipnote/adminhtml_sales_order_note" name="shipnote" template="shipnote/note.phtml"/>
46
+ </reference>
47
+ </adminhtml_sales_order_shipment_view>
48
+
49
+ <!-- Credt memos -->
50
+ <adminhtml_sales_order_creditmemo_new>
51
+ <reference name='form'>
52
+ <action method="setTemplate">
53
+ <template>shipnote/sales/order/creditmemo/create/form.phtml</template>
54
+ </action>
55
+ <block type="shipnote/adminhtml_sales_order_note" name="shipnote" template="shipnote/note.phtml"/>
56
+ </reference>
57
+ </adminhtml_sales_order_creditmemo_new>
58
+ <adminhtml_sales_order_creditmemo_view>
59
+ <reference name='form'>
60
+ <action method="setTemplate">
61
+ <template>shipnote/sales/order/creditmemo/view/form.phtml</template>
62
+ </action>
63
+ <block type="shipnote/adminhtml_sales_order_note" name="shipnote" output="toHtml"
64
+ template="shipnote/note.phtml"/>
65
+ </reference>
66
+ </adminhtml_sales_order_creditmemo_view>
67
+
68
+ <adminhtml_sales_order_create_index>
69
+ <reference name="data">
70
+ <block type="shipnote/adminhtml_sales_order_create_shipnote" name="shipnote"
71
+ template="shipnote/sales/order/create/shipnote.phtml"/>
72
+ <action method="setTemplate">
73
+ <template>shipnote/sales/order/create/data.phtml</template>
74
+ </action>
75
+ </reference>
76
+ </adminhtml_sales_order_create_index>
77
+ <adminhtml_sales_order_create_load_block_data>
78
+ <reference name="data">
79
+ <block type="shipnote/adminhtml_sales_order_create_shipnote" name="shipnote"
80
+ template="shipnote/sales/order/create/shipnote.phtml"/>
81
+ <action method="setTemplate">
82
+ <template>shipnote/sales/order/create/data.phtml</template>
83
+ </action>
84
+ </reference>
85
+ </adminhtml_sales_order_create_load_block_data>
86
+ </layout>
app/design/adminhtml/default/default/template/{starshipit → shipit}/system/config/button.phtml RENAMED
File without changes
app/design/adminhtml/default/default/template/{starshipit → shipit}/system/config/syncbutton.phtml RENAMED
File without changes
app/design/adminhtml/default/default/template/shipnote/note-create.phtml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <div class="box-right entry-edit">
2
+ <div class="entry-edit-head"><h4><?php echo $this->__($this->getFrontendLabel()) ?></h4></div>
3
+ <fieldset id="order-deliverynote">
4
+ <label for="deliverynote-note"><?php echo $this->__($this->getFrontendLabel()) ?></label><br>
5
+ <?php $characterCount = $this->getCharacterCount(); ?>
6
+ <textarea cols="15" rows="2" id='deliverynote-note' name='deliverynote'
7
+ style="width:98%; height:8em;" <?php if ($characterCount !== false): ?>class="validate-length maximum-length-<?php echo $characterCount ?>"<?php endif; ?>></textarea>
8
+ </fieldset>
9
+ </div>
app/design/adminhtml/default/default/template/shipnote/note.phtml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="entry-edit-head" id='shipnote'>
2
+ <h4 class="icon-head head-shipnote">
3
+ Shipping Notes
4
+ <!--<?php echo $this->__(Mage::helper('shipnote')->getFrontendLabel()) ?>-->
5
+ </h4>
6
+ </div>
7
+ <fieldset>
8
+ <?php
9
+ $_note = $this->getNote();
10
+ if (false !== $_note) {
11
+ $signatureRequired = $_note->getSignatureRequired();
12
+ $authorityToLeave = $_note->getAuthorityToLeave();
13
+ echo 'Delivery Instructions: ' . $_note;
14
+ if ($signatureRequired == 0) {
15
+ echo '<br />Signature Required: NO';
16
+ }
17
+ else {
18
+ echo '<br />Signature Required: YES';
19
+ }
20
+ if ($authorityToLeave == 0) {
21
+ echo '<br />Authority to Leave: NO';
22
+ }
23
+ else {
24
+ echo '<br />Authority to Leave: YES';
25
+ }
26
+ }
27
+ ?>
28
+ </fieldset>
app/design/adminhtml/default/default/template/shipnote/sales/order/create/data.phtml ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="page-create-order">
2
+ <p class="switcher">
3
+ <label for="currency_switcher"><?php echo Mage::helper('sales')->__('Order Currency:') ?></label>
4
+ <select id="currency_switcher" name="order[currency]"
5
+ onchange="order.setCurrencyId(this.value); order.setCurrencySymbol(this.options[this.selectedIndex].getAttribute('symbol'));">
6
+ <?php foreach ($this->getAvailableCurrencies() as $_code): ?>
7
+ <option value="<?php echo $_code ?>"<?php if ($_code == $this->getCurrentCurrencyCode()): ?>
8
+ selected="selected"<?php endif; ?>
9
+ symbol="<?php echo $this->getCurrencySymbol($_code) ?>"><?php echo $this->getCurrencyName($_code) ?></option>
10
+ <?php endforeach; ?>
11
+ </select>
12
+ </p>
13
+ <script type="text/javascript">order.setCurrencySymbol('<?php echo $this->getCurrencySymbol($this->getCurrentCurrencyCode()) ?>')</script>
14
+ <table cellspacing="0" width="100%">
15
+ <tr>
16
+ <?php if ($this->getCustomerId()): ?>
17
+ <td class="side-col" style="background:none; padding:0;">
18
+ <div id="order-sidebar"><?php echo $this->getChildHtml('sidebar') ?></div>
19
+ </td>
20
+ <?php endif; ?>
21
+ <td <?php if ($this->getCustomerId()): ?>class="main-col"<?php endif; ?>>
22
+ <div id="order-additional_area" style="display:none"
23
+ class="order-additional-area"><?php echo $this->getChildHtml('additional_area') ?></div>
24
+ <div id="order-search" style="display:none"
25
+ class="order-search-items"><?php echo $this->getChildHtml('search') ?></div>
26
+ <div id="order-items"><?php echo $this->getChildHtml('items') ?></div>
27
+ <div id="order-errors"><?php echo $this->getChildHtml('errors') ?></div>
28
+ <div id="order-form_account"><?php echo $this->getChildHtml('form_account') ?></div>
29
+ <div id="order-addresses">
30
+ <div id="order-billing_address"
31
+ class="box-left"><?php echo $this->getChildHtml('billing_address') ?></div>
32
+ <div id="order-shipping_address"
33
+ class="box-right"><?php echo $this->getChildHtml('shipping_address') ?></div>
34
+ </div>
35
+ <div class="clear"></div>
36
+ <div id="order-methods">
37
+ <div id="order-billing_method"
38
+ class="box-left payments"><?php echo $this->getChildHtml('billing_method') ?></div>
39
+ <div id="order-shipping_method"
40
+ class="box-right"><?php echo $this->getChildHtml('shipping_method') ?></div>
41
+ <div style="clear: right" id="order-shipping_note"
42
+ class="box-right"><?php echo $this->getChildHtml('shipnote') ?></div>
43
+ </div>
44
+
45
+ <?php if ($this->getChild('card_validation')): ?>
46
+ <div class="clear"></div>
47
+ <div id="order-methods">
48
+ <div id="order-card_validation"
49
+ class="box-left payments"><?php echo $this->getChildHtml('card_validation') ?></div>
50
+ </div>
51
+ <?php endif; ?>
52
+
53
+ <div class="clear"></div>
54
+ <?php echo $this->getChildHtml('gift_options') ?>
55
+
56
+ <div class="clear"></div>
57
+ <div class="box-left entry-edit">
58
+ <div class="entry-edit-head"><h4><?php echo Mage::helper('sales')->__('Order History') ?></h4></div>
59
+ <fieldset id="order-comment"><?php echo $this->getChildHtml('comment') ?></fieldset>
60
+ </div>
61
+ <div class="box-right entry-edit">
62
+ <div class="entry-edit-head"><h4><?php echo Mage::helper('sales')->__('Order Totals') ?></h4></div>
63
+ <div id="order-totals" class="order-totals"><?php echo $this->getChildHtml('totals') ?></div>
64
+ </div>
65
+ <div class="clear"></div>
66
+ </td>
67
+ </tr>
68
+ </table>
69
+ </div>
app/design/adminhtml/default/default/template/shipnote/sales/order/create/shipnote.phtml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="entry-edit">
2
+ <div class="entry-edit-head">
3
+ <h4 class="fieldset-legend head-shipping-method icon-head"><?php echo $this->__('Shipping Instructions') ?></h4>
4
+ </div>
5
+ <div class="fieldset">
6
+ <div id="order-shipnote">
7
+ <textarea style="width:98%; height:8em;" id="shipnote-note" name="order[ship_note]" rows="2"
8
+ cols="15"><?php echo $this->__($this->getShipNote()) ?></textarea>
9
+ </div>
10
+ <script type="text/javascript">
11
+ AdminOrder.addMethods({
12
+ shipnoteFieldsBind:function (container) {
13
+ if ($(container)) {
14
+ var fields = $(container).select('textarea');
15
+ for (var i = 0; i < fields.length; i++)
16
+ fields[i].observe('change', this.shipnoteFieldChange.bind(this))
17
+ }
18
+ },
19
+ shipnoteFieldChange:function () {
20
+ this.saveData(this.serializeData('order-shipnote'));
21
+ }
22
+ });
23
+ order.shipnoteFieldsBind('order-shipnote');
24
+ </script>
25
+ </div>
26
+ </div>
app/design/adminhtml/default/default/template/shipnote/sales/order/creditmemo/create/form.phtml ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <form id="edit_form" method="post" action="<?php echo $this->getSaveUrl() ?>">
2
+ <?php echo $this->getBlockHtml('formkey')?>
3
+ <?php $_order = $this->getCreditmemo()->getOrder() ?>
4
+ <?php echo $this->getChildHtml('order_info') ?>
5
+
6
+ <?php if (!$_order->getIsVirtual()): ?>
7
+ <div class="box-left">
8
+ <?php else: ?>
9
+ <div class="box-right">
10
+ <?php endif; ?>
11
+ <!--Billing Address-->
12
+ <div class="entry-edit">
13
+ <div class="entry-edit-head">
14
+ <h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
15
+ </div>
16
+ <fieldset>
17
+ <div><?php echo $this->getChildHtml('order_payment') ?></div>
18
+ <div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
19
+ <?php /*if ($this->getCreditmemo()->canRefund()): ?>
20
+ <input type="checkbox" name="creditmemo[do_refund]" id="creditmemo_do_refund" value="1" checked/>
21
+ <label for="creditmemo_do_refund" class="normal"><?php echo Mage::helper('sales')->__('Refund Amount') ?></label>
22
+ <?php endif;*/ ?>
23
+ </fieldset>
24
+ </div>
25
+ </div>
26
+ <?php if (!$_order->getIsVirtual()): ?>
27
+ <div class="box-right">
28
+ <!--Shipping Address-->
29
+ <div class="entry-edit">
30
+ <div class="entry-edit-head">
31
+ <h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping Information') ?></h4>
32
+ </div>
33
+ <fieldset>
34
+ <strong><?php echo $_order->getShippingDescription() ?></strong>
35
+ <?php echo $this->helper('sales')->__('Total Shipping Charges'); ?>:
36
+
37
+ <?php if ($this->helper('tax')->displaySalesPriceInclTax($this->getSource()->getStoreId())): ?>
38
+ <?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
39
+ <?php else: ?>
40
+ <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
41
+ <?php endif; ?>
42
+ <?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
43
+
44
+ <?php echo $_excl; ?>
45
+ <?php if ($this->helper('tax')->displaySalesBothPrices($this->getSource()->getStoreId()) && $_incl != $_excl): ?>
46
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
47
+ <?php endif; ?>
48
+ </fieldset>
49
+ <?php echo $this->getChildHtml('shipnote') ?>
50
+ </div>
51
+ </div>
52
+ <?php endif; ?>
53
+ <div class="clear"></div>
54
+
55
+ <div class="entry-edit">
56
+ <div class="entry-edit-head">
57
+ <h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('Items to Refund') ?></h4>
58
+ </div>
59
+ </div>
60
+ <div id="creditmemo_item_container">
61
+ <?php echo $this->getChildHtml('order_items') ?>
62
+ </div>
63
+ </form>
app/design/adminhtml/default/default/template/shipnote/sales/order/creditmemo/view/form.phtml ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_order = $this->getCreditmemo()->getOrder() ?>
2
+ <?php echo $this->getChildHtml('order_info') ?>
3
+ <?php if (!$_order->getIsVirtual()): ?>
4
+ <div class="box-left">
5
+ <?php else: ?>
6
+ <div class="box-right">
7
+ <?php endif; ?>
8
+ <!--Billing Address-->
9
+ <div class="entry-edit">
10
+ <div class="entry-edit-head">
11
+ <h4 class="icon-head head-payment-method"><?php echo $this->helper('sales')->__('Payment Information') ?></h4>
12
+ </div>
13
+ <fieldset>
14
+ <div><?php echo $this->getChildHtml('order_payment') ?></div>
15
+ <div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
16
+ </fieldset>
17
+ </div>
18
+ </div>
19
+ <?php if (!$_order->getIsVirtual()): ?>
20
+ <div class="box-right">
21
+ <!--Shipping Address-->
22
+ <div class="entry-edit">
23
+ <div class="entry-edit-head">
24
+ <h4 class="icon-head head-shipping-method"><?php echo $this->helper('sales')->__('Shipping Information') ?></h4>
25
+ </div>
26
+ <fieldset>
27
+ <strong><?php echo $_order->getShippingDescription() ?></strong>
28
+ <?php echo $this->helper('sales')->__('Total Shipping Charges'); ?>:
29
+
30
+ <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
31
+ <?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
32
+ <?php else: ?>
33
+ <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
34
+ <?php endif; ?>
35
+ <?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
36
+
37
+ <?php echo $_excl; ?>
38
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
39
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
40
+ <?php endif; ?>
41
+ </fieldset>
42
+ <?php echo $this->getChildHtml('shipnote') ?>
43
+ </div>
44
+ </div>
45
+ <?php endif; ?>
46
+ <div class="clear"></div>
47
+ <?php $_items = $this->getCreditmemo()->getAllItems() ?>
48
+ <div class="entry-edit">
49
+ <div class="entry-edit-head">
50
+ <h4 class="icon-head head-products"><?php echo $this->helper('sales')->__('Items Refunded') ?></h4>
51
+ </div>
52
+ </div>
53
+ <?php if (count($_items)): ?>
54
+ <div id="creditmemo_items_container">
55
+ <?php echo $this->getChildHtml('creditmemo_items') ?>
56
+ </div>
57
+ <?php else: ?>
58
+ <div class="entry-edit">
59
+ <fieldset>
60
+ <center><?php echo $this->helper('sales')->__('No Items') ?></center>
61
+ </fieldset>
62
+ </div>
63
+ <?php endif; ?>
64
+ <br/>
65
+ <div class="box-left entry-edit">
66
+ <div class="entry-edit-head"><h4><?php echo $this->__('Credit Memo History') ?></h4></div>
67
+ <fieldset><?php echo $this->getChildHtml('order_comments') ?></fieldset>
68
+ </div>
69
+
70
+ <div class="box-right entry-edit" id="history_form">
71
+ <div class="entry-edit-head"><h4><?php echo $this->__('Credit Memo Totals') ?></h4></div>
72
+ <div class="order-totals"><?php echo $this->getChildHtml('creditmemo_totals') ?></div>
73
+ </div>
74
+ <div class="clear"></div>
app/design/adminhtml/default/default/template/shipnote/sales/order/invoice/create/form.phtml ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <form id="edit_form" method="post" action="<?php echo $this->getSaveUrl() ?>">
2
+ <?php echo $this->getBlockHtml('formkey')?>
3
+ <?php $_order = $this->getInvoice()->getOrder() ?>
4
+ <?php echo $this->getChildHtml('order_info') ?>
5
+ <?php if (!$_order->getIsVirtual()): ?>
6
+ <div class="box-left">
7
+ <?php else: ?>
8
+ <div class="box-right">
9
+ <?php endif; ?>
10
+
11
+ <div class="entry-edit">
12
+ <div class="entry-edit-head">
13
+ <h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
14
+ </div>
15
+ <fieldset>
16
+ <div><?php echo $this->getChildHtml('order_payment') ?></div>
17
+ <div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
18
+ </fieldset>
19
+ </div>
20
+ </div>
21
+ <?php if (!$_order->getIsVirtual()): ?>
22
+ <div class="box-right">
23
+ <!--Shipping Address-->
24
+ <div class="entry-edit">
25
+ <div class="entry-edit-head">
26
+ <h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping Information') ?></h4>
27
+ </div>
28
+ <fieldset>
29
+ <div>
30
+ <strong><?php echo $_order->getShippingDescription() ?></strong>
31
+ <?php echo $this->helper('sales')->__('Total Shipping Charges'); ?>:
32
+
33
+ <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
34
+ <?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
35
+ <?php else: ?>
36
+ <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
37
+ <?php endif; ?>
38
+ <?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
39
+
40
+ <?php echo $_excl; ?>
41
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
42
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
43
+ <?php endif; ?>
44
+ </div>
45
+ <?php if ($this->canCreateShipment() && $this->canShipPartiallyItem()): ?>
46
+ <p class="nm">
47
+ <label for="invoice_do_shipment"
48
+ class="normal"><?php echo Mage::helper('sales')->__('Create Shipment') ?></label>
49
+ <input type="checkbox" name="invoice[do_shipment]" id="invoice_do_shipment" value="1"
50
+ onclick="if ( this.checked==true ) { document.getElementById('tracking').style.display = 'block'} else { document.getElementById('tracking').style.display = 'none' }"<?php echo $this->hasInvoiceShipmentTypeMismatch() ? ' disabled="disabled"' : '' ?> />
51
+ </p>
52
+ <?php if ($this->hasInvoiceShipmentTypeMismatch()): ?>
53
+ <small><?php echo $this->__('Some items in this order have different invoice and shipment types. You can create shipment only after the invoice is created.') ?></small>
54
+ <?php endif; ?>
55
+ <?php endif; ?>
56
+ <div id="tracking" style="display:none;"><?php echo $this->getChildHtml('tracking', false) ?></div>
57
+ </fieldset>
58
+ <?php echo $this->getChildHtml('shipnote') ?>
59
+ </div>
60
+ </div>
61
+ <?php endif; ?>
62
+ <div class="clear"></div>
63
+
64
+ <div class="entry-edit">
65
+ <div class="entry-edit-head">
66
+ <?php
67
+ $_itemsGridLabel = $this->getForcedShipmentCreate() ? 'Items to Invoice and Ship' : 'Items to Invoice';
68
+ ?>
69
+ <h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('%s', $_itemsGridLabel) ?></h4>
70
+ </div>
71
+ </div>
72
+ <div id="invoice_item_container">
73
+ <?php echo $this->getChildHtml('order_items') ?>
74
+ </div>
75
+ </form>
76
+ <script>
77
+ /*forced creating of shipment*/
78
+ var forcedShipmentCreate = <?php echo $this->getForcedShipmentCreate() ?>;
79
+ var shipmentElement = $('invoice_do_shipment');
80
+ if (forcedShipmentCreate && shipmentElement) {
81
+ shipmentElement.checked = true;
82
+ shipmentElement.disabled = true;
83
+ document.getElementById('tracking').style.display = 'block';
84
+ }
85
+ </script>
app/design/adminhtml/default/default/template/shipnote/sales/order/invoice/view/form.phtml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_invoice = $this->getInvoice() ?>
2
+ <?php $_order = $_invoice->getOrder() ?>
3
+ <?php echo $this->getChildHtml('order_info') ?>
4
+ <?php if (!$_order->getIsVirtual()): ?>
5
+ <div class="box-left">
6
+ <?php else: ?>
7
+ <div class="box-right">
8
+ <?php endif; ?>
9
+ <!--Billing Address-->
10
+ <div class="entry-edit">
11
+ <div class="entry-edit-head">
12
+ <h4 class="icon-head head-payment-method"><?php echo $this->helper('sales')->__('Payment Information') ?></h4>
13
+ </div>
14
+ <fieldset>
15
+ <div><?php echo $this->getChildHtml('order_payment') ?></div>
16
+ <div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
17
+ </fieldset>
18
+ </div>
19
+ </div>
20
+ <?php if (!$_order->getIsVirtual()): ?>
21
+ <div class="box-right">
22
+ <!--Shipping Address-->
23
+ <div class="entry-edit">
24
+ <div class="entry-edit-head">
25
+ <h4 class="icon-head head-shipping-method"><?php echo $this->helper('sales')->__('Shipping Information') ?></h4>
26
+ </div>
27
+ <fieldset>
28
+ <strong><?php echo $_order->getShippingDescription() ?></strong>
29
+ <?php echo $this->helper('sales')->__('Total Shipping Charges'); ?>:
30
+
31
+ <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
32
+ <?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
33
+ <?php else: ?>
34
+ <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
35
+ <?php endif; ?>
36
+ <?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
37
+
38
+ <?php echo $_excl; ?>
39
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
40
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
41
+ <?php endif; ?>
42
+ <div><?php echo $this->getChildHtml('shipment_tracking') ?></div>
43
+ </fieldset>
44
+ <?php echo $this->getChildHtml('shipnote') ?>
45
+ </div>
46
+ <?php endif; ?>
47
+ </div>
48
+ <div class="clear"></div>
49
+
50
+ <div class="entry-edit">
51
+ <div class="entry-edit-head">
52
+ <h4 class="icon-head head-products"><?php echo $this->helper('sales')->__('Items Invoiced') ?></h4>
53
+ </div>
54
+ <div id="invoice_item_container">
55
+ <?php echo $this->getChildHtml('invoice_items') ?>
56
+ </div>
57
+ </div>
58
+
59
+ <div class="box-left entry-edit">
60
+ <div class="entry-edit-head"><h4><?php echo $this->__('Invoice History') ?></h4></div>
61
+ <fieldset><?php echo $this->getChildHtml('order_comments') ?></fieldset>
62
+ </div>
63
+
64
+ <div class="box-right entry-edit" id="history_form">
65
+ <div class="entry-edit-head"><h4><?php echo $this->__('Invoice Totals') ?></h4></div>
66
+ <div class="order-totals"><?php echo $this->getChildHtml('invoice_totals') ?></div>
67
+ </div>
68
+ <div class="clear"></div>
app/design/adminhtml/default/default/template/shipnote/sales/order/shipment/create/form.phtml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <form id="edit_form" method="post" action="<?php echo $this->getSaveUrl() ?>">
2
+ <?php echo $this->getBlockHtml('formkey')?>
3
+ <?php $_order = $this->getShipment()->getOrder() ?>
4
+ <?php echo $this->getChildHtml('order_info') ?>
5
+
6
+
7
+ <div class="box-left">
8
+ <!--Billing Address-->
9
+ <div class="entry-edit">
10
+ <div class="entry-edit-head">
11
+ <h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
12
+ </div>
13
+ <fieldset>
14
+ <div><?php echo $this->getPaymentHtml() ?></div>
15
+ <div><?php echo Mage::helper('sales')->__('The order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
16
+ </fieldset>
17
+ </div>
18
+ </div>
19
+ <div class="box-right">
20
+ <!--Shipping Address-->
21
+ <div class="entry-edit">
22
+ <div class="entry-edit-head">
23
+ <h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping Information') ?></h4>
24
+ </div>
25
+ <fieldset>
26
+ <div>
27
+ <strong><?php echo $_order->getShippingDescription() ?></strong>
28
+ <?php echo $this->helper('sales')->__('Total Shipping Charges'); ?>:
29
+
30
+ <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
31
+ <?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
32
+ <?php else: ?>
33
+ <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
34
+ <?php endif; ?>
35
+ <?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
36
+
37
+ <?php echo $_excl; ?>
38
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
39
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
40
+ <?php endif; ?>
41
+ </div>
42
+ <div><?php echo $this->getChildHtml('shipment_tracking') ?></div>
43
+ </fieldset>
44
+ <?php echo $this->getChildHtml('shipnote') ?>
45
+ </div>
46
+ </div>
47
+ <div class="clear"></div>
48
+ <div class="entry-edit">
49
+ <div class="entry-edit-head">
50
+ <h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('Items to Ship') ?></h4>
51
+ </div>
52
+ </div>
53
+ <div id="ship_items_container">
54
+ <?php echo $this->getItemsHtml() ?>
55
+ </div>
56
+ </form>
57
+ <script type="text/javascript">
58
+ editForm = new varienForm('edit_form');
59
+ </script>
app/design/adminhtml/default/default/template/shipnote/sales/order/shipment/view/form.phtml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_order = $this->getShipment()->getOrder() ?>
2
+ <?php echo $this->getChildHtml('order_info') ?>
3
+
4
+ <div class="box-left">
5
+ <!--Billing Address-->
6
+ <div class="entry-edit">
7
+ <div class="entry-edit-head">
8
+ <h4 class="icon-head head-payment-method"><?php echo $this->helper('sales')->__('Payment Information') ?></h4>
9
+ </div>
10
+ <fieldset>
11
+ <div><?php echo $this->getChildHtml('order_payment') ?></div>
12
+ <div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
13
+ </fieldset>
14
+ </div>
15
+ </div>
16
+ <div class="box-right">
17
+ <!--Shipping Address-->
18
+ <div class="entry-edit">
19
+ <div class="entry-edit-head">
20
+ <h4 class="icon-head head-shipping-method"><?php echo $this->helper('sales')->__('Shipping and Tracking Information') ?></h4>
21
+ </div>
22
+ <fieldset>
23
+ <div>
24
+ <?php if ($this->getShipment()->getTracksCollection()->count()): ?>
25
+ <a href="#" id="linkId"
26
+ onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($this->getShipment()) ?>','trackshipment','width=800,height=600,resizable=yes,scrollbars=yes')"
27
+ title="<?php echo $this->__('Track this shipment') ?>"><?php echo $this->__('Track this shipment') ?></a>
28
+ <br/>
29
+ <?php endif; ?>
30
+ <strong><?php echo $_order->getShippingDescription() ?></strong>
31
+ <?php echo $this->helper('sales')->__('Total Shipping Charges'); ?>:
32
+
33
+ <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
34
+ <?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
35
+ <?php else: ?>
36
+ <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
37
+ <?php endif; ?>
38
+ <?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
39
+
40
+ <?php echo $_excl; ?>
41
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
42
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
43
+ <?php endif; ?>
44
+ </div>
45
+ <div><?php echo $this->getChildHtml('shipment_tracking') ?></div>
46
+ </fieldset>
47
+ <?php echo $this->getChildHtml('shipnote') ?>
48
+ </div>
49
+ </div>
50
+ <div class="clear"></div>
51
+
52
+ <div class="entry-edit">
53
+ <div class="entry-edit-head">
54
+ <h4 class="icon-head head-products"><?php echo $this->helper('sales')->__('Items Shipped') ?></h4>
55
+ </div>
56
+ </div>
57
+
58
+ <?php echo $this->getChildHtml('shipment_items') ?>
59
+
60
+ <div class="box-left entry-edit">
61
+ <div class="entry-edit-head"><h4><?php echo $this->__('Shipment History') ?></h4></div>
62
+ <fieldset><?php echo $this->getChildHtml('order_comments') ?></fieldset>
63
+ </div>
64
+ <div class="clear"></div>
app/design/adminhtml/default/default/template/shipnote/sales/order/view/tab/info.phtml ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_order = $this->getOrder() ?>
2
+ <div>
3
+ <div id="order-messages">
4
+ <?php echo $this->getChildHtml('order_messages') ?>
5
+ </div>
6
+ <?php echo $this->getChildHtml('order_info') ?>
7
+ <input type="hidden" name="order_id" value="<?php echo $_order->getId() ?>"/>
8
+ <?php if ($_order->getIsVirtual()): ?>
9
+ <div class="box-right">
10
+ <?php else: ?>
11
+ <div class="box-left">
12
+ <?php endif; ?>
13
+ <!--Payment Method-->
14
+ <div class="entry-edit">
15
+ <div class="entry-edit-head">
16
+ <h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
17
+ </div>
18
+ <fieldset>
19
+ <?php echo $this->getPaymentHtml() ?>
20
+ <div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
21
+ </fieldset>
22
+ </div>
23
+ </div>
24
+ <?php if (!$_order->getIsVirtual()): ?>
25
+ <div class="box-right">
26
+ <!--Shipping Method-->
27
+ <div class="entry-edit">
28
+ <div class="entry-edit-head">
29
+ <h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping &amp; Handling Information') ?></h4>
30
+ </div>
31
+ <fieldset>
32
+ <?php if ($_order->getTracksCollection()->count()) : ?>
33
+ <a href="#" id="linkId"
34
+ onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_order) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')"
35
+ title="<?php echo $this->__('Track Order') ?>"><?php echo $this->__('Track Order') ?></a>
36
+ <br/>
37
+ <?php endif; ?>
38
+ <?php if ($_order->getShippingDescription()): ?>
39
+ <strong><?php echo $_order->getShippingDescription() ?></strong>
40
+
41
+ <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
42
+ <?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
43
+ <?php else: ?>
44
+ <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
45
+ <?php endif; ?>
46
+ <?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
47
+
48
+ <?php echo $_excl; ?>
49
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
50
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
51
+ <?php endif; ?>
52
+ <?php else: ?>
53
+ <?php echo $this->helper('sales')->__('No shipping information available'); ?>
54
+ <?php endif; ?>
55
+ </fieldset>
56
+ </div>
57
+ <?php echo $this->getChildHtml('shipnote'); ?>
58
+ </div>
59
+ <?php endif; ?>
60
+ <div class="clear"></div>
61
+ <?php echo $this->getGiftOptionsHtml() ?>
62
+ <div class="clear"></div>
63
+ <div class="entry-edit">
64
+ <div class="entry-edit-head">
65
+ <h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('Items Ordered') ?></h4>
66
+ </div>
67
+ </div>
68
+ <?php echo $this->getItemsHtml() ?>
69
+ <div class="clear"></div>
70
+
71
+ <div class="box-left">
72
+ <div class="entry-edit">
73
+ <div class="entry-edit-head">
74
+ <h4><?php echo Mage::helper('sales')->__('Comments History') ?></h4>
75
+ </div>
76
+ <fieldset><?php echo $this->getChildHtml('order_history') ?></fieldset>
77
+ </div>
78
+ </div>
79
+ <div class="box-right entry-edit">
80
+ <div class="entry-edit-head"><h4><?php echo Mage::helper('sales')->__('Order Totals') ?></h4></div>
81
+ <div class="order-totals"><?php echo $this->getChildHtml('order_totals') ?></div>
82
+ </div>
83
+ <div class="clear"></div>
84
+ </div>
85
+
86
+ <?php echo $this->getChildHtml('popup_window');?>
87
+ <script type="text/javascript">
88
+ //<![CDATA[
89
+ function getGiftOptionsTooltipContent(itemId) {
90
+ var contentLines = [];
91
+ var headerLine = null;
92
+ var contentLine = null;
93
+
94
+ $$('#gift_options_data_' + itemId + ' .gift-options-tooltip-content').each(function (element) {
95
+ if (element.down(0)) {
96
+ headerLine = element.down(0).innerHTML;
97
+ contentLine = element.down(0).next().innerHTML;
98
+ if (contentLine.length > 30) {
99
+ contentLine = contentLine.slice(0, 30) + '...';
100
+ }
101
+ contentLines.push(headerLine + ' ' + contentLine);
102
+ }
103
+ });
104
+ return contentLines.join('<br/>');
105
+ }
106
+ giftOptionsTooltip.setTooltipContentLoaderFunction(getGiftOptionsTooltipContent);
107
+ //]]>
108
+ </script>
app/design/frontend/base/default/layout/addressautocomplete.xml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <checkout_onepage_index>
4
+ <reference name="head">
5
+ <block type="core/text" name="google.api.map">
6
+ <action method="setText">
7
+ <text><![CDATA[<script src="https://maps.googleapis.com/maps/api/js?v=3&libraries=places"></script>]]></text>
8
+ </action>
9
+ </block>
10
+ <action method="addItem"><type>skin_js</type><name>js/shipit/onstepcheckout.js</name></action>
11
+ <action method="addItem"><type>skin_js</type><name>js/shipit/onstepcheckout_shipping.js</name></action>
12
+ </reference>
13
+ </checkout_onepage_index>
14
+ </layout>
app/design/frontend/base/default/layout/shipnote.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <checkout_onepage_index>
4
+ <reference name='head'>
5
+ <action method="addItem" ifconfig="shipnote_options/basic_settings/enabled">
6
+ <type>skin_css</type>
7
+ <name>css/shipnote.css</name>
8
+ </action>
9
+ </reference>
10
+ </checkout_onepage_index>
11
+ <checkout_onepage_additional>
12
+ <reference name="root">
13
+ <block type="shipnote/note" output="toHtml" name="shipnote" as="note" template="shipnote/note.phtml" after='-' />
14
+ </reference>
15
+ </checkout_onepage_additional>
16
+ </layout>
app/design/frontend/base/default/template/shipnote/note.phtml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->canShow()): ?>
2
+ <script type="text/javascript">
3
+ jQuery(document).ready(function(){
4
+ jQuery('input[type="radio"][name="ship-signature-required"]').click(function(){
5
+ signatureRequired(this);
6
+ });
7
+ });
8
+ function signatureRequired(radioItem) {
9
+ var authorityToLeaveCheckBox = jQuery('#'+'authorityToLeaveCheckBox');
10
+ if (radioItem.value == 1) {
11
+ authorityToLeaveCheckBox.prop("checked", false);
12
+ authorityToLeaveCheckBox.prop("disabled", true);
13
+ }
14
+ else {
15
+ authorityToLeaveCheckBox.prop("disabled", false);
16
+ }
17
+ }
18
+ </script>
19
+ <div id='shipnote'>
20
+ <div id="shipnoteContent">
21
+ <label for='shipnote-note'><?php echo $this->__(Mage::helper('shipnote')->getFrontendLabel()) ?></label>
22
+ <textarea id='shipnote-note' name='ship-note' class="input-text"></textarea>
23
+ </div>
24
+ <div style="width: 160px; float: left">Signature Required:</div>
25
+ <div style="padding-top: 2px">
26
+ <input type="radio" name='ship-signature-required' value="1" onclick="signatureRequired(true);" /> Yes
27
+ <input type="radio" name='ship-signature-required' value="0" onclick="signatureRequired(false);" checked /> No
28
+ </div>
29
+ <div style="width: 160px; float: left">Authority to Leave:</div>
30
+ <div style="padding-top: 2px"><input type="checkbox" id="authorityToLeaveCheckBox" name='ship-authority-to-leave' /></div>
31
+ </div>
32
+ <?php endif; ?>
app/etc/modules/{Rvtech_Startshipit.xml → Rvtech_Starshipit.xml} RENAMED
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
  <config>
3
  <modules>
4
  <Rvtech_Starshipit>
@@ -6,4 +6,4 @@
6
  <codePool>community</codePool>
7
  </Rvtech_Starshipit>
8
  </modules>
9
- </config>
1
+ <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
  <Rvtech_Starshipit>
6
  <codePool>community</codePool>
7
  </Rvtech_Starshipit>
8
  </modules>
9
+ </config>
app/etc/modules/Starshipit.xml DELETED
@@ -1,9 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Starshipit_Ship>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- </Starshipit_Ship>
8
- </modules>
9
- </config>
 
 
 
 
 
 
 
 
 
app/locale/en_GB/Rvtech_StarshipitNote.csv ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ "Shipping Note","Delivery Note"
2
+ "Shipping Instructions","Delivery Instructions"
3
+ "Shipping Notes","Delivery Notes"
4
+ "Shipping Notes Options","Delivery Notes Options"
5
+ "Shipping Note Options","Delivery Note Options"
js/{mage/adminhtml/starshipgrid.js → shipit/adminhtml/grid.js} RENAMED
@@ -34,12 +34,12 @@ varienGridMassaction.prototype.apply = function(){
34
  } else if(item.url) {
35
  this.form.action = item.url;
36
  this.form.submit();
37
- } else if(item.starshipIt_url) {
38
  var orders = this.getCheckedValues();
39
  var re = /\s*,\s*/;
40
  var ordersList = orders.split(re);
41
  var orderStr = ordersList.join("_");
42
- var finalURL = item.starshipIt_url+'&Orders='+orderStr;
43
  // alert('Final URL : '+finalURL);
44
  window.location = finalURL;
45
  }
34
  } else if(item.url) {
35
  this.form.action = item.url;
36
  this.form.submit();
37
+ } else if(item.shipIt_url) {
38
  var orders = this.getCheckedValues();
39
  var re = /\s*,\s*/;
40
  var ordersList = orders.split(re);
41
  var orderStr = ordersList.join("_");
42
+ var finalURL = item.shipIt_url+'&Orders='+orderStr;
43
  // alert('Final URL : '+finalURL);
44
  window.location = finalURL;
45
  }
package.xml CHANGED
@@ -1,27 +1,40 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Rvtech_Starshipit</name>
4
- <version>1.6.0.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>This extension allows for rate quotes as well as automated shipping.&#xD;
10
  &#xD;
 
 
11
  Adds Australia and New Zealand supported carriers as well as a button to click through from the order details to enable automated shipping.</summary>
12
- <description>The StarShipIt Magento Extension enables orders to be imported into StarShipIt DHL and writes back tracking information and updates order status in Magento.&#xD;
 
 
 
 
 
13
  &#xD;
14
- From StarShipIt shipping labels can be produced, tracking of orders is supported, quotes can be obtained and all custom and DHL documentation can be produced.&#xD;
15
  &#xD;
16
  DHL Express Worldwide is supported as well &#xD;
17
- Australia Post eParcel, CourierPost, Fastways, and more</description>
18
- <notes>Renamed button in Order View to "ShipIt".&#xD;
19
- &#xD;
20
- Changed the behaviour of the "ShipIt" button to open a new browser window instead of redirecting the Order View page.</notes>
21
- <authors><author><name>George Plummer</name><user>GeorgeSPlummer</user><email>george@starshipit.com</email></author></authors>
22
- <date>2015-06-25</date>
23
- <time>22:49:53</time>
24
- <contents><target name="magecommunity"><dir name="Rvtech"><dir name="Starshipit"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="2b3b0143262abe0d3ba50c38fe10d932"/><file name="Syncbutton.php" hash="b53f7f430495c1e9466789b116ce6349"/></dir></dir></dir></dir><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="52dc5c408d28810e8bc3a19dc65409a3"/><file name="View.php" hash="02071ad3d9c0742439e1d780b40a4022"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="0313223fc94e9ed45f4401119bd6f528"/><file name="Starship.php" hash="8e67e9407ff4e1226c9ee83ba267b6d5"/></dir><dir name="Model"><file name="Observer.php" hash="cac0751526ff06c8bdaa99d432a75865"/><file name="Orders.php" hash="d5e6fa78702b1a0bd60e8cb4b3f57521"/><file name="Orders.php_ORG" hash="cbadeab0c67303b653bed3549a9b73de"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="StarshipitController.php" hash="926e0e618d5732fa7fffc0b1b5028259"/><file name="StarshipitController.php_ORG" hash="b7c694e8252892da817eae072f6f8ad6"/></dir><file name="IndexController.php" hash="f74d6e40df4fc46a9be2e53b5da55727"/></dir><dir name="etc"><file name="adminhtml.xml" hash="02121bfdaabeb4aa30733462d532b211"/><file name="config.xml" hash="521d80ad07595a1d4017ac610dd1512c"/><file name="system.xml" hash="02c4074fdacdf4c48f78eb85409dcc77"/></dir></dir></dir><dir name="Starshipit"><dir name="Ship"><dir name="Block"><file name="Ship.php" hash="529d915d3293400dab088a1827406977"/></dir><dir name="Helper"><file name="Data.php" hash="601fe2fdf26bd83cc88ce7b9da7d6e23"/></dir><dir name="Model"><dir name="Carrier"><file name="Auspost.php" hash="12ba8d875aa3390323356540ef291d7b"/><file name="Button.php" hash="2b3b0143262abe0d3ba50c38fe10d932"/><file name="Courierpost.php" hash="020b163a31753d59d4eb4acb30f9aa7e"/><file name="Dhlexpress.php" hash="ef0d41ba374e75028fd5ed2ecadc538a"/><file name="Fastway.php" hash="68e6be1e3bfcac41cdd68d13b5a06a0a"/><file name="Grid.php" hash="52dc5c408d28810e8bc3a19dc65409a3"/><file name="Nzpost.php" hash="fd2e2bcf5bae86f73ef4fbd43cfd5757"/><file name="View.php" hash="7c0b8050183738c0fa7be989c38dc385"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="87ed8f9f6923f532a1fab239c54596c5"/></dir><dir name="etc"><file name="config.xml" hash="d83e58ad297f4a06d5dea18883b141f5"/><file name="system.xml" hash="e2d23522fcc05684be45ab699d80b666"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="starshipit"><dir name="system"><dir name="config"><file name="button.phtml" hash="064f053f67fc7b749d1aec40cd352ce1"/><file name="syncbutton.phtml" hash="3e67731254d4d0298891cd2598471dc9"/></dir></dir></dir></dir><dir name="layout"><file name="starshipit.xml" hash="e451df5a50a3c73bd53ba272ba43f2a4"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Rvtech_Startshipit.xml" hash="741fde1331d6a9b27ef2faa2bd8a843f"/><file name="Starshipit.xml" hash="af4dcd9278d8eb0d30dfb70de26682eb"/></dir></target><target name="mageweb"><dir name="js"><dir name="mage"><dir name="adminhtml"><file name="starshipgrid.js" hash="df976a3e0a82fa6e8117ef687609b431"/></dir></dir></dir></target></contents>
 
 
 
 
 
 
 
25
  <compatible/>
26
  <dependencies><required><php><min>5.1.0</min><max>5.6.8</max></php></required></dependencies>
27
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Rvtech_Starshipit</name>
4
+ <version>1.6.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>This extension allows for rate quotes as well as automated shipping.&#xD;
10
  &#xD;
11
+ &#xD;
12
+ &#xD;
13
  Adds Australia and New Zealand supported carriers as well as a button to click through from the order details to enable automated shipping.</summary>
14
+ <description>The ShipIT Magento Extension enables orders to be imported into ShipIT DHL and writes back tracking information and updates order status in Magento.&#xD;
15
+ &#xD;
16
+ &#xD;
17
+ &#xD;
18
+ From ShipIT shipping labels can be produced, tracking of orders is supported, quotes can be obtained and all custom and DHL documentation can be produced.&#xD;
19
+ &#xD;
20
  &#xD;
 
21
  &#xD;
22
  DHL Express Worldwide is supported as well &#xD;
23
+ &#xD;
24
+ Australia Post eParcel, CourierPost, Fastways, and more.</description>
25
+ <notes>- Added Shipping Instructions&#xD;
26
+ - Added Signature Required&#xD;
27
+ - Added Authority to Leave&#xD;
28
+ - Added Api functionality to retrieve Shipping Notes by Order Id&#xD;
29
+ &#xD;
30
+ - Added Address Autocomplete lookup during CheckOut&#xD;
31
+ &#xD;
32
+ - Added ShipIt Settings in System Configuration&#xD;
33
+ - Moved Api Key field to ShipIt Settings from Shipping Methods</notes>
34
+ <authors><author><name>George Plummer</name><user>GeorgeSPlummer</user><email>george@shipit.click</email></author></authors>
35
+ <date>2015-07-06</date>
36
+ <time>01:02:37</time>
37
+ <contents><target name="mageetc"><dir name="modules"><file name="Rvtech_Starshipit.xml" hash="5f957b335ffd3ef220188acc0a4261c2"/></dir></target><target name="magecommunity"><dir name="Rvtech"><dir name="Starshipit"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Create"><file name="Shipnote.php" hash="e3978a998056ca01f2c1eecadad492f9"/></dir><file name="Note.php" hash="b176725ad1d11312fc9b2e6da10300a3"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="bef51209ace24c39e1d0933c4695665c"/><file name="Syncbutton.php" hash="1b90bc1d0ce6f8fd85783771ffc3720b"/></dir></dir></dir></dir><file name="Note.php" hash="d89159b063408b3496b5a7c1238b9f90"/><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="bcec9d256397a5c39879eba37520370e"/><file name="View.php" hash="3bf5074750827001939816b1a4a5da65"/></dir></dir><file name="Ship.php" hash="19080a45c06dc07b7991dd694d83708a"/></dir><dir name="Helper"><file name="Data.php" hash="a1fe93c3b081bd10a168624766dd0a1b"/><file name="Starship.php" hash="ebc879a96df5c80ffae9744d11a6cac5"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Observer.php" hash="4b3d567c48bf7168691756dea6ff09e4"/></dir><file name="Api.php" hash="9c0c7ad4df68db05f5caf2970b91a542"/><dir name="Carrier"><file name="Auspost.php" hash="2c61f91bf496db4f91e09da00482c44a"/><file name="Courierpost.php" hash="99b239e53137031ba523391fa5391afb"/><file name="Dhlexpress.php" hash="ea851ed276e9378f0628eab19c67f973"/><file name="Fastway.php" hash="f1c976fa2fad37a233d5cde81a171ea1"/><file name="Nzpost.php" hash="597f23ce1ed90e57c80c2c9e8761e611"/></dir><file name="Note.php" hash="91fdbf3caa65797d8050e999a487c4ae"/><file name="Observer.php" hash="166765c2ce65079f10ae2b52f3f78c1d"/><file name="Orders.php" hash="5e6d34681f4ffde9b8b0fcad9f898481"/><dir name="Resource"><dir name="Note"><file name="Collection.php" hash="2526c09006bf6a74b1ddcf2d94b85bd1"/></dir><file name="Note.php" hash="188639765c95bb03abf24785bbcfabbe"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ShipItController.php" hash="7a82038aa1b2e9fd8bc543b402dcbf9a"/></dir><file name="IndexController.php" hash="460eae8341157005b36099d1af296cb3"/></dir><dir name="etc"><file name="adminhtml.xml" hash="02121bfdaabeb4aa30733462d532b211"/><file name="api.xml" hash="03ba9d58ced7f06da747006e8ddf6861"/><file name="config.xml" hash="38fd8a7405cb786f0d08339452f5503d"/><file name="system.xml" hash="8822fd895ff01351079a8dcf0495de28"/></dir><dir name="sql"><dir name="shipnote_setup"><file name="install-1.0.0.php" hash="3440e960c4ae3a4036c797c02703f025"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="shipit.xml" hash="61408954f82f5ac2edcf77d859fd4591"/><file name="shipnote.xml" hash="b30f8ced0fa77550a09c3ab5ee03f28d"/></dir><dir name="template"><dir name="shipit"><dir name="system"><dir name="config"><file name="button.phtml" hash="064f053f67fc7b749d1aec40cd352ce1"/><file name="syncbutton.phtml" hash="3e67731254d4d0298891cd2598471dc9"/></dir></dir></dir><dir name="shipnote"><file name="note-create.phtml" hash="218318453338adb8a43d01dcf3aa74f3"/><file name="note.phtml" hash="dc72f98a11c955181a3d4706e9cfd297"/><dir name="sales"><dir name="order"><dir name="create"><file name="data.phtml" hash="63aa7c2343f1d801b92e61b8497b99cb"/><file name="shipnote.phtml" hash="d2b7b1af3bb9a9183ebf2de06c228234"/></dir><dir name="creditmemo"><dir name="create"><file name="form.phtml" hash="95b2ca2ff1b2d48519cc9f0302179804"/></dir><dir name="view"><file name="form.phtml" hash="0b851bb2da3a68d6b21195cc88d9c3a3"/></dir></dir><dir name="invoice"><dir name="create"><file name="form.phtml" hash="00a1d471675697ff345fb8744b337a54"/></dir><dir name="view"><file name="form.phtml" hash="eb85ea9873900429a859f31585ecb93b"/></dir></dir><dir name="shipment"><dir name="create"><file name="form.phtml" hash="6655a2814e346290ebefce2d45225127"/></dir><dir name="view"><file name="form.phtml" hash="1f5790819a38b162f76a32ec725a0b77"/></dir></dir><dir name="view"><dir name="tab"><file name="info.phtml" hash="66fd085aa3d4e985f914e61ef4ca6748"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="shipnote.xml" hash="4662d0b069083e71689f79ad5ce0102e"/><file name="addressautocomplete.xml" hash="8673329e95703f7757da37acc241cf03"/></dir><dir name="template"><dir name="shipnote"><file name="note.phtml" hash="f6199bbe2739b4689cadd2a854a3d753"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_GB"><file name="Rvtech_StarshipitNote.csv" hash="45582b181cd95563d26e516d9dc5efe4"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="shipnote.css" hash="1cd880ba6ee2ae963fd8b6208d9e6fd8"/></dir><dir name="js"><dir name="shipit"><file name="onstepcheckout.js" hash="acb5677a18e728750f5b1334409ce8c6"/><file name="onstepcheckout_shipping.js" hash="4ce5f865702e73894f96f9de6f1e4880"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="shipit"><dir name="adminhtml"><file name="grid.js" hash="dbf45931948c6c611e1af954ae2430e5"/></dir></dir></dir></target></contents>
38
  <compatible/>
39
  <dependencies><required><php><min>5.1.0</min><max>5.6.8</max></php></required></dependencies>
40
  </package>
skin/frontend/base/default/css/shipnote.css ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #shipnote {
2
+ width: 100%;
3
+ margin-top: 20px;
4
+ margin-left: -30px;
5
+ padding: 15px 30px 20px;
6
+ background: #f1f2f3;
7
+ border-top: solid 1px #dadada;
8
+ border-bottom: solid 1px #dadada;
9
+ }
10
+
11
+ #shipnote label {
12
+ font-weight: bold;
13
+ display: block;
14
+ margin-bottom: 5px;
15
+ }
16
+
17
+ #shipnote textarea {
18
+ height: 50px;
19
+ padding: 10px;
20
+ width: 400px;
21
+ }
skin/frontend/base/default/js/shipit/onstepcheckout.js ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // This example displays an address form, using the autocomplete feature
2
+ // of the Google Places API to help users fill in the information.
3
+ "use strict";
4
+ var SHIPITAUTOCOMPLETE = SHIPITAUTOCOMPLETE || {};
5
+
6
+ SHIPITAUTOCOMPLETE.event = {};
7
+ SHIPITAUTOCOMPLETE.method = {
8
+ placeSearch: "", //
9
+ IdSeparator: "", //
10
+ autocomplete : "",
11
+ streetNumber : "",
12
+ formFields : {
13
+ 'street1': '',
14
+ 'street2': '',
15
+ 'city': '',
16
+ // 'region': '',
17
+ 'postcode': '',
18
+ 'region_id' : ''
19
+ },
20
+ formFieldsValue : {
21
+ 'street1': '',
22
+ 'street2': '',
23
+ 'city': '',
24
+ // 'region': '',
25
+ 'postcode': '',
26
+ 'region_id' : ''
27
+ },
28
+ component_form : "",
29
+
30
+ initialize: function(){
31
+ //init form
32
+ this.getIdSeparator();
33
+ this.initFormFields();
34
+
35
+ this.autocomplete = new google.maps.places.Autocomplete(
36
+ /** @type {HTMLInputElement} */(document.getElementById('billing:street1')),
37
+ { types: ['geocode']});
38
+ // When the user selects an address from the dropdown,
39
+ // populate the address fields in the form.
40
+ google.maps.event.addListener(this.autocomplete, 'place_changed', function( event ) {SHIPITAUTOCOMPLETE.method.fillInAddress()});
41
+ var billing_address = document.getElementById("billing:street1");
42
+ if(billing_address != null){
43
+ billing_address.addEventListener("focus", function( event ) {SHIPITAUTOCOMPLETE.method.setAutocompleteCountry()}, true);
44
+ }
45
+
46
+ var billing_country = document.getElementById("billing:country_id");
47
+ if(billing_country != null){
48
+ billing_country.addEventListener("change", function( event ) {SHIPITAUTOCOMPLETE.method.setAutocompleteCountry()}, true);
49
+ }
50
+
51
+
52
+ },
53
+ getIdSeparator : function() {
54
+ if (!document.getElementById('billing:street1')) {
55
+ this.IdSeparator = "_";
56
+ return "_";
57
+ }
58
+ this.IdSeparator = ":";
59
+ return ":";
60
+ },
61
+ initFormFields: function ()
62
+ {
63
+ for (var field in this.formFields) {
64
+ this.formFields[field] = ('billing' + this.IdSeparator + field);
65
+ }
66
+ this.component_form =
67
+ {
68
+ // 'administrative_area_level_3': ['street1', 'long_name'],
69
+ // 'neighborhood': ['street1', 'long_name'],
70
+ // 'subpremise': ['street1', 'short_name'],
71
+ 'street_number': ['street1', 'short_name'],
72
+ 'route': ['street1', 'long_name'],
73
+ // 'sublocality': ['street2', 'long_name'],
74
+ // 'sublocality_level_1': ['street2', 'long_name'],
75
+ 'locality': ['city', 'long_name'],
76
+ //'administrative_area_level_1': [formFields.region, 'long_name'],
77
+ 'administrative_area_level_1': ['region_id', 'long_name'],
78
+ 'postal_code': ['postcode', 'short_name']
79
+ };
80
+ },
81
+ // [START region_fillform]
82
+ fillInAddress : function () {
83
+ this.clearFormValues();
84
+ // Get the place details from the autocomplete object.
85
+ var place = this.autocomplete.getPlace();
86
+ this.resetForm();
87
+ var type = '';
88
+ for (var field in place.address_components) {
89
+ for (var t in place.address_components[field].types)
90
+ {
91
+ for (var f in this.component_form) {
92
+ var types = place.address_components[field].types;
93
+ if(f == types[t])
94
+ {
95
+ if(f == "street_number")
96
+ {
97
+ this.streetNumber = place.address_components[field]['short_name'];
98
+ }
99
+
100
+ var prop = this.component_form[f][1];
101
+ if(place.address_components[field].hasOwnProperty(prop)){
102
+ this.formFieldsValue[this.component_form[f][0]] = place.address_components[field][prop];
103
+ }
104
+
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+ this.appendStreetNumber();
111
+ this.fillForm();
112
+ },
113
+
114
+ clearFormValues: function ()
115
+ {
116
+ for (var f in this.formFieldsValue) {
117
+ this.formFieldsValue[f] = '';
118
+ }
119
+ },
120
+ appendStreetNumber : function ()
121
+ {
122
+ if(this.streetNumber != '')
123
+ {
124
+ this.formFieldsValue['street1'] = this.streetNumber + ' '
125
+ + this.formFieldsValue['street1'];
126
+ }
127
+ },
128
+ fillForm : function()
129
+ {
130
+ for (var f in this.formFieldsValue) {
131
+ if(f == 'region_id' )
132
+ {
133
+ this.selectRegion( f,this.formFieldsValue[f]);
134
+ }
135
+ else
136
+ {
137
+ if(document.getElementById(('billing' + this.IdSeparator + f)) === null){
138
+ continue;
139
+ }
140
+ else
141
+ {
142
+ document.getElementById(('billing' + this.IdSeparator + f)).value = this.formFieldsValue[f];
143
+ }
144
+
145
+ }
146
+ }
147
+ },
148
+ selectRegion:function (id,regionText)
149
+ {
150
+ if(document.getElementById(('billing' + this.IdSeparator + id)) == null){
151
+ return false;
152
+ }
153
+ var el = document.getElementById(('billing' + this.IdSeparator + id));
154
+ for(var i=0; i<el.options.length; i++) {
155
+ if ( el.options[i].text == regionText ) {
156
+ el.selectedIndex = i;
157
+ break;
158
+ }
159
+ }
160
+ },
161
+ resetForm :function ()
162
+ {
163
+ if(document.getElementById(('billing' + this.IdSeparator + 'street2')) !== null){
164
+ document.getElementById(('billing' + this.IdSeparator + 'street2')).value = '';
165
+ }
166
+ },
167
+
168
+
169
+ setAutocompleteCountry : function () {
170
+
171
+ if(document.getElementById('billing:country_id') === null){
172
+ country = 'US';//change your codes for default country
173
+ }
174
+ else
175
+ {
176
+ var country = document.getElementById('billing:country_id').value;
177
+ }
178
+ this.autocomplete.setComponentRestrictions({ 'country': country });
179
+ }
180
+
181
+
182
+ }
183
+
184
+ window.addEventListener('load', function(){ SHIPITAUTOCOMPLETE.method.initialize() });
skin/frontend/base/default/js/shipit/onstepcheckout_shipping.js ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // This example displays an address form, using the autocomplete feature
2
+ // of the Google Places API to help users fill in the information.
3
+ // for shipping
4
+ "use strict";
5
+ var SHIPITAUTOCOMPLETE_SHIPPING = SHIPITAUTOCOMPLETE_SHIPPING || {};
6
+
7
+ SHIPITAUTOCOMPLETE_SHIPPING.event = {};
8
+ SHIPITAUTOCOMPLETE_SHIPPING.method = {
9
+ placeSearch: "", //
10
+ IdSeparator: "", //
11
+ autocomplete : "",
12
+ streetNumber : "",
13
+ formFields : {
14
+ 'street1': '',
15
+ 'street2': '',
16
+ 'city': '',
17
+ // 'region': '',
18
+ 'postcode': '',
19
+ 'region_id' : ''
20
+ },
21
+ formFieldsValue : {
22
+ 'street1': '',
23
+ 'street2': '',
24
+ 'city': '',
25
+ // 'region': '',
26
+ 'postcode': '',
27
+ 'region_id' : ''
28
+ },
29
+ component_form : "",
30
+
31
+ initialize: function(){
32
+ //init form
33
+ this.getIdSeparator();
34
+ this.initFormFields();
35
+
36
+ this.autocomplete = new google.maps.places.Autocomplete(
37
+ /** @type {HTMLInputElement} */(document.getElementById('shipping:street1')),
38
+ { types: ['geocode']});
39
+ // When the user selects an address from the dropdown,
40
+ // populate the address fields in the form.
41
+ google.maps.event.addListener(this.autocomplete, 'place_changed', function( event ) {SHIPITAUTOCOMPLETE_SHIPPING.method.fillInAddress()});
42
+ var shipping_address = document.getElementById("shipping:street1");
43
+ if(shipping_address != null){
44
+ shipping_address.addEventListener("focus", function( event ) {SHIPITAUTOCOMPLETE_SHIPPING.method.setAutocompleteCountry()}, true);
45
+ }
46
+
47
+ var shipping_country = document.getElementById("shipping:country_id");
48
+ if(shipping_country != null){
49
+ shipping_country.addEventListener("change", function( event ) {SHIPITAUTOCOMPLETE_SHIPPING.method.setAutocompleteCountry()}, true);
50
+ }
51
+
52
+
53
+ },
54
+ getIdSeparator : function() {
55
+ if (!document.getElementById('shipping:street1')) {
56
+ this.IdSeparator = "_";
57
+ return "_";
58
+ }
59
+ this.IdSeparator = ":";
60
+ return ":";
61
+ },
62
+ initFormFields: function ()
63
+ {
64
+ for (var field in this.formFields) {
65
+ this.formFields[field] = ('shipping' + this.IdSeparator + field);
66
+ }
67
+ this.component_form =
68
+ {
69
+ // 'administrative_area_level_3': ['street1', 'long_name'],
70
+ // 'neighborhood': ['street1', 'long_name'],
71
+ // 'subpremise': ['street1', 'short_name'],
72
+ 'street_number': ['street1', 'short_name'],
73
+ 'route': ['street1', 'long_name'],
74
+ // 'sublocality': ['street2', 'long_name'],
75
+ // 'sublocality_level_1': ['street2', 'long_name'],
76
+ 'locality': ['city', 'long_name'],
77
+ //'administrative_area_level_1': [formFields.region, 'long_name'],
78
+ 'administrative_area_level_1': ['region_id', 'long_name'],
79
+ 'postal_code': ['postcode', 'short_name']
80
+ };
81
+ },
82
+ // [START region_fillform]
83
+ fillInAddress : function () {
84
+ this.clearFormValues();
85
+ // Get the place details from the autocomplete object.
86
+ var place = this.autocomplete.getPlace();
87
+ this.resetForm();
88
+ var type = '';
89
+ for (var field in place.address_components) {
90
+ for (var t in place.address_components[field].types)
91
+ {
92
+ for (var f in this.component_form) {
93
+ var types = place.address_components[field].types;
94
+ if(f == types[t])
95
+ {
96
+ if(f == "street_number")
97
+ {
98
+ this.streetNumber = place.address_components[field]['short_name'];
99
+ }
100
+
101
+ var prop = this.component_form[f][1];
102
+ if(place.address_components[field].hasOwnProperty(prop)){
103
+ this.formFieldsValue[this.component_form[f][0]] = place.address_components[field][prop];
104
+ }
105
+
106
+ }
107
+ }
108
+ }
109
+ }
110
+
111
+ this.appendStreetNumber();
112
+ this.fillForm();
113
+ },
114
+
115
+ clearFormValues: function ()
116
+ {
117
+ for (var f in this.formFieldsValue) {
118
+ this.formFieldsValue[f] = '';
119
+ }
120
+ },
121
+ appendStreetNumber : function ()
122
+ {
123
+ if(this.streetNumber != '')
124
+ {
125
+ this.formFieldsValue['street1'] = this.streetNumber + ' '
126
+ + this.formFieldsValue['street1'];
127
+ }
128
+ },
129
+ fillForm : function()
130
+ {
131
+ for (var f in this.formFieldsValue) {
132
+ if(f == 'region_id' )
133
+ {
134
+ this.selectRegion( f,this.formFieldsValue[f]);
135
+ }
136
+ else
137
+ {
138
+ if(document.getElementById(('shipping' + this.IdSeparator + f)) === null){
139
+ continue;
140
+ }
141
+ else
142
+ {
143
+ document.getElementById(('shipping' + this.IdSeparator + f)).value = this.formFieldsValue[f];
144
+ }
145
+
146
+ }
147
+ }
148
+ },
149
+ selectRegion:function (id,regionText)
150
+ {
151
+ if(document.getElementById(('shipping' + this.IdSeparator + id)) == null){
152
+ return false;
153
+ }
154
+ var el = document.getElementById(('shipping' + this.IdSeparator + id));
155
+ for(var i=0; i<el.options.length; i++) {
156
+ if ( el.options[i].text == regionText ) {
157
+ el.selectedIndex = i;
158
+ break;
159
+ }
160
+ }
161
+ },
162
+ resetForm :function ()
163
+ {
164
+ if(document.getElementById(('shipping' + this.IdSeparator + 'street2')) !== null){
165
+ document.getElementById(('shipping' + this.IdSeparator + 'street2')).value = '';
166
+ }
167
+ },
168
+
169
+
170
+ setAutocompleteCountry : function () {
171
+
172
+ if(document.getElementById('shipping:country_id') === null){
173
+ country = 'US';//change your codes for default country
174
+ }
175
+ else
176
+ {
177
+ var country = document.getElementById('shipping:country_id').value;
178
+ }
179
+ this.autocomplete.setComponentRestrictions({ 'country': country });
180
+ }
181
+
182
+
183
+ }
184
+
185
+ window.addEventListener('load', function(){ SHIPITAUTOCOMPLETE_SHIPPING.method.initialize() });