|
1 | 1 | <?php |
2 | 2 |
|
3 | | -require_once(__DIR__.'/../../private/autoload.php'); |
| 3 | +set_include_path(__DIR__."/../../"); |
| 4 | + |
| 5 | +require_once(get_include_path().'private/autoload.php'); |
4 | 6 |
|
5 | 7 | Functions::setEnvVars(); |
6 | 8 |
|
|
18 | 20 | integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"> |
19 | 21 | </script> |
20 | 22 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script> |
| 23 | + <script src="https://embed.sendcloud.sc/spp/1.0.0/api.min.js"></script> |
| 24 | + <script> |
| 25 | + this.dc = []; |
| 26 | + |
| 27 | + this.dc.apikey = "<?php echo $dc->returnApiKey(); ?>" |
| 28 | + this.dc.country = "<?php echo $_POST['country']; ?>" |
| 29 | + this.dc.postal_code = "<?php echo $_POST['postal']; ?>" |
| 30 | + this.dc.city = "<?php echo $_POST['city']; ?>"; |
| 31 | + |
| 32 | + </script> |
| 33 | + |
| 34 | + <script src="/checkout/service_points.js"></script> |
| 35 | + |
21 | 36 | </head> |
22 | 37 |
|
23 | 38 | <body> |
|
34 | 49 | $carrier = new Carrier((array)$delivery_option['carrier']); |
35 | 50 | $method = new CheckoutMethod((array)$delivery_option); |
36 | 51 |
|
37 | | - echo "<h5>Method: ".$method->id."</h5><hr>"; |
| 52 | + echo "<h5>Method: ".$method->id."</h5>"; |
| 53 | + echo "<h6>Type: ".$method->delivery_method_type."</h6><hr>"; |
38 | 54 |
|
39 | 55 | foreach($method->checkoutDates as $method_option) |
40 | 56 | { |
41 | | - if($method_option['delivery_date'] != "Anytime") |
| 57 | + switch($method->delivery_method_type) |
42 | 58 | { |
43 | | - $method_option['parcel_handover_date'] = date("Y-m-d H:i", strtotime($method_option['parcel_handover_date'])); |
44 | | - $method_option['delivery_date'] = date("Y-m-d", strtotime($method_option['delivery_date'])); |
| 59 | + case 'same_day_delivery': |
| 60 | + include(get_include_path()."private/DeliveryOptions/SameDay.php"); |
| 61 | + break; |
| 62 | + case 'nominated_day_delivery': |
| 63 | + include(get_include_path()."private/DeliveryOptions/NominatedDay.php"); |
| 64 | + break; |
| 65 | + case 'standard_delivery': |
| 66 | + include(get_include_path()."private/DeliveryOptions/Standard.php"); |
| 67 | + break; |
| 68 | + case 'service_point_delivery': |
| 69 | + include(get_include_path()."private/DeliveryOptions/ServicePoint.php"); |
| 70 | + break; |
45 | 71 | } |
46 | | - ?> |
47 | | - <div class="col-md-3" style="margin-bottom:10px"> |
48 | | - <div class="card"> |
49 | | - <img src="<?php echo $carrier->logo_url ?>" width="40" height="40" style="margin-top:5px;" |
50 | | - class="card-img-top" alt="<?php echo $carrier->name ?>"> |
51 | | - <div class="card-body"> |
52 | | - <h5 class="card-title">Name: <?php echo $method->title ?></h5> |
53 | | - <p class="card-text">Description: <?php echo $method->description ?></p> |
54 | | - <p class="card-text">Order by: <?php echo $method_option['parcel_handover_date'] ?></p> |
55 | | - <p class="card-text">Delivered on: <?php echo $method_option['delivery_date'] ?></p> |
56 | | - <p class="card-text">Cost: |
57 | | - <?php echo $method->checkoutMethodPrice->price." ".$method->checkoutMethodPrice->currency; ?> |
58 | | - </p> |
59 | | - <button onclick="setOption(<?php echo $method->id ?>)" class="btn btn-success" |
60 | | - style="float:right">Select Method</button> |
61 | | - </div> |
62 | | - </div> |
63 | | - </div> |
64 | | - |
65 | | - <?php |
66 | 72 | } |
67 | 73 | ?> |
68 | 74 |
|
|
0 commit comments