Skip to content

Commit 15f498f

Browse files
committed
Added support for Marketplace Partners
1 parent 3aac541 commit 15f498f

6 files changed

Lines changed: 22 additions & 9 deletions

File tree

step0.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
include('inc/config.php');
1919

2020
// Search all Tours/Hotels
21-
$result = $tourcms->search_tours("", $channel_id);
21+
$result = $tourcms->search_tours("order=tour_name", $channel_id);
2222

2323
// Print out an error if there is one
2424
// Otherwise loop through Tours/Hotels and display them
@@ -27,7 +27,7 @@
2727
else:
2828
foreach ($result->tour as $tour):
2929
?>
30-
<li><a href="step1.php?tour=<?php print $tour->tour_id; ?>"><?php print $tour->tour_name; ?></a></li>
30+
<li><a href="step1.php?tour=<?php print $tour->tour_id; ?>&amp;channel=<?php print $tour->channel_id; ?>"><?php print $tour->tour_name; ?></a></li>
3131
<?php
3232
endforeach;
3333
endif;

step1.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
// Tour ID based on previous selection should be in the querystring
1717
isset($_GET['tour']) ? $tour = (int)$_GET['tour'] : exit();
1818

19+
// Channel ID based on previous selection should be in the querystring
20+
isset($_GET['channel']) ? $channel = (int)$_GET['channel'] : exit();
21+
1922
// Query the TourCMS API, get back all the info on this Tour/Hotel
20-
$result = $tourcms->show_tour($tour, $channel_id);
23+
$result = $tourcms->show_tour($tour, $channel);
2124

2225
// Jump straight to the bit of XML related to making a new booking panel
2326
// includes rate and date info
@@ -84,7 +87,7 @@
8487

8588
<input type="hidden" name="rates" value="<?php print implode(",", $rates); ?>" />
8689
<input type="hidden" name="tour" value="<?php print $tour; ?>" />
87-
90+
<input type="hidden" name="channel" value="<?php print $channel; ?>" />
8891
<input type="submit" name="submit" value="Go" />
8992
</form>
9093

step2.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
// Tour ID
1919
isset($_POST['tour']) ? $tour = $_POST['tour'] : exit();
2020
$qs .= "?tour=" . $tour;
21+
// Channel ID
22+
isset($_POST['channel']) ? $channel = $_POST['channel'] : exit();
23+
$qs .= "&channel=" . $channel;
2124
// Date
2225
isset($_POST['date']) ? $date = $_POST['date'] : $date = "";
2326
$qs .= "&date=" . $date;
@@ -54,7 +57,7 @@
5457
$url_data->addChild('response_url', htmlentities($response_url . $qs));
5558

5659
// Send the response URL to TourCMS
57-
$result = $tourcms->get_booking_redirect_url($url_data, $channel_id);
60+
$result = $tourcms->get_booking_redirect_url($url_data, $channel);
5861

5962
// TourCMS should have returned a URL back to us, get that
6063
$redirect_url = $result->url->redirect_url;

step3.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
isset($_GET['tour']) ? $tour = (int)$_GET['tour'] : exit();
3535

36+
isset($_GET['channel']) ? $channel = (int)$_GET['channel'] : exit();
37+
3638
$rates = explode(",", $rate_string);
3739

3840
$total_people = 0;
@@ -48,7 +50,7 @@
4850
}
4951
}
5052

51-
$result = $tourcms->check_tour_availability($qs, $tour, $channel_id);
53+
$result = $tourcms->check_tour_availability($qs, $tour, $channel);
5254

5355

5456
isset($result->available_components->component) ? $num_components = count($result->available_components->component) : $num_components = 0;
@@ -68,6 +70,7 @@
6870
?>
6971
<input type="hidden" name="total_people" value="<?php print $total_people; ?>" />
7072
<input type="hidden" name="tour" value="<?php print $tour; ?>" />
73+
<input type="hidden" name="channel" value="<?php print $channel; ?>" />
7174
<fieldset>
7275
<table>
7376
<?php
@@ -81,7 +84,7 @@
8184
?> /></td>
8285
<td><?php ($hdur>0) ? null : print $component->date_code ; ?></td>
8386
<td><?php print prettify_date($component->start_date); ?></td>
84-
<td><?php print ($component->end_date != $component->start_date ? prettify_date($component->end_date) : null ); ?></td>
87+
<td><?php print ((string)$component->end_date <> (string)$component->start_date ? " to " . prettify_date($component->end_date) : null ); ?></td>
8588
<td><?php
8689
// For hotel type products, lets show the room type
8790
if ($hdur > 0):

step4.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
$component_key = isset($_POST['component_key']) ? $_POST['component_key'] : null;
1818

19+
$channel = isset($_POST['channel']) ? $_POST['channel'] : null;
20+
1921
$total_people = (int)$_POST['total_people'];
2022

2123
$titles = $_POST['title'];
@@ -47,13 +49,14 @@
4749
$customer->addChild('email', $email);
4850
}
4951

50-
$result = $tourcms->start_new_booking($booking, $channel_id);
52+
$result = $tourcms->start_new_booking($booking, $channel);
5153

5254
?>
5355
<h1><?php print $title; ?></h1>
5456
<p>Are you sure you wish to book this Tour/Hotel?</p>
5557
<form method="post" action="step5.php">
5658
<input type="hidden" name="booking_id" value="<?php print $result->booking->booking_id; ?>" />
59+
<input type="hidden" name="channel" value="<?php print $channel; ?>" />
5760
<input type="submit" name="submit" value="Go" />
5861
</form>
5962

step5.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
include('inc/config.php');
1313

1414
$booking_id = (isset($_POST['booking_id']) ? (int)$_POST['booking_id'] : 0);
15+
$channel = (isset($_POST['channel']) ? (int)$_POST['channel'] : 0);
1516

1617
if($booking_id > 0) {
1718

1819
// Create a new SimpleXMLElement to hold the booking details
1920
$booking = new SimpleXMLElement('<booking />');
2021
$booking->addChild('booking_id', $booking_id);
2122

22-
$result = $tourcms->commit_new_booking($booking, $channel_id);
23+
$result = $tourcms->commit_new_booking($booking, $channel);
2324

2425
}
2526

0 commit comments

Comments
 (0)