uShop English (U.S.) for 179!

uStorekeeper English (U.S.) for 149!

 Products
       uTest
       uReserve
       uShop
       uStorekeeper
       uGolf
       uDirectory
       uSignIn
 Tech Support
       Support Policy
       Knowledge Base
            uTest
            uReserve
            uShop
            uStorekeeper
            uGolf
            uDirectory
            uSignIn
       Documentation
       Reference Sites
 Legal
       Software Piracy
       Legal Notices
       Privacy Policy
       Licensing
 Miscellaneous
       Reseller Info
       Contact Us
       Site Map
Back to Referring Page - how?

Knowledge Base Lobby : uShop Support Conference : Programmer Tips
Dec-14-17 09:48 PM EST
Original Message
Back to Referring Page - how?
Author longtex on 08-21-2002 at 14:11 (EST)
We'd like to call the order completion pages from several sites, and at the bottom of the "thank you" page put a "return to..." link to send the user back whence he came without his having to hit the browser back button several times... I'm assuming that there's a mechanism in html and/or perl to catch the referring page address, and that the top page of ushop.pl or the first page that referes to it can store the return link...

Anyone?

Thanks - Butch
E-MAIL AUTHOR | TABLE OF CONTENTS

Table Of Contents
  RE: Back to Referring Page - how? Bill Weiner, 2002-08-22 04:44:29 (1)
            RE: Back to Referring Page - how? longtex, 2002-08-22 12:27:13 (2)
                 RE: Back to Referring Page - how? Bill Weiner, 2002-08-23 03:50:17 (3)
                      RE: Back to Referring Page - how? longtex, 2002-08-23 13:39:31 (4)
                           RE: Back to Referring Page - how? Bill Weiner, 2002-08-26 04:13:07 (5)

Messages In This Discussion
         1. RE: Back to Referring Page - how?
        Author Bill Weiner on 08-22-2002 at 04:44 (EST)
There are several ways to handle that... here's possibly the easiest:

STEP 1: Make a backup of your ushop.pl script... just in case.

STEP 2: Open your ushop.pl script with any text editor such as WordPad.

STEP 3: Do a search on the following line:

&display_order_form();

STEP 4: Immediately AFTER that line, add this line:

$extra_field1 = $ENV{'HTTP_REFERER'};

STEP 5: Now do a search on the following line:

$order_footer .= &substitute_key_fields($settings[71]);

STEP 6: Immediately AFTER that line, add this line:

$order_footer =~ s/USHOP_EXTRA1/$extra_field1/g;

STEP 7: Save the script... as TEXT... and try it out as per the additional information below.

The above modification will allow you to utilize the keyword "USHOP_EXTRA1" anywhere in the General Settings - Miscellaneous form's "Receipt Page Footer HTML" field ... and that "USHOP_EXTRA1" keyword will be replaced at runtime with the URL of the original referring page.

So in other words, you would now want to set the value of the "Receipt Page Footer HTML" field on the uShop Control Panel to something like this:

Return to < A HREF="USHOP_EXTRA1" > USHOP_EXTRA1

(And again, the USHOP_EXTRA1 keywords will be replaced at runtime with the referring URL.)
TABLE OF CONTENTS
                 2. RE: Back to Referring Page - how?
                Author longtex on 08-22-2002 at 12:27 (EST)
Okay - it's =almost= working...

$extra_field1 = $ENV{'HTTP_REFERER'};

should be

$extra_field1 = $ENV{HTTP_REFERRER};

(or at least, perl complained until I changed it to that form).

Now, the problem is that this turns out to be (so far) the address of the cgi-bin directory, with no page name (e.g. https://secure.foobar.net/ushop/cgi-bin )
and this, of course, just gives you an access denied message.

What next, boss?
TABLE OF CONTENTS
                         3. RE: Back to Referring Page - how?
                        Author Bill Weiner on 08-23-2002 at 03:50 (EST)
I'm positive it should be:

$extra_field1 = $ENV{'HTTP_REFERER'};

(Yes, with single quotes and only one "R" in the middle. It's really cut-n-pasted from uShop's validate_referral_page() subroutine.)

... So what was the exact error message that you were getting from Perl? Perhaps you had a typo in there somewhere... so I would suggest trying that one more time.
TABLE OF CONTENTS
                                 4. RE: Back to Referring Page - how?
                                Author longtex on 08-23-2002 at 13:39 (EST)
LAST EDITED ON Aug-23-02 AT 01:51 PM (EST)


I had () as well as {} in it. Changing it back to one-R didn't make any difference, it's still empty.

I'm sure there's something elementary that I'm missing here.

Since I've got two servers, one "normal" and one "secure", I'm guessing that maybe the file locations are not set up completely correctly =- although the thing DOES run okay.

So... what goes on the "normal" server,and what goes on the "secure" server?
TABLE OF CONTENTS
                                         5. RE: Back to Referring Page - how?
                                        Author Bill Weiner on 08-26-2002 at 04:13 (EST)
I'm not sure what is going on with your server and the "HTTP_REFERER" environment variable, so here is another option where you can manually set the URL of the referring website.

Starting over from scratch....

ON THE JAVA SIDE....

STEP 1: On each website that the uShop Java Applets have been setup on, add the uShopInitialize applet to the same webpage that you have uShopOrderButton applet (typically the "Place Order" webpage of each site).

STEP 2: When adding the uShopInitialize applet to that "Place Order" page on each site, specify the "hidden_extra1" parameter as the URL of the webpage on that site to which you would like to link the customers back to... such as:

< PARAM NAME="hidden_extra1" VALUE="http://www.yourdomain.com" >

NOW, ON THE CGI SIDE....

STEP 3: Make a backup of your ushop.pl script... just in case.

STEP 4: Open your ushop.pl script with any text editor such as WordPad.

STEP 5: Now do a search on the following line:

$order_footer .= &substitute_key_fields($settings[71]);

STEP 6: Immediately AFTER that line, add this line:

$order_footer =~ s/USHOP_EXTRA1/$hidden_extra1/g;

(NOTE: Unlike the previous instructions that I gave you, note how now the "$hidden_extra1" field is used.)

STEP 7: Save the script... as TEXT... and try it out as per the additional instructions below.

The above modification will allow you to utilize the keyword "USHOP_EXTRA1" anywhere in the General
Settings - Miscellaneous form's "Receipt Page Footer HTML" field ... and that "USHOP_EXTRA1" keyword will be replaced at runtime with the value from the "hidden_extra1" parameter of your uShopInitialize applet.

So in other words, you would now want to set the value of the "Receipt Page Footer HTML" field on the uShop Control Panel to something like this:

Return to < A HREF="USHOP_EXTRA1" > USHOP_EXTRA1 < /A >

(And again, the USHOP_EXTRA1 keywords will be replaced at runtime with the value of the "hidden_extra1" parameter.)
TABLE OF CONTENTS

© 2003 Microburst Technologies, Inc.