1212
1313
1414 // Process the form
15+ // We don't actually need any of this on this step, we will just be passing it on
16+ // in the querystring to Step 3
1517 $ qs = "" ;
18+ // Tour ID
19+ isset ($ _POST ['tour ' ]) ? $ tour = $ _POST ['tour ' ] : exit ();
20+ $ qs .= "?tour= " . $ tour ;
1621 // Date
1722 isset ($ _POST ['date ' ]) ? $ date = $ _POST ['date ' ] : $ date = "" ;
1823 $ qs .= "&date= " . $ date ;
3540 }
3641 }
3742 $ qs .= "&total_people= " . $ total_people ;
43+
44+ // If this is a Marketplace partner we can just redirect to Step 3
45+ if ($ marketplace_account_id > 0 ) {
46+ header ("Location: " . $ response_url . $ qs );
47+ exit ();
48+ }
49+
50+ // Otherwise we need to redirect via TourCMS
3851
3952 // Create a new SimpleXMLElement to hold the response url
4053 $ url_data = new SimpleXMLElement ('<url /> ' );
41-
42- // Add the response url, TourCMS will redirect to this, appending the key
43- $ response_url = str_replace ("{tour_id} " , (int )$ _POST ['tour ' ], $ response_url ) . $ qs ;
44- $ url_data ->addChild ('response_url ' , htmlentities ($ response_url ));
45- //$url_data->addChild('response_url', "http://tourcmsdev.macbook/scratch/api/bookings/step3.php?qs=" . urlencode("tour=" . (int)$_POST['tour'] . $qs));
54+ $ url_data ->addChild ('response_url ' , htmlentities ($ response_url . $ qs ));
4655
4756 // Send the response URL to TourCMS
4857 $ result = $ tourcms ->get_booking_redirect_url ($ url_data , $ channel_id );
5160 $ redirect_url = $ result ->url ->redirect_url ;
5261
5362 // Redirect the customer to the URL obtained from TourCMS
63+ // Comment these next two lines if you want to see the data sent and returned
5464 header ("Location: " . $ redirect_url );
5565 exit ();
5666
57- ?> <pre><?php htmlspecialchars (print ($ url_data ->asXML ())); ?> </pre><pre><?php print_r ($ result ); ?> </pre><pre><?php print $ redirect_url ; ?> </pre>
67+ ?> <pre><?php htmlentities (print ($ url_data ->asXML ())); ?> </pre><pre><?php print_r ($ result ); ?> </pre><pre><?php print $ redirect_url ; ?> </pre>
0 commit comments