4f4e331f92f560de38f6bc2b5501d8cb - Version 1.0.1

Version Notes

Stable release

Download this release

Release Info

Developer Roman Barbotkin
Extension 4f4e331f92f560de38f6bc2b5501d8cb
Version 1.0.1
Comparing to
See all releases


Code changes from version 1.0.0 to 1.0.1

app/code/local/Send24/Shipping/Model/Carrier.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  class Send24_Shipping_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
4
 
5
  protected $_code = 'send24_shipping';
@@ -25,6 +28,204 @@ class Send24_Shipping_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract
25
  }
26
 
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  public function after_order_placed($observer) {
29
  $incrementId = $observer->getOrder()->getIncrementId();
30
  // DK.
@@ -32,7 +233,7 @@ class Send24_Shipping_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract
32
  $postcode = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->getPostcode();
33
  $send24_consumer_key = $this->getConfigData('send24_consumer_key');
34
  $send24_consumer_secret = $this->getConfigData('send24_consumer_secret');
35
- $auth = base64_encode($send24_consumer_secret.':'.$send24_consumer_key);
36
  $select_country = 'Ekspres';
37
 
38
  // get/check Express.
@@ -120,13 +321,53 @@ class Send24_Shipping_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract
120
  ->setCreatedAt(date('Y-m-d H:i:s', time() - 60*60*24));
121
 
122
  $observer->getOrder()->addStatusHistory($history);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  $observer->getOrder()->save();
124
  return true;
125
  }
126
 
127
 
128
-
129
-
130
  protected function _getExpressShippingRate() {
131
  $rate = Mage::getModel('shipping/rate_result_method');
132
  // DK
@@ -135,10 +376,10 @@ class Send24_Shipping_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract
135
 
136
  $send24_consumer_key = $this->getConfigData('send24_consumer_key');
137
  $send24_consumer_secret = $this->getConfigData('send24_consumer_secret');
138
- $auth = base64_encode($send24_consumer_secret.':'.$send24_consumer_key);
139
  $select_country = 'Ekspres';
140
 
141
- // get/check Express.
142
  $ch = curl_init();
143
  curl_setopt($ch, CURLOPT_URL, "https://send24.com/wc-api/v3/get_products");
144
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
@@ -149,97 +390,124 @@ class Send24_Shipping_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract
149
  ));
150
  $send24_countries = json_decode(curl_exec($ch));
151
  curl_close($ch);
152
- $n = count($send24_countries);
153
- for ($i = 0; $i < $n; $i++)
154
- {
155
- if ($send24_countries[$i]->title == $select_country)
156
- {
157
- $coast = $send24_countries[$i]->price;
158
- $product_id = $send24_countries[$i]->product_id;
159
- $i = $n;
160
- $is_available = true;
161
- }else{
162
- $is_available = false;
163
- }
164
- }
165
-
166
- if($is_available == true){
167
- //////////////
168
- $shipping_address_1 = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->getData('street');
169
- $shipping_postcode = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->getPostcode();
170
- $shipping_city = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->getCity();
171
- $shipping_country = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->getCountry();
172
- if($shipping_country == 'DK'){
173
- $shipping_country = 'Denmark';
174
  }
175
 
176
- $ch = curl_init();
177
- curl_setopt($ch, CURLOPT_URL, "https://send24.com/wc-api/v3/get_user_id");
178
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
179
- curl_setopt($ch, CURLOPT_HEADER, FALSE);
180
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
181
- "Content-Type: application/json",
182
- "Authorization: Basic ".$auth
183
- ));
184
- $user_meta = json_decode(curl_exec($ch));
185
-
186
- $billing_address_1 = $user_meta->billing_address_1['0'];
187
- $billing_postcode = $user_meta->billing_postcode['0'];
188
- $billing_city = $user_meta->billing_city['0'];
189
- $billing_country = $user_meta->billing_country['0'];
190
- if($billing_country == 'DK'){
191
- $billing_country = 'Denmark';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  }
193
-
194
- $full_billing_address = "$billing_address_1, $billing_postcode $billing_city, $billing_country";
195
- $full_shipping_address = "$shipping_address_1, $shipping_postcode $shipping_city, $shipping_country";
196
-
197
- // Get billing coordinates.
198
- $billing_url = "http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=".urlencode($full_billing_address);
199
- $billing_latlng = get_object_vars(json_decode(file_get_contents($billing_url)));
200
- $billing_lat = $billing_latlng['results'][0]->geometry->location->lat;
201
- $billing_lng = $billing_latlng['results'][0]->geometry->location->lng;
202
-
203
- // Get shipping coordinates.
204
- $shipping_url = "http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=".urlencode($full_shipping_address);
205
- $shipping_latlng = get_object_vars(json_decode(file_get_contents($shipping_url)));
206
- $shipping_lat = $shipping_latlng['results'][0]->geometry->location->lat;
207
- $shipping_lng = $shipping_latlng['results'][0]->geometry->location->lng;
208
-
209
- // get_is_driver_area_five_km
210
- $ch = curl_init();
211
- curl_setopt($ch, CURLOPT_URL, "https://send24.com/wc-api/v3/get_is_driver_area_five_km");
212
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
213
- curl_setopt($ch, CURLOPT_HEADER, FALSE);
214
- curl_setopt($ch, CURLOPT_POST, TRUE);
215
- curl_setopt($ch, CURLOPT_POSTFIELDS, '
216
- {
217
- "billing_lat": "'.$billing_lat.'",
218
- "billing_lng": "'.$billing_lng.'",
219
- "shipping_lat": "'.$shipping_lat.'",
220
- "shipping_lng": "'.$shipping_lng.'"
221
- }
222
- ');
223
-
224
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
225
- "Content-Type: application/json",
226
- "Authorization: Basic ".$auth
227
- ));
228
-
229
- $response = curl_exec($ch);
230
- $res = json_decode($response);
231
- if(!empty($res)){
232
- $rate->setCarrier($this->_code);
233
- $rate->setCarrierTitle($this->getConfigData('title'));
234
- $rate->setMethod('express');
235
- $rate->setMethodTitle('Send24 Sameday(ETA: '.$res->time.') - ');
236
- $rate->setPrice($coast);
237
- $rate->setCost(0);
238
- }
239
-
240
- curl_close($ch);
241
- // print_r($full_billing_address);
242
- return $rate;
243
  }
244
  // die;
245
 
1
  <?php
2
 
3
+ ini_set("display_errors",1);
4
+ error_reporting(E_ALL);
5
+
6
  class Send24_Shipping_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
7
 
8
  protected $_code = 'send24_shipping';
28
  }
29
 
30
 
31
+ public function toOptionArray()
32
+ {
33
+ return array(
34
+ array(
35
+ 'value' => '00:00',
36
+ 'label' => '00:00'
37
+ ),
38
+ array(
39
+ 'value' => '00:30',
40
+ 'label' => '00:30'
41
+ ),
42
+ array(
43
+ 'value' => '01:00',
44
+ 'label' => '01:00'
45
+ ),
46
+ array(
47
+ 'value' => '01:30',
48
+ 'label' => '01:30'
49
+ ),
50
+ array(
51
+ 'value' => '02:00',
52
+ 'label' => '02:00'
53
+ ),
54
+ array(
55
+ 'value' => '02:30',
56
+ 'label' => '02:30'
57
+ ),
58
+ array(
59
+ 'value' => '03:00',
60
+ 'label' => '03:00'
61
+ ),
62
+ array(
63
+ 'value' => '03:30',
64
+ 'label' => '03:30'
65
+ ),
66
+ array(
67
+ 'value' => '04:00',
68
+ 'label' => '04:00'
69
+ ),
70
+ array(
71
+ 'value' => '04:30',
72
+ 'label' => '04:30'
73
+ ),
74
+ array(
75
+ 'value' => '05:00',
76
+ 'label' => '05:00'
77
+ ),
78
+ array(
79
+ 'value' => '05:30',
80
+ 'label' => '05:30'
81
+ ),
82
+ array(
83
+ 'value' => '06:00',
84
+ 'label' => '06:00'
85
+ ),
86
+ array(
87
+ 'value' => '06:30',
88
+ 'label' => '06:30'
89
+ ),
90
+ array(
91
+ 'value' => '07:00',
92
+ 'label' => '07:00'
93
+ ),
94
+ array(
95
+ 'value' => '07:30',
96
+ 'label' => '07:30'
97
+ ),
98
+ array(
99
+ 'value' => '08:00',
100
+ 'label' => '08:00'
101
+ ),
102
+ array(
103
+ 'value' => '08:30',
104
+ 'label' => '08:30'
105
+ ),
106
+ array(
107
+ 'value' => '09:00',
108
+ 'label' => '09:00'
109
+ ),
110
+ array(
111
+ 'value' => '09:30',
112
+ 'label' => '09:30'
113
+ ),
114
+ array(
115
+ 'value' => '10:00',
116
+ 'label' => '10:00'
117
+ ),
118
+ array(
119
+ 'value' => '10:30',
120
+ 'label' => '10:30'
121
+ ),
122
+ array(
123
+ 'value' => '11:00',
124
+ 'label' => '11:00'
125
+ ),
126
+ array(
127
+ 'value' => '11:30',
128
+ 'label' => '11:30'
129
+ ),
130
+ array(
131
+ 'value' => '12:00',
132
+ 'label' => '12:00'
133
+ ),
134
+ array(
135
+ 'value' => '12:30',
136
+ 'label' => '12:30'
137
+ ),
138
+ array(
139
+ 'value' => '13:00',
140
+ 'label' => '13:00'
141
+ ),
142
+ array(
143
+ 'value' => '13:30',
144
+ 'label' => '13:30'
145
+ ),
146
+ array(
147
+ 'value' => '14:00',
148
+ 'label' => '14:00'
149
+ ),
150
+ array(
151
+ 'value' => '14:30',
152
+ 'label' => '14:30'
153
+ ),
154
+ array(
155
+ 'value' => '15:00',
156
+ 'label' => '15:00'
157
+ ),
158
+ array(
159
+ 'value' => '15:30',
160
+ 'label' => '15:30'
161
+ ),
162
+ array(
163
+ 'value' => '16:00',
164
+ 'label' => '16:00'
165
+ ),
166
+ array(
167
+ 'value' => '16:30',
168
+ 'label' => '16:30'
169
+ ),
170
+ array(
171
+ 'value' => '17:00',
172
+ 'label' => '17:00'
173
+ ),
174
+ array(
175
+ 'value' => '17:30',
176
+ 'label' => '17:30'
177
+ ),
178
+ array(
179
+ 'value' => '18:00',
180
+ 'label' => '18:00'
181
+ ),
182
+ array(
183
+ 'value' => '18:30',
184
+ 'label' => '18:30'
185
+ ),
186
+ array(
187
+ 'value' => '19:00',
188
+ 'label' => '19:00'
189
+ ),
190
+ array(
191
+ 'value' => '19:30',
192
+ 'label' => '19:30'
193
+ ),
194
+ array(
195
+ 'value' => '20:00',
196
+ 'label' => '20:00'
197
+ ),
198
+ array(
199
+ 'value' => '20:30',
200
+ 'label' => '20:30'
201
+ ),
202
+ array(
203
+ 'value' => '21:00',
204
+ 'label' => '21:00'
205
+ ),
206
+ array(
207
+ 'value' => '21:30',
208
+ 'label' => '21:30'
209
+ ),
210
+ array(
211
+ 'value' => '22:00',
212
+ 'label' => '22:00'
213
+ ),
214
+ array(
215
+ 'value' => '22:30',
216
+ 'label' => '22:30'
217
+ ),
218
+ array(
219
+ 'value' => '23:00',
220
+ 'label' => '23:00'
221
+ ),
222
+ array(
223
+ 'value' => '23:30',
224
+ 'label' => '23:30'
225
+ ),
226
+ );
227
+ }
228
+
229
  public function after_order_placed($observer) {
230
  $incrementId = $observer->getOrder()->getIncrementId();
231
  // DK.
233
  $postcode = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->getPostcode();
234
  $send24_consumer_key = $this->getConfigData('send24_consumer_key');
235
  $send24_consumer_secret = $this->getConfigData('send24_consumer_secret');
236
+ $auth = base64_encode($send24_consumer_key.':'.$send24_consumer_secret);
237
  $select_country = 'Ekspres';
238
 
239
  // get/check Express.
321
  ->setCreatedAt(date('Y-m-d H:i:s', time() - 60*60*24));
322
 
323
  $observer->getOrder()->addStatusHistory($history);
324
+ // Create custom value for order.
325
+ // it temporarily
326
+ require_once('app/Mage.php');
327
+ Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
328
+ $installer = new Mage_Sales_Model_Mysql4_Setup;
329
+ $attribute_track_parsel = array(
330
+ 'type' => 'varchar',
331
+ 'backend_type' => 'varchar',
332
+ 'frontend_input' => 'varchar',
333
+ 'is_user_defined' => true,
334
+ 'label' => 'Send24 Track Parsel',
335
+ 'visible' => false,
336
+ 'required' => false,
337
+ 'user_defined' => false,
338
+ 'searchable' => false,
339
+ 'filterable' => false,
340
+ 'comparable' => false,
341
+ 'default' => ''
342
+ );
343
+ $attribute_printout = array(
344
+ 'type' => 'text',
345
+ 'backend_type' => 'text',
346
+ 'frontend_input' => 'text',
347
+ 'is_user_defined' => true,
348
+ 'label' => 'Send24 Printout',
349
+ 'visible' => false,
350
+ 'required' => false,
351
+ 'user_defined' => false,
352
+ 'searchable' => false,
353
+ 'filterable' => false,
354
+ 'comparable' => false,
355
+ 'default' => ''
356
+ );
357
+ $installer->addAttribute('order', 'send24_track_parsel', $attribute_track_parsel);
358
+ $installer->addAttribute('order', 'send24_printout', $attribute_printout);
359
+ $installer->endSetup();
360
+ // Add Track parsel.
361
+ $observer->getOrder()->setSend24TrackParsel($response_order['track']);
362
+ // Add Printout.
363
+ $printout = json_encode($response_order);
364
+ $observer->getOrder()->setSend24Printout($printout);
365
+
366
  $observer->getOrder()->save();
367
  return true;
368
  }
369
 
370
 
 
 
371
  protected function _getExpressShippingRate() {
372
  $rate = Mage::getModel('shipping/rate_result_method');
373
  // DK
376
 
377
  $send24_consumer_key = $this->getConfigData('send24_consumer_key');
378
  $send24_consumer_secret = $this->getConfigData('send24_consumer_secret');
379
+ $auth = base64_encode($send24_consumer_key.':'.$send24_consumer_secret);
380
  $select_country = 'Ekspres';
381
 
382
+ // Get/check Express.
383
  $ch = curl_init();
384
  curl_setopt($ch, CURLOPT_URL, "https://send24.com/wc-api/v3/get_products");
385
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
390
  ));
391
  $send24_countries = json_decode(curl_exec($ch));
392
  curl_close($ch);
393
+ // Check errors.
394
+ if(empty($send24_countries->errors)){
395
+ $n = count($send24_countries);
396
+ for ($i = 0; $i < $n; $i++)
397
+ {
398
+ if ($send24_countries[$i]->title == $select_country)
399
+ {
400
+ $coast = $send24_countries[$i]->price;
401
+ $product_id = $send24_countries[$i]->product_id;
402
+ $i = $n;
403
+ $is_available = true;
404
+ }else{
405
+ $is_available = false;
406
+ }
 
 
 
 
 
 
 
 
407
  }
408
 
409
+ if($is_available == true){
410
+ //////////////
411
+ $shipping_address_1 = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->getData('street');
412
+ $shipping_postcode = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->getPostcode();
413
+ $shipping_city = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->getCity();
414
+ $shipping_country = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->getCountry();
415
+ if($shipping_country == 'DK'){
416
+ $shipping_country = 'Denmark';
417
+ }
418
+
419
+ $ch = curl_init();
420
+ curl_setopt($ch, CURLOPT_URL, "https://send24.com/wc-api/v3/get_user_id");
421
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
422
+ curl_setopt($ch, CURLOPT_HEADER, FALSE);
423
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
424
+ "Content-Type: application/json",
425
+ "Authorization: Basic ".$auth
426
+ ));
427
+ $user_meta = json_decode(curl_exec($ch));
428
+
429
+ $billing_address_1 = $user_meta->billing_address_1['0'];
430
+ $billing_postcode = $user_meta->billing_postcode['0'];
431
+ $billing_city = $user_meta->billing_city['0'];
432
+ $billing_country = $user_meta->billing_country['0'];
433
+ if($billing_country == 'DK'){
434
+ $billing_country = 'Denmark';
435
+ }
436
+
437
+ $full_billing_address = "$billing_address_1, $billing_postcode $billing_city, $billing_country";
438
+ $full_shipping_address = "$shipping_address_1, $shipping_postcode $shipping_city, $shipping_country";
439
+
440
+ // Get billing coordinates.
441
+ $billing_url = "http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=".urlencode($full_billing_address);
442
+ $billing_latlng = get_object_vars(json_decode(file_get_contents($billing_url)));
443
+ // Check billing address.
444
+ if(!empty($billing_latlng['results'])){
445
+ $billing_lat = $billing_latlng['results'][0]->geometry->location->lat;
446
+ $billing_lng = $billing_latlng['results'][0]->geometry->location->lng;
447
+
448
+ // Get shipping coordinates.
449
+ $shipping_url = "http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=".urlencode($full_shipping_address);
450
+ $shipping_latlng = get_object_vars(json_decode(file_get_contents($shipping_url)));
451
+ // Check shipping address.
452
+ if(!empty($shipping_latlng['results'])){
453
+ $shipping_lat = $shipping_latlng['results'][0]->geometry->location->lat;
454
+ $shipping_lng = $shipping_latlng['results'][0]->geometry->location->lng;
455
+
456
+ // get_is_driver_area_five_km
457
+ $ch = curl_init();
458
+ curl_setopt($ch, CURLOPT_URL, "https://send24.com/wc-api/v3/get_is_driver_area_five_km");
459
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
460
+ curl_setopt($ch, CURLOPT_HEADER, FALSE);
461
+ curl_setopt($ch, CURLOPT_POST, TRUE);
462
+ curl_setopt($ch, CURLOPT_POSTFIELDS, '
463
+ {
464
+ "billing_lat": "'.$billing_lat.'",
465
+ "billing_lng": "'.$billing_lng.'",
466
+ "shipping_lat": "'.$shipping_lat.'",
467
+ "shipping_lng": "'.$shipping_lng.'"
468
+ }
469
+ ');
470
+
471
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
472
+ "Content-Type: application/json",
473
+ "Authorization: Basic ".$auth
474
+ ));
475
+
476
+ $response = curl_exec($ch);
477
+ //print_r($response);
478
+ $res = json_decode($response);
479
+ if(!empty($res)){
480
+ // Get time work Express.
481
+ $start_work_express = $this->getConfigData('startexpress_time_select');
482
+ $end_work_express = $this->getConfigData('endexpress_time_select');
483
+ // Check time work.
484
+ date_default_timezone_set('Europe/Copenhagen');
485
+ $today = strtotime(date("Y-m-d H:i"));
486
+ $start_time = strtotime(''.date("Y-m-d").' '.$start_work_express.'');
487
+ $end_time = strtotime(''.date("Y-m-d").' '.$end_work_express.'');
488
+ // Check time setting in plugin.
489
+ if($start_time < $today && $end_time > $today){
490
+ // Check start_time.
491
+ if(!empty($res->start_time)){
492
+ $picked_up_time = strtotime(''.date("Y-m-d").' '.$res->start_time.'');
493
+ // Check time work from send24.com
494
+ if($start_time < $picked_up_time && $end_time > $picked_up_time){
495
+ $rate->setCarrier($this->_code);
496
+ $rate->setCarrierTitle($this->getConfigData('title'));
497
+ $rate->setMethod('express');
498
+ $rate->setMethodTitle('Send24 Sameday(ETA: '.$res->end_time.') - ');
499
+ $rate->setPrice($coast);
500
+ $rate->setCost(0);
501
+ }
502
+ }
503
+ }
504
+ }
505
+ curl_close($ch);
506
+ // print_r($full_billing_address);
507
+ return $rate;
508
+ }
509
+ }
510
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
511
  }
512
  // die;
513
 
app/code/local/Send24/Shipping/etc/config.xml CHANGED
@@ -5,6 +5,17 @@
5
  <module>0.0.1</module>
6
  </Send24_Shipping>
7
  </modules>
 
 
 
 
 
 
 
 
 
 
 
8
  <global>
9
  <models>
10
  <send24_shipping>
@@ -21,8 +32,16 @@
21
  </send24_shipping_order_observer>
22
  </observers>
23
  </sales_order_place_after>
24
-
25
  </events>
 
 
 
 
 
 
 
 
26
  </global>
27
 
28
  <!-- Default configuration -->
@@ -39,7 +58,7 @@
39
  <!--
40
  The title as referenced in the carrier class
41
  -->
42
- <title>Send24 Shipping</title>
43
  <!--
44
  The sort order specifies the position that
45
  this carrier appears relative to the other
5
  <module>0.0.1</module>
6
  </Send24_Shipping>
7
  </modules>
8
+
9
+ <adminhtml>
10
+ <layout>
11
+ <updates>
12
+ <send24_shipping>
13
+ <file>send24_order_tamplate.xml</file>
14
+ </send24_shipping>
15
+ </updates>
16
+ </layout>
17
+ </adminhtml>
18
+
19
  <global>
20
  <models>
21
  <send24_shipping>
32
  </send24_shipping_order_observer>
33
  </observers>
34
  </sales_order_place_after>
35
+
36
  </events>
37
+ <helpers>
38
+ <send24_shipping>
39
+ <class>Send24_Shipping_Model</class>
40
+ </send24_shipping>
41
+ </helpers>
42
+
43
+
44
+
45
  </global>
46
 
47
  <!-- Default configuration -->
58
  <!--
59
  The title as referenced in the carrier class
60
  -->
61
+ <title>Send24</title>
62
  <!--
63
  The sort order specifies the position that
64
  this carrier appears relative to the other
app/code/local/Send24/Shipping/etc/system.xml CHANGED
@@ -36,6 +36,7 @@
36
  -->
37
  <send24_consumer_key translate="label">
38
  <label>Send24 Consumer Key</label>
 
39
  <frontend_type>text</frontend_type>
40
  <sort_order>3</sort_order>
41
  <show_in_default>1</show_in_default>
@@ -47,6 +48,7 @@
47
  -->
48
  <send24_consumer_secret translate="label">
49
  <label>Send24 Consumer Secret</label>
 
50
  <frontend_type>text</frontend_type>
51
  <sort_order>4</sort_order>
52
  <show_in_default>1</show_in_default>
@@ -59,6 +61,7 @@
59
  -->
60
  <title translate="label">
61
  <label>Title</label>
 
62
  <frontend_type>text</frontend_type>
63
  <sort_order>2</sort_order>
64
  <show_in_default>1</show_in_default>
@@ -71,8 +74,33 @@
71
  will appear in relative to the
72
  other carriers available.
73
  -->
74
-
75
- <sort_order translate="label">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  <label>Sort Order</label>
77
  <frontend_type>text</frontend_type>
78
  <sort_order>100</sort_order>
36
  -->
37
  <send24_consumer_key translate="label">
38
  <label>Send24 Consumer Key</label>
39
+ <validate>required-entry</validate>
40
  <frontend_type>text</frontend_type>
41
  <sort_order>3</sort_order>
42
  <show_in_default>1</show_in_default>
48
  -->
49
  <send24_consumer_secret translate="label">
50
  <label>Send24 Consumer Secret</label>
51
+ <validate>required-entry</validate>
52
  <frontend_type>text</frontend_type>
53
  <sort_order>4</sort_order>
54
  <show_in_default>1</show_in_default>
61
  -->
62
  <title translate="label">
63
  <label>Title</label>
64
+ <validate>required-entry</validate>
65
  <frontend_type>text</frontend_type>
66
  <sort_order>2</sort_order>
67
  <show_in_default>1</show_in_default>
74
  will appear in relative to the
75
  other carriers available.
76
  -->
77
+
78
+ <startexpress_time_select translate="label">
79
+ <label>Start time work Express:</label>
80
+ <validate>required-entry</validate>
81
+ <comment>Please choose start time work Express.</comment>
82
+ <frontend_type>select</frontend_type>
83
+ <sort_order>90</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>1</show_in_store>
87
+ <source_model>send24_shipping/carrier</source_model>
88
+ </startexpress_time_select>
89
+
90
+ <endexpress_time_select translate="label">
91
+ <label>End time work Express:</label>
92
+ <validate>required-entry</validate>
93
+ <comment>Please choose end time work Express.</comment>
94
+ <frontend_type>select</frontend_type>
95
+ <sort_order>91</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ <source_model>send24_shipping/carrier</source_model>
100
+ </endexpress_time_select>
101
+
102
+
103
+ <sort_order translate="label">
104
  <label>Sort Order</label>
105
  <frontend_type>text</frontend_type>
106
  <sort_order>100</sort_order>
app/design/adminhtml/default/default/layout/send24_order_tamplate.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <layout version="0.1.0">
2
+ <adminhtml_sales_order_view>
3
+ <reference name="order_info">
4
+ <action method="setTemplate">
5
+ <template>send24/sales/order/view/info.phtml</template>
6
+ </action>
7
+ <block type="adminhtml/sales_order_view_history" name="send24_sales_order_view_custom" template="send24/sales/order/view/custom.phtml"></block>
8
+ </reference>
9
+ </adminhtml_sales_order_view>
10
+ </layout>
app/design/adminhtml/default/default/template/send24/sales/order/view/custom.phtml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_order = $this->getOrder();
3
+ $track_parsel = $_order->getSend24TrackParsel();
4
+ $json_printout = $_order->getSend24Printout();
5
+ $printout = json_decode($json_printout, JSON_FORCE_OBJECT);
6
+ if(!empty($track_parsel)){
7
+ ?>
8
+ <!--Send24 Information-->
9
+ <div class="entry-edit">
10
+ <div class="entry-edit-head">
11
+ <h4 class="icon-head head-account">Send24 Information</h4>
12
+ </div>
13
+ <div class="fieldset">
14
+ <div class="hor-scroll">
15
+ <table cellspacing="0" class="form-list">
16
+
17
+ <tr>
18
+ <td class="label"><label>Track parsel:</label></td>
19
+ <td class="value"><a href="<?php echo $track_parsel; ?>" target="_blank"><strong><?php echo $track_parsel; ?></strong></a></td>
20
+ </tr>
21
+ <tr>
22
+ <td class="label"><label>Printout:</label></td>
23
+ <td>
24
+ <p style="margin-left: 5px;">
25
+ <a href="<?php echo $printout['link_to_pdf']; ?>" target="_blank"><button title="Show PDF" type="button" class="scalable"><span>PDF</span></button></a>
26
+ <a href="<?php echo $printout['link_to_doc']; ?>" target="_blank"><button title="Show DOC" type="button" class="scalable"><span>DOC</span></button></a>
27
+ <a href="<?php echo $printout['link_to_zpl']; ?>" target="_blank"><button title="Show ZPL" type="button" class="scalable"><span>ZPL</span></button></a>
28
+ <a href="<?php echo $printout['link_to_epl']; ?>" target="_blank"><button title="Show EPL" type="button" class="scalable"><span>EPL</span></button></a>
29
+ </p>
30
+ </td>
31
+ </tr>
32
+
33
+ </table>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ <?php } ?>
app/design/adminhtml/default/default/template/send24/sales/order/view/info.phtml ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-2015 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 $_order = $this->getOrder() ?>
28
+ <?php
29
+ $orderAdminDate = $this->formatDate($_order->getCreatedAtDate(), 'medium', true);
30
+ $orderStoreDate = $this->formatDate($_order->getCreatedAtStoreDate(), 'medium', true);
31
+ ?>
32
+ <div class="box-left">
33
+ <!--Order Information-->
34
+ <div class="entry-edit">
35
+ <?php if ($_order->getEmailSent()):
36
+ $_email = Mage::helper('sales')->__('the order confirmation email was sent');
37
+ else:
38
+ $_email = Mage::helper('sales')->__('the order confirmation email is not sent');
39
+ endif; ?>
40
+ <div class="entry-edit-head">
41
+ <?php if ($this->getNoUseOrderLink()): ?>
42
+ <h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Order # %s', $_order->getRealOrderId()) ?> (<?php echo $_email ?>)</h4>
43
+ <?php else: ?>
44
+ <a href="<?php echo $this->getViewUrl($_order->getId()) ?>"><?php echo Mage::helper('sales')->__('Order # %s', $_order->getRealOrderId()) ?></a>
45
+ <strong>(<?php echo $_email ?>)</strong>
46
+ <?php endif; ?>
47
+ </div>
48
+ <div class="fieldset">
49
+ <table cellspacing="0" class="form-list">
50
+ <tr>
51
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Order Date') ?></label></td>
52
+ <td class="value"><strong><?php echo $orderAdminDate ?></strong></td>
53
+ </tr>
54
+ <?php if ($orderAdminDate != $orderStoreDate):?>
55
+ <tr>
56
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Order Date (%s)', $_order->getCreatedAtStoreDate()->getTimezone()) ?></label></td>
57
+ <td class="value"><strong><?php echo $orderStoreDate ?></strong></td>
58
+ </tr>
59
+ <?php endif;?>
60
+ <tr>
61
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Order Status') ?></label></td>
62
+ <td class="value"><strong><span id="order_status"><?php echo $_order->getStatusLabel() ?></span></strong></td>
63
+ </tr>
64
+ <tr>
65
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Purchased From') ?></label></td>
66
+ <td class="value"><strong><?php echo $this->getOrderStoreName() ?></strong></td>
67
+ </tr>
68
+ <?php if($_order->getRelationChildId()): ?>
69
+ <tr>
70
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Link to the New Order') ?></label></td>
71
+ <td class="value"><a href="<?php echo $this->getViewUrl($_order->getRelationChildId()) ?>">
72
+ <?php echo $_order->getRelationChildRealId() ?>
73
+ </a></td>
74
+ </tr>
75
+ <?php endif; ?>
76
+ <?php if($_order->getRelationParentId()): ?>
77
+ <tr>
78
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Link to the Previous Order') ?></label></td>
79
+ <td class="value"><a href="<?php echo $this->getViewUrl($_order->getRelationParentId()) ?>">
80
+ <?php echo $_order->getRelationParentRealId() ?>
81
+ </a></td>
82
+ </tr>
83
+ <?php endif; ?>
84
+ <?php if($_order->getRemoteIp() && $this->shouldDisplayCustomerIp()): ?>
85
+ <tr>
86
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Placed from IP') ?></label></td>
87
+ <td class="value"><strong><?php echo $_order->getRemoteIp(); echo ($_order->getXForwardedFor())?' (' . $this->escapeHtml($_order->getXForwardedFor()) . ')':''; ?></strong></td>
88
+ </tr>
89
+ <?php endif; ?>
90
+ <?php if($_order->getGlobalCurrencyCode() != $_order->getBaseCurrencyCode()): ?>
91
+ <tr>
92
+ <td class="label"><label><?php echo Mage::helper('sales')->__('%s / %s rate:', $_order->getGlobalCurrencyCode(), $_order->getBaseCurrencyCode()) ?></label></td>
93
+ <td class="value"><strong><?php echo $_order->getBaseToGlobalRate() ?></strong></td>
94
+ </tr>
95
+ <?php endif; ?>
96
+ <?php if($_order->getBaseCurrencyCode() != $_order->getOrderCurrencyCode()): ?>
97
+ <tr>
98
+ <td class="label"><label><?php echo Mage::helper('sales')->__('%s / %s rate:', $_order->getOrderCurrencyCode(), $_order->getBaseCurrencyCode()) ?></label></td>
99
+ <td class="value"><strong><?php echo $_order->getBaseToOrderRate() ?></strong></td>
100
+ </tr>
101
+ <?php endif; ?>
102
+ </table>
103
+ </div>
104
+ </div>
105
+ </div>
106
+ <div class="box-right">
107
+ <!--Account Information-->
108
+ <div class="entry-edit">
109
+ <div class="entry-edit-head">
110
+ <h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Account Information') ?></h4>
111
+ <div class="tools"><?php echo $this->getAccountEditLink()?></div>
112
+ </div>
113
+ <div class="fieldset">
114
+ <div class="hor-scroll">
115
+ <table cellspacing="0" class="form-list">
116
+ <tr>
117
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Customer Name') ?></label></td>
118
+ <td class="value">
119
+ <?php if ($_customerUrl=$this->getCustomerViewUrl()) : ?>
120
+ <a href="<?php echo $_customerUrl ?>" target="_blank"><strong><?php echo $this->escapeHtml($_order->getCustomerName()) ?></strong></a>
121
+ <?php else: ?>
122
+ <strong><?php echo $this->escapeHtml($_order->getCustomerName()) ?></strong>
123
+ <?php endif; ?>
124
+ </td>
125
+ </tr>
126
+ <tr>
127
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Email') ?></label></td>
128
+ <td class="value"><a href="mailto:<?php echo $_order->getCustomerEmail() ?>"><strong><?php echo $_order->getCustomerEmail() ?></strong></a></td>
129
+ </tr>
130
+ <?php if ($_groupName = $this->getCustomerGroupName()) : ?>
131
+ <tr>
132
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Customer Group') ?></label></td>
133
+ <td class="value"><strong><?php echo $_groupName ?></strong></td>
134
+ </tr>
135
+ <?php endif; ?>
136
+ <?php foreach ($this->getCustomerAccountData() as $data):?>
137
+ <tr>
138
+ <td class="label"><label><?php echo $data['label'] ?></label></td>
139
+ <td class="value"><strong><?php echo $data['value'] ?></strong></td>
140
+ </tr>
141
+ <?php endforeach;?>
142
+ </table>
143
+ </div>
144
+ </div>
145
+ </div>
146
+ <?php echo $this->getChildHtml('send24_sales_order_view_custom');?>
147
+ </div>
148
+ <div class="clear"></div>
149
+
150
+ <div class="box-left">
151
+ <!--Billing Address-->
152
+ <div class="entry-edit">
153
+ <div class="entry-edit-head">
154
+ <h4 class="icon-head head-billing-address"><?php echo Mage::helper('sales')->__('Billing Address') ?></h4>
155
+ <div class="tools"><?php echo $this->getAddressEditLink($_order->getBillingAddress())?></div>
156
+ </div>
157
+ <fieldset>
158
+ <address><?php echo $_order->getBillingAddress()->getFormated(true) ?></address>
159
+ </fieldset>
160
+ </div>
161
+ </div>
162
+ <?php if (!$this->getOrder()->getIsVirtual()): ?>
163
+ <div class="box-right">
164
+ <!--Shipping Address-->
165
+ <div class="entry-edit">
166
+ <div class="entry-edit-head">
167
+ <h4 class="icon-head head-shipping-address"><?php echo Mage::helper('sales')->__('Shipping Address') ?></h4>
168
+ <div class="tools"><?php echo $this->getAddressEditLink($_order->getShippingAddress())?></div>
169
+ </div>
170
+ <fieldset>
171
+ <address><?php echo $_order->getShippingAddress()->getFormated(true) ?></address>
172
+ </fieldset>
173
+ </div>
174
+ </div>
175
+
176
+ <div class="clear"></div>
177
+ <?php endif; ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>4f4e331f92f560de38f6bc2b5501d8cb</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
@@ -30,11 +30,11 @@ REQUIRES&#xD;
30
  This plugin requires an account on Send24. You will need to enter your api key in this shipping module to activate it. The account is free of charge and is used to administrate your shipments.&#xD;
31
  Register your free account on Send24.&#xD;
32
  </description>
33
- <notes>First release</notes>
34
  <authors><author><name>Roman Barbotkin</name><user>Barbotkin</user><email>barbotkin@bk.ru</email></author></authors>
35
- <date>2015-12-24</date>
36
- <time>12:29:11</time>
37
- <contents><target name="magelocal"><dir name="Send24"><dir name="Shipping"><dir name="Model"><file name="Carrier.php" hash="f0bde0292575eadd592e602e25aab57a"/></dir><dir name="etc"><file name="config.xml" hash="248e9c21b6075dad2b20f2a34e354f8e"/><file name="system.xml" hash="8a7b836a1a5e720348975b941ed8898e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Send24_Shipping.xml" hash="c365adcf43a601147514106e32ef524e"/></dir></target></contents>
38
  <compatible/>
39
  <dependencies><required><php><min>5.1.0</min><max>7.0.0</max></php></required></dependencies>
40
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>4f4e331f92f560de38f6bc2b5501d8cb</name>
4
+ <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
30
  This plugin requires an account on Send24. You will need to enter your api key in this shipping module to activate it. The account is free of charge and is used to administrate your shipments.&#xD;
31
  Register your free account on Send24.&#xD;
32
  </description>
33
+ <notes>Stable release</notes>
34
  <authors><author><name>Roman Barbotkin</name><user>Barbotkin</user><email>barbotkin@bk.ru</email></author></authors>
35
+ <date>2016-01-11</date>
36
+ <time>08:51:42</time>
37
+ <contents><target name="magelocal"><dir name="Send24"><dir name="Shipping"><dir name="Model"><file name="Carrier.php" hash="90371d7b7530bf6922655241d0a18832"/></dir><dir name="etc"><file name="config.xml" hash="72b2c67b829bb7d1dfcb555054f57b9b"/><file name="system.xml" hash="883824d65d05dd0c6c463483f3a3ea95"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="send24_order_tamplate.xml" hash="28484d6562bca02f3202dbd3ea7664e6"/></dir><dir name="template"><dir name="send24"><dir name="sales"><dir name="order"><dir name="view"><file name="custom.phtml" hash="5348e18bd217afe85a6d7000da4f627e"/><file name="info.phtml" hash="7704a122a7741323d32ce1bb3ebe56a1"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Send24_Shipping.xml" hash="c365adcf43a601147514106e32ef524e"/></dir></target></contents>
38
  <compatible/>
39
  <dependencies><required><php><min>5.1.0</min><max>7.0.0</max></php></required></dependencies>
40
  </package>