On Dec 15, 2004, at 3:36 AM, Adrian P Wilkinson wrote:
Dear All,For those of you that have noticed that consignment tracking disappeared from check_orders.html with the 'standard' demo, you might want to consider the following simple modifcation around line 326:<td>[display table=transactions type=display col=status key="[sql-code]"] <br>[ <a href="/go/parceltrack.cgi?[sql-param tracking_number]">Track</a> ]</td>I'm yet to put any kind of check to see if there is a tracking_number present in the transactions table as that's something to do a little later.The problem is with the parcel tracking script I've written. The tracking number entered is in the form of AA-11111111 where 'AA' is a code to represent a service offered by a particular courier company. "BP" is Business Post Next Day and "SD" is Royal Mail Special Delivery, for example.What is happening is that when it tries to work out who the parcel has been sent with, it doesn't always pick the correct one:if ( $CARRIERCODE eq "BP" ) { $CARRIERNAME = "Business Post"; $CARRIERSERV = "Next Day"; $CARRIERURL = "http://www.businesspost.com/";$TRACKURL = "http://www.business-post.com/scripts/wsisa.dll/ws_quickpod.html? lc_SearchValue=$CONSIGNMENT";goto pagebody; } if ( $CARRIERCODE eq "SD" ) { $CARRIERNAME = "Royal Mail"; $CARRIERSERV = "Special Delivery"; $CARRIERURL = "www.royalmail.com"; goto pagebody; } if ( $CARRIERCODE eq "CL" ) { $CARRIERNAME = "Initial CityLink"; $CARRIERSERV = "Next Day"; $CARRIERURL = "www.city-link.co.uk";$TRACKURL = "http://www.city-link.co.uk/pod/podfrm.php?JobNo=$CONSIGNMENT";goto pagebody; }I've tried matching using "eq" and "==" but it seems to just decide to pick one at random. Any suggestions how I can get it to match $CARRIERCODE (created by taking the first two characters of the string passed) against the above criteria correctly every time?
Just a guess here, but what about using if, elsif, etc?And you could probably do the check right on your tracking number and eliminate $CARRIERCODE if you used regular expressions. But first you need it to work, then you can make it pretty...
-- Josh Lavin Kingdom Design http://www.kingdomdesign.com/ _______________________________________________ interchange-users mailing list suppressed http://www.icdevgroup.org/mailman/listinfo/interchange-users
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.