The below statement works for tracking orders that only have a single tracking number:
So basically above code works as follows:PHP Code:$order_number=$_POST['order_number'];
$track_rs = $db->Execute("SELECT tracking_number FROM fulfill_tracking WHERE order_number = '" . (int)$order_number . "' LIMIT 1");
if ($track_rs ->RecordCount() > 0) {
$track_num = $track_rs ->fields['tracking_number'];
header('Location: http://example dot com/' . $track_num);
} else {
$messageStack->add('tracking', ENTRY_ORDER_NUMBER_ERROR3);
}
Customer enters an order number on our tracking page and if that order number exist then the following is executed:
header('Location: http://example dot com/' . $track_num);
This is fine for 99% of orders which only ship in one package however I do ship single order sometimes in multiple packages so I will have to account for this in the above statement somehow.
So if only one result then do what it is doing now, execute the below :
header('Location: http://example dot com/' . $track_num);
if more then 1 entry is in the results then show on a separate page or on the tracking page as results something like:
This order shipped in xx box's:
Package 1: Click to Track
Package 2: Click to Track
Package 3: Click to Track
Package 4: Click to Track
Package 5: Click to Track
Each "Click to Track" needs to be one of the results so for example the five above would be:
http://customurl.com/[/url]' . $track_num[Result 1]
http://customurl.com/[/url]' . $track_num[Result 2]
http://customurl.com/[/url]' . $track_num[Result 3]
http://customurl.com/[/url]' . $track_num[Result 4]
http://customurl.com/[/url]' . $track_num[Result 5]
I have no clue how to properly write this in code, any help would be most appreciated.


Reply With Quote
