bebe68374a49cb41b7c9219e97250044 - Version 1.2.0

Version Notes

Customer can check delivery status of his order.
* Track airwaybill number from multiple courier companies at one place.
* Track complete shipping status from confirm order to order delivery
* Shows shipment realtime status details.

Download this release

Release Info

Developer Onjection
Extension bebe68374a49cb41b7c9219e97250044
Version 1.2.0
Comparing to
See all releases


Version 1.2.0

app/code/local/Onj/Shipway/Block/Adminhtml/Couriermapping.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Onj_Shipway_Block_Adminhtml_Couriermapping extends Mage_Adminhtml_Block_Widget
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+
9
+
10
+ parent::__construct();
11
+ $this->setTemplate('shipway/couriermapping.phtml');
12
+ $this->setFormAction(Mage::getUrl('*/*/savecouriermapp'));
13
+
14
+ $this->_controller = 'adminhtml_shipway';
15
+ $this->_blockGroup = 'shipway';
16
+
17
+
18
+
19
+ }
20
+
21
+ }
22
+
23
+
24
+ ?>
app/code/local/Onj/Shipway/Block/Adminhtml/Shipway.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Onj_Shipway_Block_Adminhtml_Shipway extends Mage_Adminhtml_Block_Widget
3
+ {
4
+ public function __construct()
5
+ {
6
+
7
+
8
+ parent::__construct();
9
+ $this->setTemplate('shipway/shipway.phtml');
10
+ $this->setFormAction(Mage::getUrl('*/*/showdetails'));
11
+
12
+
13
+
14
+ $this->_controller = 'adminhtml_shipway';
15
+ $this->_blockGroup = 'shipway';
16
+
17
+ }
18
+ }
app/code/local/Onj/Shipway/Block/Links.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php class Onj_Shipway_Block_Links extends Mage_Page_Block_Template_Links_Block
2
+ {
3
+ /**
4
+ * Position in link list
5
+ * @var int
6
+ */
7
+ protected $_position = 120;
8
+
9
+ /**
10
+ * @return string
11
+ */
12
+ protected function _toHtml()
13
+ {
14
+ $text = $this->_createLabel($this->_getItemCount());
15
+ $this->_label = $text;
16
+ $this->_title = $text;
17
+ $this->_url = $this->getUrl('wishlist');
18
+ return parent::_toHtml();
19
+ }
20
+ protected function _getItemCount()
21
+ {
22
+ //this method should contain the logic to return the number you need
23
+ return 5;
24
+ }
25
+ //this generated the label
26
+ protected function _createLabel($count)
27
+ {
28
+ if ($count > 1) {
29
+ return $this->__('My Label (%d items)', $count);
30
+ } else if ($count == 1) {
31
+ return $this->__('My Label (%d item)', $count);
32
+ } else {
33
+ return $this->__('My Label');
34
+ }
35
+ }
36
+ }
37
+
38
+ ?>
app/code/local/Onj/Shipway/Block/Shipway.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Onj_Shipway_Block_Shipway extends Mage_Core_Block_Template
3
+ {
4
+ protected function _prepareLayout()
5
+ {
6
+ $this->setFormAction(Mage::getUrl('*/*/showdetails'));
7
+ return parent::_prepareLayout();
8
+ }
9
+
10
+
11
+ }
app/code/local/Onj/Shipway/Controllers/Adminhtml/ShipwayController.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Onj_Shipway_Adminhtml_ShipwayController extends Mage_Adminhtml_Controller_action
3
+ {
4
+
5
+
6
+ public function indexAction() {
7
+
8
+ $this->loadLayout();
9
+ $block = $this->getLayout()->createBlock('onj_shipway/adminhtml_shipway');
10
+ $this->getLayout()->getBlock('content')->append($block);
11
+ $this->renderLayout();
12
+ }
13
+ public function showdetailsAction(){
14
+
15
+ $data = $this->getRequest()->getPost();
16
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read');
17
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
18
+ $table='shipway';
19
+ $loginid=$data['loginid'];
20
+ $licencekey=$data['licencekey'];
21
+ $url = "http://shipway.in/api/authenticateUser";
22
+ $data_string = array(
23
+ "username" => $loginid,
24
+ "password" => $licencekey
25
+ );
26
+ $data_string = json_encode($data_string);
27
+ $curl = curl_init();
28
+ curl_setopt($curl, CURLOPT_HTTPHEADER, array(
29
+ 'Content-Type:application/json'
30
+ ));
31
+ curl_setopt($curl, CURLOPT_URL, $url);
32
+ curl_setopt($curl, CURLOPT_POST, true);
33
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
34
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
35
+ curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
36
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
37
+ $output = curl_exec($curl);
38
+ curl_close($curl);
39
+
40
+ $output = json_decode($output);
41
+ if(isset($output->status) && strtolower($output->status) == 'success'){
42
+ $query = "UPDATE {$table} SET loginid= '{$loginid}' , licencekey= '{$licencekey}' WHERE shipway_id = 1";
43
+ $write->query($query);
44
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('shipway')->__('Setting saved '));
45
+ }
46
+ else{
47
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('shipway')->__('Invalid Access'));
48
+
49
+ }
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+ $this->_redirect('*/*/index');
58
+
59
+ }
60
+
61
+ public function couriermappingAction(){
62
+
63
+
64
+ $this->loadLayout();
65
+ $block=$this->getLayout()->createblock('onj_shipway/adminhtml_couriermapping');
66
+ $this->getLayout()->getBlock('content')->append($block);
67
+ $this->renderLayout();
68
+ }
69
+
70
+ public function savecouriermappAction(){
71
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read');
72
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
73
+ $data = $this->getRequest()->getPost();
74
+ echo '<pre>';
75
+ //print_r($data); die;
76
+ //$read->fetchAll(" DELETE FROM shipway_couriermapping where 1 ");
77
+ $write->delete("shipway_couriermapping");
78
+
79
+ $i=1;
80
+ foreach($data['shipway'] as $key => $value){
81
+ $write->insert("shipway_couriermapping", array("id"=>$i,"default_courier"=>$key , "shipway_courierid"=>$value,"courier_type"=>"default"));
82
+ $i++;
83
+ }
84
+
85
+ foreach($data['shipway_customcourier_name'] as $key => $value){
86
+ if($value!=''){
87
+ $write->insert("shipway_couriermapping", array("id"=>$i,"default_courier"=>$value , "shipway_courierid"=>$data['shipway_courier_id'][$key],"courier_type"=>"custom"));
88
+ $i++;
89
+ }
90
+ }
91
+
92
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('shipway')->__('Courier has mapped '));
93
+
94
+
95
+ $this->_redirect('*/*/couriermapping');
96
+
97
+ }
98
+
99
+
100
+ }
101
+ ?>
app/code/local/Onj/Shipway/Controllers/ShipwayController.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Onj_Shipway_ShipwayController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function trackorderAction()
5
+ {
6
+ $this->loadLayout();
7
+ $block = $this->getLayout()->createBlock('onj_shipway/shipway','shipway');
8
+ $this->getLayout()->getBlock('content')->append($block);
9
+ $this->renderLayout();
10
+ }
11
+ public function showdetailsAction(){
12
+
13
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read');
14
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
15
+
16
+ $logindetail= $read->fetchAll("select * from shipway where shipway_id=1");
17
+ if(count($logindetail)){
18
+ $username = $logindetail[0]['loginid'];
19
+ $password = $logindetail[0]['licencekey'];
20
+ $data['hasAccount'] = true;
21
+ }
22
+ else{
23
+ $username = '';
24
+ $password = '';
25
+ $data['hasAccount'] = false;
26
+ echo "<p style='color:#BA1A1A;font-size:14px;'>Something went wrong.Please inform the website administrator.</p>";die;
27
+
28
+ }
29
+
30
+
31
+
32
+ if ($this->getRequest()->getPost()) {
33
+ $data= $this->getRequest()->getPost();
34
+ $status_result = '';
35
+
36
+
37
+ if (isset($data['order_id'])) {
38
+ $increment__id=$data['order_id'];
39
+ //$order = Mage::getModel('sales/order')->load($order__id);
40
+ $order = Mage::getModel('sales/order')->loadByIncrementId($increment__id);
41
+ $order__id=$order->getId();
42
+ foreach ($order->getTracksCollection() as $_track){
43
+ $track_no=$_track->getNumber();
44
+ $track_code=$_track->getCarrier_code();
45
+ $track_title=$_track->getTitle();
46
+ }
47
+ if($track_code!='custom'){
48
+ $courierDetail= $read->fetchAll("select * from shipway_couriermapping where default_courier='".$track_code."'");
49
+ }else{
50
+ $courierDetail= $read->fetchAll("select * from shipway_couriermapping where default_courier='".$track_title."'");
51
+ }
52
+ if(count($courierDetail)){
53
+ $shipway_carrier_id= $courierDetail[0]['shipway_courierid'];
54
+ }else{
55
+ $shipway_carrier_id= '';
56
+ }
57
+ }
58
+ if (!empty($track_no)) {
59
+ $awbno = $track_no;
60
+ $data['awbno'] = $awbno;
61
+ $data['carrier_name'] = $track_title;
62
+
63
+ $courier_id = $shipway_carrier_id;
64
+ $order_id = $order__id;
65
+
66
+ $status_result = $this->getAWBResults($username, $password, $courier_id, $awbno,$order_id);
67
+
68
+ $isJson = json_decode($status_result);
69
+ if(!empty($isJson) && strtolower($isJson->status) == 'failed'){
70
+ $status_result = "<p style='color:#BA1A1A;font-size:14px;'>Something went wrong.Please inform the website administrator.</p>";
71
+ }
72
+ } else {
73
+ $status_result = 'No tracking number associated with this order';
74
+ }
75
+
76
+ if ($status_result != '') {
77
+ $data['status_result'] = $status_result;
78
+ }
79
+
80
+ }
81
+ print_r($status_result);
82
+ }
83
+
84
+
85
+
86
+
87
+ public function getAWBResults($username, $password, $carrier_id, $awbno, $order_id)
88
+ {
89
+ $url = "http://shipway.in/api/getawbresult";
90
+ $data_string = array(
91
+ "username" => $username,
92
+ "password" => $password,
93
+ "carrier_id" => $carrier_id,
94
+ "awb" => $awbno,
95
+ "order_id" => $order_id
96
+ );
97
+ //print_r($data_string);
98
+ $data_string = json_encode($data_string);
99
+ $curl = curl_init();
100
+ curl_setopt($curl, CURLOPT_HTTPHEADER, array(
101
+ 'Content-Type:application/json'
102
+ ));
103
+ curl_setopt($curl, CURLOPT_URL, $url);
104
+ curl_setopt($curl, CURLOPT_POST, true);
105
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
106
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
107
+ curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
108
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
109
+ $output = curl_exec($curl);
110
+ curl_close($curl);
111
+ return $output;
112
+
113
+ }
114
+
115
+ }
116
+
117
+
118
+ ?>
app/code/local/Onj/Shipway/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Onj_Shipway_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/local/Onj/Shipway/Model/Mysql4/Shipway.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Onj_Shipway_Model_Mysql4_Shipway extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the shipway_id refers to the key field in your database table.
8
+ $this->_init('shipway/shipway', 'shipway_id');
9
+ }
10
+ }
app/code/local/Onj/Shipway/Model/Mysql4/Shipway/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Onj_Shipway_Model_Mysql4_Shipway_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('shipway/shipway');
9
+ }
10
+ }
app/code/local/Onj/Shipway/Model/Order/Shipment.php ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Onj_shipway_Model_Order_Shipment extends Mage_Sales_Model_Order_Shipment
4
+ {
5
+ protected function _afterSave()
6
+ {
7
+ if (null !== $this->_items) {
8
+ foreach ($this->_items as $item) {
9
+ $item->save();
10
+ }
11
+ }
12
+
13
+ if (null !== $this->_tracks) {
14
+ foreach($this->_tracks as $track) {
15
+ $track->save();
16
+ }
17
+ }
18
+
19
+ if (null !== $this->_comments) {
20
+ foreach($this->_comments as $comment) {
21
+ $comment->save();
22
+ }
23
+ }
24
+ $order__id=$this->getOrderId();
25
+ $order = Mage::getModel('sales/order')->load($order__id);
26
+ foreach ($order->getTracksCollection() as $_track){
27
+ $track_no=$_track->getNumber();
28
+ $track_code=$_track->getCarrier_code();
29
+ $track_title=$_track->getTitle();
30
+ }
31
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read');
32
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
33
+ if($track_code!='custom'){
34
+ $courierDetail= $read->fetchAll("select * from shipway_couriermapping where default_courier='".$track_code."'");
35
+ }else{
36
+ $courierDetail= $read->fetchAll("select * from shipway_couriermapping where default_courier='".$track_title."'");
37
+ }
38
+ $logindetail= $read->fetchAll("select * from shipway where shipway_id=1");
39
+ if(count($logindetail)){
40
+
41
+ $shipway_loginid= $logindetail[0]['loginid'];
42
+ $shipway_licencekey= $logindetail[0]['licencekey'];
43
+ }
44
+ else{
45
+ $shipway_loginid= '';
46
+ $shipway_licencekey= '';
47
+ }
48
+ if(count($courierDetail)){
49
+ $shipway_carrier_id= $courierDetail[0]['shipway_courierid'];
50
+ }else{
51
+ $shipway_carrier_id= '';
52
+ }
53
+ $data = array(
54
+ 'carrier_id' => $shipway_carrier_id,
55
+ 'order_id' => $order__id,
56
+ 'awb' => $track_no,
57
+ 'username' => $shipway_loginid,
58
+ 'password' => $shipway_licencekey
59
+ );
60
+ $this->assignAwb($data);
61
+ return parent::_afterSave();
62
+ }
63
+
64
+ public function assignAwb($data)
65
+ {
66
+
67
+ $order = Mage::getModel("sales/order")->load($data['order_id']);
68
+ $payment_code= $order->getPayment()->getMethodInstance()->getCode();
69
+ $pos = strpos($payment_code, 'cash');
70
+ $payment_type = 'P';
71
+ if( strpos($payment_code, 'cash')){
72
+ $payment_type = 'C';
73
+ }
74
+ $orderdetails['payment_type'] = $payment_type;
75
+ $orderdetails['payment_method'] = $payment_code;
76
+ $orderdetails['return_address'] = 'abc';
77
+
78
+ $orderTotalValue = number_format ($order->getGrandTotal(), 2, '.' , $thousands_sep = '');
79
+ $orderdetails['collectable_amount'] = $orderTotalValue;
80
+ $orderdetails['collectable_amount'] = ($payment_type == 'C') ? $orderTotalValue : 0;
81
+ $ordered_items = $order->getAllItems();
82
+ $itms='';
83
+ $products=array();
84
+ $orderdetails=array();
85
+ foreach($ordered_items as $item){
86
+ $products[]=array(
87
+ 'product_id'=> $item->getProductId(),
88
+ 'name'=> $item->getName(),
89
+ 'price'=> $item->getPrice(),
90
+ 'quantity'=> $item->getQtyOrdered(),
91
+ 'url'=> 'abc'
92
+ );
93
+
94
+ $itms .= $item->getName().' ';
95
+ }
96
+
97
+ $itms=substr($itms,0,35);
98
+ $shipping_address = $order->getShippingAddress();
99
+ $orderdetails=array(
100
+ 'order_id' => $data['order_id'],
101
+ 'order_date' => $order->getCreatedAt(),
102
+ 'firstname' => $shipping_address->getFirstname(),
103
+ 'lastname' =>$shipping_address->getLastname(),
104
+ 'email' => $shipping_address->getEmail(),
105
+ 'phone' => $shipping_address->getTelephone(),
106
+ 'address' => $shipping_address->getCity(),
107
+ 'city' => $shipping_address->getCity(),
108
+ 'state' => $shipping_address->getRegion(),
109
+ 'zipcode' => $shipping_address->getPostcode(),
110
+
111
+ 'country' => 'India',
112
+ 'products' => $products,
113
+ 'amount' => $orderTotalValue,
114
+ 'payment_type' => $payment_type,
115
+ 'payment_method' => $payment_code,
116
+ 'collectable_amount' => $orderTotalValue,
117
+ 'return_address' => 'abc',
118
+
119
+
120
+ );
121
+ $data['first_name'] = $shipping_address->getFirstname();
122
+ $data['last_name'] = $shipping_address->getLastname();
123
+ $data['email'] = $shipping_address->getEmail();
124
+ $data['phone'] = $shipping_address->getTelephone();
125
+ $data['products'] = $itms;
126
+ $data['company'] = 'Mairabazaar.com';
127
+ $data['order'] = $orderdetails;
128
+
129
+ $url = "http://shipway.in/api/pushOrderData";
130
+
131
+ $data_string = json_encode($data);
132
+ $curl = curl_init();
133
+ curl_setopt($curl, CURLOPT_HTTPHEADER, array(
134
+ 'Content-Type:application/json'
135
+ ));
136
+ curl_setopt($curl, CURLOPT_URL, $url);
137
+ curl_setopt($curl, CURLOPT_POST, true);
138
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
139
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
140
+ curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
141
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
142
+
143
+ $output = curl_exec($curl);
144
+ $output = json_decode($output);
145
+ curl_close($curl);
146
+ $result=(array)$output;
147
+
148
+ if($result['status']=='Failed '){
149
+ echo $result['message'];
150
+ }
151
+ else{
152
+ echo $result['message'];
153
+ }
154
+
155
+ }
156
+
157
+ }
158
+ ?>
app/code/local/Onj/Shipway/Model/Order/Shipment/Api.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Onj_shipway_Model_Order_Shipment_Api extends Mage_Sales_Model_Order_Shipment_Api
4
+ {
5
+
6
+
7
+ }
8
+ ?>
app/code/local/Onj/Shipway/Model/Shipway.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Onj_Shipway_Model_Shipway extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('shipway/shipway_order');
9
+ }
10
+ }
app/code/local/Onj/Shipway/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Onj_Shipway_Model_Status extends Varien_Object
4
+ {
5
+ const STATUS_ENABLED = 1;
6
+ const STATUS_DISABLED = 2;
7
+
8
+ static public function getOptionArray()
9
+ {
10
+ return array(
11
+ self::STATUS_ENABLED => Mage::helper('shipway')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('shipway')->__('Disabled')
13
+ );
14
+ }
15
+ }
app/code/local/Onj/Shipway/etc/config.xml ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Onj_Shipway>
5
+ <version>0.1.0</version>
6
+ </Onj_Shipway>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <shipway>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Onj_Shipway</module>
14
+ <frontName>shipway</frontName>
15
+ </args>
16
+ </shipway>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <shipway>
21
+ <file>shipway.xml</file>
22
+ </shipway>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <shipway>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>Onj_Shipway</module>
32
+ <frontName>shipway</frontName>
33
+ </args>
34
+ </shipway>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+ <menu>
39
+ <shipway module="shipway">
40
+ <title>Shipway Track</title>
41
+ <sort_order>71</sort_order>
42
+ <children>
43
+ <sub_menu1 module="shipway">
44
+ <title>Shipway Setting</title>
45
+ <sort_order>0</sort_order>
46
+ <action>shipway/adminhtml_shipway</action>
47
+ </sub_menu1>
48
+
49
+ <sub_menu2 module="shipway">
50
+ <title>Shipway Courier Mapping</title>
51
+ <sort_order>1</sort_order>
52
+ <action>shipway/adminhtml_shipway/couriermapping</action>
53
+ </sub_menu2>
54
+ </children>
55
+ </shipway>
56
+ </menu>
57
+ <acl>
58
+ <resources>
59
+ <all>
60
+ <title>Allow Everything</title>
61
+ </all>
62
+ <admin>
63
+ <children>
64
+ <Onj_Shipway>
65
+ <title>Shipway Module</title>
66
+ <sort_order>10</sort_order>
67
+ </Onj_Shipway>
68
+ </children>
69
+ </admin>
70
+ </resources>
71
+ </acl>
72
+ <layout>
73
+ <updates>
74
+ <shipway>
75
+ <file>shipway.xml</file>
76
+ </shipway>
77
+ </updates>
78
+ </layout>
79
+ </adminhtml>
80
+ <global>
81
+ <models>
82
+ <shipway>
83
+ <class>Onj_Shipway_Model</class>
84
+ <resourceModel>shipway_mysql4</resourceModel>
85
+ </shipway>
86
+ <shipway_mysql4>
87
+ <class>Onj_Shipway_Model_Mysql4</class>
88
+ <entities>
89
+ <shipway>
90
+ <table>shipway</table>
91
+ </shipway>
92
+ </entities>
93
+ </shipway_mysql4>
94
+ </models>
95
+ <resources>
96
+ <shipway_setup>
97
+ <setup>
98
+ <module>Onj_Shipway</module>
99
+ </setup>
100
+ <connection>
101
+ <use>core_setup</use>
102
+ </connection>
103
+ </shipway_setup>
104
+ <shipway_write>
105
+ <connection>
106
+ <use>core_write</use>
107
+ </connection>
108
+ </shipway_write>
109
+ <shipway_read>
110
+ <connection>
111
+ <use>core_read</use>
112
+ </connection>
113
+ </shipway_read>
114
+ </resources>
115
+ <blocks>
116
+ <shipway>
117
+ <class>Onj_Shipway_Block</class>
118
+ </shipway>
119
+ </blocks>
120
+ <helpers>
121
+ <shipway>
122
+ <class>Onj_Shipway_Helper</class>
123
+ </shipway>
124
+ </helpers>
125
+
126
+
127
+ <models>
128
+ <sales>
129
+ <rewrite>
130
+ <order_shipment>Onj_Shipway_Model_Order_Shipment</order_shipment>
131
+ </rewrite>
132
+ </sales>
133
+ </models>
134
+
135
+
136
+ <models>
137
+ <sales>
138
+ <rewrite>
139
+ <order_shipment_api>Onj_Shipway_Model_Order_Shipment_Api</order_shipment_api>
140
+ </rewrite>
141
+ </sales>
142
+ </models>
143
+
144
+
145
+
146
+ </global>
147
+ </config>
app/code/local/Onj/Shipway/sql/shipway_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ CREATE TABLE `shipway` (
10
+ `shipway_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
11
+ `loginid` varchar(255) NOT NULL DEFAULT '',
12
+ `licencekey` varchar(255) NOT NULL DEFAULT '',
13
+ `created_time` timestamp NULL DEFAULT NULL,
14
+ PRIMARY KEY (`shipway_id`)
15
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
16
+
17
+ CREATE TABLE IF NOT EXISTS `shipway_couriermapping` (
18
+ `id` int(255) NOT NULL,
19
+ `default_courier` varchar(255) NOT NULL,
20
+ `shipway_courierid` int(255) NOT NULL,
21
+ `courier_type` varchar(255) NOT NULL,
22
+ PRIMARY KEY (`id`)
23
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
24
+
25
+
26
+ INSERT INTO `shipway` (`shipway_id`, `loginid`, `licencekey`, `created_time`) VALUES
27
+ (1, '', '', '')
28
+ ");
29
+
30
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/shipway.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <adminhtml_sales_order_shipment_addtrack>
4
+ <reference name="content">
5
+ <block type="adminhtml/sales_order_shipment_view_tracking" name="shipment_tracking" >
6
+ <action method="setTemplate">
7
+ <template>shipway/tracking.phtml</template>
8
+ </action>
9
+
10
+ </block>
11
+ </reference>
12
+
13
+ </adminhtml_sales_order_shipment_addtrack>
14
+
15
+
16
+
17
+
18
+ <shipway_adminhtml_shipway_index>
19
+ <reference name="content">
20
+ <block type="shipway/adminhtml_shipway" name="shipway" template="shipway/shipway.phtml" />
21
+ </reference>
22
+ </shipway_adminhtml_shipway_index>
23
+
24
+ <shipway_adminhtml_shipway_couriermapping>
25
+ <reference name="content">
26
+ <block type="shipway/adminhtml_couriermapping" name="couriermapp" template="shipway/couriermapping.phtml"></block>
27
+
28
+ </reference>
29
+
30
+ </shipway_adminhtml_shipway_couriermapping>
31
+
32
+ </layout>
app/design/adminhtml/default/default/template/shipway/couriermapping.phtml ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read');
3
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
4
+
5
+ $logindetail= $read->fetchAll("select * from shipway where shipway_id=1");
6
+ $couriermap= $read->fetchAll("select * from shipway_couriermapping ");
7
+ $customecouriermap= $read->fetchAll("select * from shipway_couriermapping where courier_type='custom' ");
8
+ /* echo '<pre>';
9
+ print_r($customecouriermap);
10
+ echo '</pre>'; */
11
+ if(count($logindetail)){
12
+
13
+ $shipway_loginid= $logindetail[0]['loginid'];
14
+ $shipway_licencekey= $logindetail[0]['licencekey'];
15
+ }
16
+ else{
17
+ $shipway_loginid= '';
18
+ $shipway_licencekey= '';
19
+ }
20
+
21
+ ?>
22
+ <?php
23
+ $options = array();
24
+ $carrierInstances = Mage::getSingleton('shipping/config')->getAllCarriers( );
25
+ //$carriers['custom'] = Mage::helper('sales')->__('Custom Value');
26
+ foreach ($carrierInstances as $code => $carrier) {
27
+ if ($carrier->isTrackingAvailable()) {
28
+ $carriers_title = $carrier->getConfigData('title');
29
+ $options[] = array('value' => $code, 'label' => $carriers_title );
30
+ }
31
+ }
32
+ $url = "http://shipway.in/api/getcarrier";
33
+ $data_string = array(
34
+ "username" => $shipway_loginid,
35
+ "password" => $shipway_licencekey
36
+ );
37
+
38
+ $data_string = json_encode($data_string);
39
+ $curl = curl_init();
40
+ curl_setopt($curl, CURLOPT_HTTPHEADER, array(
41
+ 'Content-Type:application/json'
42
+ ));
43
+ curl_setopt($curl, CURLOPT_URL, $url);
44
+ curl_setopt($curl, CURLOPT_POST, true);
45
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
46
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
47
+ curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
48
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
49
+ $output = curl_exec($curl);
50
+
51
+ curl_close($curl);
52
+ $output = (array)json_decode($output);
53
+
54
+ ?>
55
+
56
+ <form action="<?php echo $this->getFormAction().'key/'.$this->getFormKey(); ?>" method="POST">
57
+ <div class="content-header">
58
+ <table cellspacing="0">
59
+ <tbody>
60
+ <tr>
61
+ <td style="width:50%;"><h3 class="icon-head head-sales-order">Shipway Courier Mapping</h3></td>
62
+ <td class="form-buttons"><button class="scalable" onclick="<?php echo $this->getFormAction(); ?>">Save Mapping</button></td>
63
+ </tr>
64
+ </tbody>
65
+ </table>
66
+ </div>
67
+
68
+ <div class="grid">
69
+ <h2>Shipway Courier Mapping</h2> <br>
70
+ <input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>" />
71
+
72
+ <table style=" width: 40%; float: left;" id="myTable">
73
+ <tr>
74
+ <th>Courier Name</th><th>Shipway Courier</th>
75
+ </tr>
76
+ <?php foreach($options as $key1 => $value){ ?>
77
+ <tr>
78
+ <td><?php echo $options[$key1]['label']?></td>
79
+ <td>
80
+ <select name="shipway[<?php echo $options[$key1]['value']?>]">
81
+ <option value="">Select courier</option>
82
+ <?php foreach($output as $key => $carrier_name){?>
83
+ <option value="<?php echo $key; ?>" <?php if($couriermap[$key1]['shipway_courierid']==$key){echo "selected";}?>><?php echo ucfirst($carrier_name);?></option>
84
+ <?php } ?>
85
+ </select>
86
+ </td>
87
+ </tr>
88
+ <?php } ?>
89
+ <?php foreach($customecouriermap as $key1 => $value){ ?>
90
+ <tr>
91
+ <td><input type="text" name="shipway_customcourier_name[]" value="<?php echo $customecouriermap[$key1]['default_courier']?>"></td>
92
+ <td>
93
+ <select name="shipway_courier_id[]">
94
+ <option value="">Select courier</option>
95
+ <?php foreach($output as $key => $carrier_name){?>
96
+ <option value="<?php echo $key; ?>" <?php if($customecouriermap[$key1]['shipway_courierid']==$key){echo "selected";}?>><?php echo ucfirst($carrier_name);?></option>
97
+ <?php } ?>
98
+ </select>
99
+ </td>
100
+ </tr>
101
+ <?php } ?>
102
+ </table>
103
+ </div>
104
+ <div style="clear:both;"></div>
105
+ <div style="margin-top:20px; margin-left: 30%;"><input type="button" class="addCF" onclick="addcustomcourier();" value="Add Custom Courier" ></div>
106
+ </form>
107
+ <script>
108
+ function addcustomcourier(){
109
+
110
+ //$('#myTable').append('<tr><td>my data</td><td>more data</td></tr>');
111
+ var table = document.getElementById("myTable");
112
+
113
+ // Create an empty <tr> element and add it to the 1st position of the table:
114
+ var row = table.insertRow(-1);
115
+
116
+ // Insert new cells (<td> elements) at the 1st and 2nd position of the "new" <tr> element:
117
+ var cell1 = row.insertCell(0);
118
+ var cell2 = row.insertCell(1);
119
+
120
+ // Add some text to the new cells:
121
+ cell1.innerHTML = "<input type='text' placeholder='custom courier' name='shipway_customcourier_name[]'>";
122
+ var html="";
123
+ html+='<select name="shipway_courier_id[]">';
124
+ <?php foreach ($output as $key=> $carrier_name) { ?>
125
+ html += '<option value="<?php echo $key; ?>"><?php echo ucfirst($carrier_name);?></option>';
126
+ <?php } ?>
127
+ html+='</select>';
128
+ cell2.innerHTML = html;
129
+ }
130
+
131
+ </script>
132
+
133
+
app/design/adminhtml/default/default/template/shipway/shipway.phtml ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read');
3
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
4
+
5
+ $logindetail= $read->fetchAll("select * from shipway where shipway_id=1");
6
+ if(count($logindetail)){
7
+
8
+ $shipway_loginid= $logindetail[0]['loginid'];
9
+ $shipway_licencekey= $logindetail[0]['licencekey'];
10
+ }
11
+ else{
12
+ $shipway_loginid= '';
13
+ $shipway_licencekey= '';
14
+ }
15
+ ?>
16
+ <form action="<?php echo $this->getFormAction().'key/'.$this->getFormKey(); ?>" onSubmit="return checkvalue();" method="POST">
17
+
18
+ <div class="content-header">
19
+ <table cellspacing="0">
20
+ <tbody><tr>
21
+ <td style="width:50%;"><h3 class="icon-head head-sales-order">Shipway Setting</h3></td>
22
+ <td class="form-buttons"></td>
23
+
24
+ </tr>
25
+ </tbody></table>
26
+ </div>
27
+
28
+ <div class="grid">
29
+
30
+ <h2>Shipway Setting</h2> <br>
31
+ <input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>" />
32
+
33
+ <div class="tab-pane active" id="tab-general">
34
+ <style>
35
+ .register_block{font-size: 15px;margin: 10px 0px 27px 0px;}
36
+ .register_block a.btn{background-color: #1e91cf;color: #fff;padding: 5px 15px;font-size: 15px;border-radius: 3px;}
37
+ </style>
38
+ <p class="register_block">
39
+ <a href="http://shipway.in/admin/index.php/auth/register" target="_blank" class="btn">Register</a> here for free courier tracking.
40
+ </p>
41
+ <div class="form-group required">
42
+ <label class="col-sm-2 control-label" for="input-name">Login ID</label>
43
+ <div class="col-sm-10">
44
+ <input type="text" name="loginid" value="<?php echo $shipway_loginid; ?>" placeholder="Login ID" id="loginid" class="form-control" style="width:200px;">
45
+
46
+ </div>
47
+ </div>
48
+ <div class="form-group required">
49
+ <label class="col-sm-2 control-label" for="input-name">Licence Key</label>
50
+ <div class="col-sm-10">
51
+ <input type="text" name="licencekey" value="<?php echo $shipway_licencekey; ?>" placeholder="Licence Key" id="licencekey" class="form-control" style="width:200px;">
52
+ <?php if ($error_licencekey) { ?>
53
+ <div class="text-danger"><?php echo $error_licencekey; ?></div>
54
+ <?php } ?>
55
+ </div>
56
+ </div>
57
+ </div></br>
58
+ <button class="scalable" onclick="<?php echo $this->getFormAction(); ?>">Assign</button>
59
+ </div>
60
+ </form>
61
+ <script>
62
+
63
+ function checkvalue(){
64
+
65
+ alert("hello");
66
+ //var login=$( "#loginid").val();
67
+ var login=document.getElementById("loginid").value;
68
+ var licencekey=document.getElementById("licencekey").value;
69
+
70
+ if(login=='' || licencekey=='' ){
71
+ alert("Please fill the mandatory Filled");
72
+ return false;
73
+ }
74
+
75
+ }
76
+
77
+ </script>
78
+
app/design/adminhtml/default/default/template/shipway/tracking.phtml ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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@magento.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.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php /** @var $this Mage_Adminhtml_Block_Sales_Order_Shipment_View_Tracking */ ?>
28
+ <div class="field-row grid" id="shipment_tracking_info">
29
+ <table cellspacing="0" class="data">
30
+ <col width="100" />
31
+ <col />
32
+ <col />
33
+ <col width="80" />
34
+ <thead>
35
+ <tr class="headings">
36
+ <th><?php echo Mage::helper('sales')->__('Carrier') ?></th>
37
+ <th><?php echo Mage::helper('sales')->__('Title') ?></th>
38
+ <th><?php echo Mage::helper('sales')->__('Number') ?></th>
39
+ <th class="last"><?php echo Mage::helper('sales')->__('Action') ?></th>
40
+ </tr>
41
+ </thead>
42
+ <tfoot>
43
+ <tr>
44
+ <td>
45
+ <select name="carrier" class="select" style="width:110px" onchange="selectCarrier(this)">
46
+ <?php foreach ($this->getCarriers() as $_code=>$_name): ?>
47
+ <option value="<?php echo $_code ?>"><?php echo $this->escapeHtml($_name) ?></option>
48
+ <?php endforeach; ?>
49
+ <option value="shipway_delhivery">Shipway Delhivery</option>
50
+ <option value="shipway_bluedart">Shipway Bluedart</option>
51
+ </select>
52
+ </td>
53
+ <td><input class="input-text" type="text" id="tracking_title" name="title" value="" /></td>
54
+ <td><input class="input-text" type="text" id="tracking_number" name="number" value="" /></td>
55
+ <td class="last"><?php echo $this->getSaveButtonHtml() ?></td>
56
+ </tr>
57
+ </tfoot>
58
+ <?php if($_tracks = $this->getShipment()->getAllTracks()): ?>
59
+ <tbody>
60
+ <?php $i=0;foreach ($_tracks as $_track):$i++ ?>
61
+ <tr class="<?php echo ($i%2==0)?'even':'odd' ?>">
62
+ <td><?php echo $this->escapeHtml($this->getCarrierTitle($_track->getCarrierCode())) ?></td>
63
+ <td><?php echo $this->escapeHtml($_track->getTitle()) ?></td>
64
+ <td>
65
+ <?php if ($_track->isCustom()): ?>
66
+ <?php echo $this->escapeHtml($_track->getNumber()) ?>
67
+ <?php else: ?>
68
+ <a href="#" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_track) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')"><?php echo $this->escapeHtml($_track->getNumber()) ?></a>
69
+ <div id="shipment_tracking_info_response_<?php echo $_track->getId() ?>"></div>
70
+ <?php endif; ?>
71
+ </td>
72
+ <td class="last"><a href="#" onclick="deleteTrackingNumber('<?php echo $this->getRemoveUrl($_track) ?>'); return false;"><?php echo Mage::helper('sales')->__('Delete') ?></a></td>
73
+ </tr>
74
+ <?php endforeach; ?>
75
+ </tbody>
76
+ <?php endif; ?>
77
+ </table>
78
+ </div>
79
+ <script type="text/javascript">
80
+ //<![CDATA[
81
+ function selectCarrier(elem) {
82
+ var option = elem.options[elem.selectedIndex];
83
+ $('tracking_title').value = option.value && option.value != 'custom' ? option.text : '';
84
+ }
85
+
86
+ function deleteTrackingNumber(url) {
87
+ if (confirm('<?php echo Mage::helper('sales')->__('Are you sure?') ?>')) {
88
+ submitAndReloadArea($('shipment_tracking_info').parentNode, url)
89
+ }
90
+ }
91
+ //]]>
92
+ </script>
app/design/frontend/base/default/layout/shipway.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <layout version="0.1.0">
2
+
3
+ <shipway_shipway_trackorder>
4
+ <reference name="content">
5
+ <block type="shipway/shipway" name="shipway1" template="shipway/trackorder.phtml"/>
6
+ </reference>
7
+ </shipway_shipway_trackorder>
8
+ <default>
9
+ <reference name="top.links">
10
+ <block type="shipway/links" name="shipway_link" />
11
+ <action method="addLinkBlock"><blockName>shipway_link</blockName></action>
12
+ </reference>
13
+
14
+ <reference name="footer_links">
15
+ <action method="addLink" translate="label title" module="shipway" >
16
+ <label>Track Order</label>
17
+ <url>shipway/shipway/trackorder</url>
18
+ <title>Contact Us</title>
19
+ <prepare>true</prepare>
20
+ </action>
21
+ </reference>
22
+ </default>
23
+
24
+
25
+
26
+ </layout>
app/design/frontend/base/default/template/shipway/trackorder.phtml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php
3
+ $url = $this->getFormAction();
4
+
5
+ ?>
6
+ <script type="text/javascript">
7
+
8
+ // Please add jquery library if it is not included in your Magento.
9
+
10
+ jQuery.noConflict();
11
+ jQuery(document).ready(function(){
12
+ jQuery('#submit_cod').click(function(){
13
+ jQuery(".pin-loading").show();
14
+ var postcode = jQuery('#order_id').val();
15
+ if(postcode != ''){
16
+ jQuery.ajax({
17
+ url: "<?php echo $url; ?>",
18
+ type: "POST",
19
+ data: {order_id : postcode,submit_cod:'submit_cod'},
20
+ dataType: "html",
21
+ success:function(data){
22
+ jQuery('#result').html(data);
23
+ }
24
+ });
25
+ }
26
+ else{
27
+ alert("Please enter a valid Order Id");
28
+ }
29
+ });});
30
+ </script>
31
+
32
+
33
+ <div id="shipway_track_wrapper" style=" text-align: center;" >
34
+ <form id="form" method="post" style="margin:0 auto;" >
35
+ <fieldset>
36
+ <h2 style=" font-size: 18px;">Track Your Shipment Status</h2><br>
37
+ <p><b>Order ID: </b><input type="text" name="order_id" id="order_id" value="">
38
+ <input type="button" id="submit_cod" value="Track" name="btnSubmit"></p>
39
+ </fieldset>
40
+ </form>
41
+ </div>
42
+ </br>
43
+ <span id="result"></span>
app/etc/modules/Onj_Shipway.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Onj_Shipway>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Onj_Shipway>
8
+ </modules>
9
+ </config>
10
+
package.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>bebe68374a49cb41b7c9219e97250044</name>
4
+ <version>1.2.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.gnu.org/licenses/gpl-2.0.html">bebe68374a49cb41b7c9219e97250044</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Customer can check delivery status of his order.&#xD;
10
+ * Track airwaybill number from multiple courier companies at one place.&#xD;
11
+ * Track complete shipping status from confirm order to order delivery&#xD;
12
+ * Shows shipment realtime status details.</summary>
13
+ <description>Customer can check delivery status of his order.&#xD;
14
+ * Track airwaybill number from multiple courier companies at one place.&#xD;
15
+ * Track complete shipping status from confirm order to order delivery&#xD;
16
+ * Shows shipment realtime status details.</description>
17
+ <notes>Customer can check delivery status of his order.&#xD;
18
+ * Track airwaybill number from multiple courier companies at one place.&#xD;
19
+ * Track complete shipping status from confirm order to order delivery&#xD;
20
+ * Shows shipment realtime status details.</notes>
21
+ <authors><author><name>Onjection</name><user>MAG003087332</user><email>contact@onjection.com</email></author></authors>
22
+ <date>2015-08-03</date>
23
+ <time>13:22:23</time>
24
+ <contents><target name="magelocal"><dir name="Onj"><dir name="Shipway"><dir name="Block"><dir name="Adminhtml"><file name="Couriermapping.php" hash="d77c31b0a89a6f985cd61ec5dbb3575f"/><file name="Shipway.php" hash="154c775dad05556a12857f4b861e3f2e"/></dir><file name="Links.php" hash="0c28356d35f7ef9b45bea3e85c31c67c"/><file name="Shipway.php" hash="ba7fcdccefe24bee0a1d3329d8b6ff0e"/></dir><dir name="Controllers"><dir name="Adminhtml"><file name="ShipwayController.php" hash="e05ca30aa09ac7add2926b34d380dec9"/></dir><file name="ShipwayController.php" hash="141219e517f3d5b456b95ca1696f7470"/></dir><dir name="Helper"><file name="Data.php" hash="5e312e5e18490879cafe8b1e67ca05f8"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Shipway"><file name="Collection.php" hash="49087bbcb6c2ee8def6c822b2148405a"/></dir><file name="Shipway.php" hash="23a0b6e3de14bb7b6dd611b412b1762b"/></dir><dir name="Order"><dir name="Shipment"><file name="Api.php" hash="4474a6d9ba04e4d8d4038b79c78bccbb"/></dir><file name="Shipment.php" hash="e10833a2724cc2d8fea8faf59da36956"/></dir><file name="Shipway.php" hash="ef7453c11874f110c9155d0c4bd62fa0"/><file name="Status.php" hash="784c25834a82e048211f967f27290b5a"/></dir><dir name="etc"><file name="config.xml" hash="b6e85a1fb1559660c21ca933530edb46"/></dir><dir name="sql"><dir name="shipway_setup"><file name="mysql4-install-0.1.0.php" hash="51dd245ed35fb5ad95f9de9372df748d"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="shipway.xml" hash="491feaf7c6365c72b491efa3bca25f1d"/></dir><dir name="template"><dir name="shipway"><file name="couriermapping.phtml" hash="8156c82adcca4e3f19649646a7809a54"/><file name="shipway.phtml" hash="b8d5038a1577a6a5c4cbd024fb5a11cc"/><file name="tracking.phtml" hash="7555fa99cf112a1b9f01ff7e0736b044"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="shipway"><file name="trackorder.phtml" hash="a7b3b2f5ff899e557ea540cd4a1c1ec1"/></dir></dir><dir name="layout"><file name="shipway.xml" hash="f2388d82e8b0f62531f8b863c40c6508"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Onj_Shipway.xml" hash="d00ab0309ff5e932997e9f6eea950c49"/></dir></target></contents>
25
+ <compatible/>
26
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_core_onjection</name><channel>community</channel><min>1.7.0</min><max>1.9.0.0</max></package></required></dependencies>
27
+ </package>