CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Changing shopping cart Thank You page

 



zyppit
Deleted

Apr 15, 2000, 8:06 PM

Post #1 of 8 (2067 views)
Changing shopping cart Thank You page Can't Post

I'm trying to change the generated Thank You page of a shopping cart so that after the order is processed the Thank You page displays a link to download whatever product was purchased.

Here's the page generation code:

print <<ENDPRINT;
<CENTER>
<TABLE WIDTH=500>
<TR>
<TD WIDTH=500>
<FONT FACE=ARIAL>
<P> </P>
Thank you for shopping with us.
<p>
<b>Click below to download your order:</b>
<p>
<a href="http://www.domain.com/graphics1.zip">Download Graphic 1</a>

<P> </P>
<a href=$sc_store_url>Return To Front Page</a>
<P> </P>
<P> </P>
</FONT>
</TD>
</TR>
</TABLE>
<CENTER>
ENDPRINT

How can I put a statement into this that does something like:
if ($product == Title of Graphic 1) {
print "<a href="http://www.domain.com/graphic1.zip">Download Graphic 1 </a>" }
if ($product == Title of Graphic 2) {
print "<a href="http://www.domain.com/graphic2.zip">Download Graphic 2 </a>" }

etc.

I've tried varieties of the above but don't know what I'm doing, so it doesn't work. Any hints would be much appreciated!

Thanks,
Jeanette


Cretep
User

Apr 15, 2000, 8:41 PM

Post #2 of 8 (2067 views)
Re: Changing shopping cart Thank You page [In reply to] Can't Post

Hi
Try this code
if ($product eq "Title of Graphic 1"){
print "<a href=\"http://www.domain.com/graphic1.zip\">Download Graphic 1 </a>" }
if ($product eq "Title of Graphic 2") {
print "<a href=\"http://www.domain.com/graphic2.zip\">Download Graphic 2 </a>" }

If you would like more help post the code.

Regards

Peter Crocuh


zyppit
Deleted

Apr 15, 2000, 9:15 PM

Post #3 of 8 (2067 views)
Re: Changing shopping cart Thank You page [In reply to] Can't Post

This almost did it for me!

Now I need to figure out why only one product download is displayed even if two are selected. Do I need to use an elsif statement?

It seems alot of if statements should work.

Here's the code:

print <<ENDPRINT;
<CENTER>
<TABLE WIDTH=500>
<TR>
<TD WIDTH=500>
<FONT FACE=ARIAL>
<P> </P>
Thank you for shopping with us.
<p>
<b>Click below to download your order:</b>
<p>
ENDPRINT

if ($product eq "Title of Graphic 1"){
print "<a href=\"http://www.domain.com/graphic1.zip\">Download Graphic 1 </a> <p>"
}
if ($product eq "Title of Graphic 2") {
print "<a href=\"http://www.domain.com/graphic2.zip\">Download Graphic 2 </a> <p>"
}

print <<ENDofPRINT;
<P> </P>
<a href=$sc_store_url>Return To Front Page</a>
<P> </P>
<P> </P>
</FONT>
</TD>
</TR>
</TABLE>
<CENTER>
ENDofPRINT

Thanks ALOT for getting me this far!
Jeanette


Cretep
User

Apr 16, 2000, 2:20 AM

Post #4 of 8 (2067 views)
Re: Changing shopping cart Thank You page [In reply to] Can't Post

Sorry I made a booboo, however I do have a worthy excuse (I was making lunch). Any way is it at all possible to post the shopping carts PERL code . As I have a fairly good idea on what’s happening however I cant really explain it.

Regards

Peter Crouch


zyppit
Deleted

Apr 16, 2000, 2:39 AM

Post #5 of 8 (2067 views)
Re: Changing shopping cart Thank You page [In reply to] Can't Post

It is in one of the library of scripts that goes with the main shopping cart script. It generates the emails to shopper and merchant, plus a few of the final pages.

It's very long. The part that makes the Thank You page is about 4/5 of the way down:

#######################################################################
# Order Form Definition Variables #
#######################################################################

%sc_order_form_array =('Ecom_BillTo_Postal_Name_First', 'First Name',
'Ecom_BillTo_Postal_Name_Last', 'Last Name',
'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
'Ecom_BillTo_Postal_City', 'Billing Address City',
'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
'Ecom_BillTo_PostalCode', 'Billing Address Zip',
'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
'Ecom_ShipTo_Postal_Name_First', 'Ship To First Name',
'Ecom_ShipTo_Postal_Name_Last', 'Ship To Last Name',
'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
'Ecom_ShipTo_Postal_City', 'Shipping Address City',
'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
'Ecom_BillTo_Online_Email', 'Email',
'Ecom_Payment_Card_Type', 'Type of Card',
'Ecom_Payment_Card_Number', 'Card Number',
'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
'Ecom_Payment_Card_ExpDate_Day', 'Card Expiration Day',
'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year');


@sc_order_form_required_fields = ("Ecom_BillTo_Postal_Name_First",
"Ecom_BillTo_Postal_Name_Last",
"Ecom_BillTo_Postal_Street_Line1",
"Ecom_BillTo_Postal_City",
"Ecom_BillTo_Postal_StateProv",
"Ecom_BillTo_PostalCode",
"Ecom_BillTo_Telecom_Phone_Number",
"Ecom_BillTo_Online_Email",
"Ecom_Payment_Card_Type",
"Ecom_Payment_Card_Number",
"Ecom_Payment_Card_ExpDate_Month",
"Ecom_Payment_Card_ExpDate_Day",
"Ecom_Payment_Card_ExpDate_Year");

###############################################################################

sub printSubmitPage

{
local($invoice_number, $customer_number);

$invoice_number = time;
$customer_number = $cart_id;
$customer_number =~ s/_/./g;

print <<ENDOFTEXT;
<!--Customer/Order Data-->
<INPUT TYPE=HIDDEN NAME=CUSTID VALUE=\"$customer_number\">
<INPUT TYPE=HIDDEN NAME=INVOICE VALUE=\"$invoice_number\">
<INPUT TYPE=HIDDEN NAME=DESCRIPTION VALUE=\"Online Order\">
<!--Billing Address-->
<INPUT TYPE=HIDDEN NAME=NAME VALUE=\"$form_data{'Ecom_BillTo_Postal_Name_First'} $form_data{'Ecom_BillTo_Postal_Name_Last'}\">
<INPUT TYPE=HIDDEN NAME=ADDRESS VALUE=\"$form_data{'Ecom_BillTo_Postal_Street_Line1'}\">
<INPUT TYPE=HIDDEN NAME=CITY VALUE=\"$form_data{'Ecom_BillTo_Postal_City'}\">
<INPUT TYPE=HIDDEN NAME=STATE VALUE=\"$form_data{'Ecom_BillTo_Postal_StateProv'}\">
<INPUT TYPE=HIDDEN NAME=ZIP VALUE=\"$form_data{'Ecom_BillTo_PostalCode'}\">
<INPUT TYPE=HIDDEN NAME=COUNTRY VALUE=\"$form_data{'Ecom_BillTo_Postal_CountryCode'}\">
<INPUT TYPE=HIDDEN NAME=PHONE VALUE=\"$form_data{'Ecom_BillTo_Telecom_Phone_Number'}\">
<INPUT TYPE=HIDDEN NAME=EMAIL VALUE=\"$form_data{'Ecom_BillTo_Online_Email'}\">
<!--Shipping Address-->
<INPUT TYPE=HIDDEN NAME=SHIPNAME VALUE=\"$form_data{'Ecom_ShipTo_Postal_Name_First'} $form_data{'Ecom_ShipTo_Postal_Name_Last'}\">
<INPUT TYPE=HIDDEN NAME=SHIPTOSTREET VALUE=\"$form_data{'Ecom_ShipTo_Postal_Street_Line1'}\">
<INPUT TYPE=HIDDEN NAME=SHIPTOCITY VALUE=\"$form_data{'Ecom_ShipTo_Postal_City'}\">
<INPUT TYPE=HIDDEN NAME=SHIPTOSTATE VALUE=\"$form_data{'Ecom_ShipTo_Postal_StateProv'}\">
<INPUT TYPE=HIDDEN NAME=SHIPTOZIP VALUE=\"$form_data{'Ecom_ShipTo_Postal_PostalCode'}\">
<INPUT TYPE=HIDDEN NAME=SHIPTOCOUNTRY VALUE=\"$form_data{'Ecom_ShipTo_Postal_CountryCode'}\">
<!--Billing Data-->
<INPUT TYPE=HIDDEN NAME=METHOD VALUE=\"$form_data{'Ecom_Payment_Card_Type'}\">
<INPUT TYPE=HIDDEN NAME=CARDNUM VALUE=\"$form_data{'Ecom_Payment_Card_Number'}\">
<INPUT TYPE=HIDDEN NAME=EXPDATE VALUE=\"Month: $form_data{'Ecom_Payment_Card_ExpDate_Month'} Day: $form_data{'Ecom_Payment_Card_ExpDate_Day'} Year: $form_data{'Ecom_Payment_Card_ExpDate_Year'}\">

<TABLE WIDTH="500" BGCOLOR="#C0FFFF" CELLPADDING="2" CELLSPACING="0">

<TR BGCOLOR="#FFFFFF">
<TD>

</TD>
</TR>

<TR BGCOLOR="#C0FFFF">
<TD BGCOLOR="#C0FFFF">
<FONT FACE="ARIAL" SIZE="2" COLOR="#000000">
Please verify the following information. When you are confident
that it is correct, click the 'Submit Order For Processing' button below
</FONT>
</TD>
</TR>
</TABLE>

<FONT FACE=ARIAL SIZE=-1>
<CENTER>
<TABLE WIDTH=500 BORDER=0 BGCOLOR=#C0FFFF>
<TR>
<TD COLSPAN=2>
<FONT FACE=ARIAL SIZE=-1>
<B>Customer Information</B>
</FONT>
</TD>
</TR>

<TR>
<TD WIDTH=100>
<FONT FACE=ARIAL SIZE=-1>
Customer Number
</FONT>
</TD>
<TD WIDTH=400>
<FONT FACE=ARIAL SIZE=-1>
$cart_id
</FONT>
</TD>
</TR>

<TR>
<TD WIDTH=150>
<FONT FACE=ARIAL SIZE=-1>
Order Number
</FONT>
</TD>
<TD WIDTH=350>
<FONT FACE=ARIAL SIZE=-1>
$time
</FONT>
</TD>
</TR>

<TR>
<TD COLSPAN=2>
<FONT FACE=ARIAL SIZE=-1>
<B>Billing Address</B>
</FONT>
</TD>
</TR>

<TR>
<TD WIDTH=150>
<FONT FACE=ARIAL SIZE=-1>
Name
</FONT>
</TD>
<TD WIDTH=350>
<FONT FACE=ARIAL SIZE=-1>
$form_data{'Ecom_BillTo_Postal_Name_First'} $form_data{'Ecom_BillTo_Postal_Name_Last'}
</FONT>
</TD>
</TR>

<TR>
<TD WIDTH=150>
<FONT FACE=ARIAL SIZE=-1>
Street
</FONT>
</TD>
<TD WIDTH=350>
<FONT FACE=ARIAL SIZE=-1>
$form_data{'Ecom_BillTo_Postal_Street_Line1'}
</FONT>
</TD>
</TR>

<TR>
<TD WIDTH=150>
<FONT FACE=ARIAL SIZE=-1>
City
</FONT>
</TD>
<TD WIDTH=350>
<FONT FACE=ARIAL SIZE=-1>
$form_data{'Ecom_BillTo_Postal_City'}
</FONT>
</TD>
</TR>

<TR>
<TD WIDTH=150>
<FONT FACE=ARIAL SIZE=-1>
State
</FONT>
</TD>
<TD WIDTH=350>
<FONT FACE=ARIAL SIZE=-1>
$form_data{'Ecom_BillTo_Postal_StateProv'}
</FONT>
</TD>
</TR>

<TR>
<TD WIDTH=150>
<FONT FACE=ARIAL SIZE=-1>
Zip
</FONT>
</TD>
<TD WIDTH=350>
<FONT FACE=ARIAL SIZE=-1>
$form_data{'Ecom_BillTo_PostalCode'}
</FONT>
</TD>
</TR>

<TR>
<TD WIDTH=150>
<FONT FACE=ARIAL SIZE=-1>
Country
</FONT>
</TD>
<TD WIDTH=350>
<FONT FACE=ARIAL SIZE=-1>
$form_data{'Ecom_BillTo_Postal_CountryCode'}
</FONT>
</TD>
</TR>

<TR>
<TD WIDTH=150>
<FONT FACE=ARIAL SIZE=-1>
Phone
</FONT>
</TD>
<TD WIDTH=350>
<FONT FACE=ARIAL SIZE=-1>
$form_data{'Ecom_BillTo_Telecom_Phone_Number'}
</FONT>
</TD>
</TR>

<TR>
<TD WIDTH=150>
<FONT FACE=ARIAL SIZE=-1>
E-Mail
</FONT>
</TD>
<TD WIDTH=350>
<FONT FACE=ARIAL SIZE=-1>
$form_data{'Ecom_BillTo_Online_Email'}
</FONT>
</TD>
</TR>

<!--Shipping Address-->

<TR>
<TD COLSPAN=2>
<FONT FACE=ARIAL SIZE=-1>
<B>Shipping Address</B>
</FONT>
</TD>
</TR>

<TR>
<TD WIDTH=150>
<FONT FACE=ARIAL SIZE=-1>
Name
</FONT>
</TD>
<TD WIDTH=350>
<FONT FACE=ARIAL SIZE=-1>
$form_data{'Ecom_ShipTo_Postal_Name_First'} $form_data{'Ecom_ShipTo_Postal_Name_Last'}
</FONT>
</TD>
</TR>

<TR>
<TD WIDTH=150>
<FONT FACE=ARIAL SIZE=-1>
Street
</FONT>
</TD>
<TD WIDTH=350>
<FONT FACE=ARIAL SIZE=-1>
$form_data{'Ecom_ShipTo_Postal_Street_Line1'}
</FONT>
</TD>
</TR>

<TR>
<TD WIDTH=150>
<FONT FACE=ARIAL SIZE=-1>
City
</FONT>
</TD>
<TD WIDTH=350>
<FONT FACE=ARIAL SIZE=-1>
$form_data{'Ecom_ShipTo_Postal_City'}
</FONT>
</TD>
</TR>

<TR>
<TD WIDTH=150>
<FONT FACE=ARIAL SIZE=-1>
State
</FONT>
</TD>
<TD WIDTH=350>
<FONT FACE=ARIAL SIZE=-1>
$form_data{'Ecom_ShipTo_Postal_StateProv'}
</FONT>
</TD>
</TR>

<TR>
<TD WIDTH=150>
<FONT FACE=ARIAL SIZE=-1>
Zip
</FONT>
</TD>
<TD WIDTH=350>
<FONT FACE=ARIAL SIZE=-1>
$form_data{'Ecom_ShipTo_Postal_PostalCode'}
</FONT>
</TD>
</TR>

<TR>
<TD WIDTH=150>
<FONT FACE=ARIAL SIZE=-1>
Country
</FONT>
<TD>
<FONT FACE=ARIAL SIZE=-1>
$form_data{'Ecom_ShipTo_Postal_CountryCode'}
</FONT>
</TD>
</TR>

<TR>
<TD COLSPAN=2>
<CENTER>
<P>
<INPUT TYPE="HIDDEN" NAME="process_order" VALUE="yes">
<INPUT TYPE=SUBMIT VALUE="Submit Order For Processing">
<P>
</CENTER>
</TD>
</TR>
</TABLE>
</CENTER>
</FONT>
ENDOFTEXT
}
###############################################################

sub processOrder {
local($subtotal, $total_quantity,
$total_measured_quantity,
$text_of_cart,
$required_fields_filled_in, $product, $quantity, $options,
$text_of_confirm_email, $text_of_admin_email, $emailCCnum, $logCCnum);

# BEGIN REFERRING SITE VALIDATION
local ($referringDomain, $acceptedDomain);

$acceptedDomain = $sc_order_script_url;
$referringDomain = $ENV{'HTTP_REFERER'};

$referringDomain =~ s/\?.*//g;
$referringDomain =~ s/http:\/\///g;
$referringDomain =~ s/\/.*//g;
$referringDomain =~ s/\/commerce.cgi//g;

$acceptedDomain =~ s/\?.*//g;
$acceptedDomain =~ s/http:\/\///g;
$acceptedDomain =~ s/\/.*//g;
$acceptedDomain =~ s/\/commerce.cgi//g;

if ($referringDomain =~ "^w*\.")
{
$referringDomain =~ s/^w*\.//i;
}

if ($acceptedDomain =~ "^w*\.")
{
$acceptedDomain =~ s/^w*\.//i;
}

if ($referringDomain ne $acceptedDomain)
{
print "$acceptedDomain is the accepted referrer.<br>";
print "$referringDomain is not a valid referrer<br>";
print "Refering Site Authentication Failed!";
exit;
}
# END REFERRING SITE VALIDATION

# First, we output the header of
# the processing of the order

$orderDate = &get_date;

$emailCCnum = "XXXXXXXX";
$emailCCnum .= substr($form_data{'CARDNUM'},8,20);

$logCCnum = substr($form_data{'CARDNUM'},0,8);
$logCCnum .= "XXXXXXXX";

print qq!
<HTML>
<HEAD>
<TITLE>Thank you for your order</TITLE>
</HEAD>
</BODY>
!;

&SecureStoreHeader;

$text_of_cart .= "New Order: $orderDate\n\n";

$text_of_cart .= " --PRODUCT INFORMATION--\n\n";

open (CART, "$sc_cart_path") &#0124; &#0124;
&file_open_error("$sc_cart_path", "display_cart_contents", __FILE__, __LINE__);

while (<CART> )
{
$cartData++;
@cart_fields = split (/\|/, $_);
$quantity = $cart_fields[0];
$product_price = $cart_fields[3];
$product = $cart_fields[4];
$options = $cart_fields[7];
$options =~ s/<br>/ /g;
$text_of_cart .= "Quantity: $quantity\nProduct: $product $sc_money_symbol $product_price (each)\n";
$text_of_cart .= "Options: $options\n\n";
}
close(CART);

$text_of_confirm_email .= "Thank you for your order. We appreciate your business and will do everything we can to meet your expectations. Please visit us again soon!\n\n";
$text_of_confirm_email .= $text_of_cart;
$text_of_confirm_email .= "\n";
$text_of_cart .= " --ORDER INFORMATION--\n\n";

$text_of_cart .= "CUSTID: $form_data{'CUSTID'}\n";
$text_of_admin_email .= "CUSTID: $form_data{'CUSTID'}\n";

$text_of_cart .= "INVOICE: $form_data{'INVOICE'}\n";
$text_of_confirm_email .= "INVOICE: $form_data{'INVOICE'}\n";

if ($form_data{'SHIPPING'})
{
$text_of_cart .= "SHIPPING: $form_data{'SHIPPING'}\n";
$text_of_confirm_email .= "SHIPPING: $form_data{'SHIPPING'}\n";
}

if ($form_data{'DISCOUNT'})
{
$text_of_cart .= "DISCOUNT: $form_data{'DISCOUNT'}\n";
$text_of_confirm_email .= "DISCOUNT: $form_data{'DISCOUNT'}\n";
}

if ($form_data{'SALESTAX'})
{
$text_of_cart .= "SALES TAX: $form_data{'SALESTAX'}\n";
$text_of_confirm_email .= "SALES TAX: $form_data{'SALESTAX'}\n";
}

$text_of_cart .= "TOTAL: $form_data{'AMOUNT'}\n";
$text_of_confirm_email .= "TOTAL: $form_data{'AMOUNT'}\n";

$text_of_admin_email = $text_of_cart;

$text_of_cart .= "METHOD: $form_data{'METHOD'}\n";
$text_of_admin_email .= "METHOD: XXXX\n";

$text_of_cart .= "NUMBER: $logCCnum\n";
$text_of_admin_email .= "NUMBER: $emailCCnum\n";

$text_of_cart .= "EXP: XXXX\n";
$text_of_admin_email .= "EXP: $form_data{'EXPDATE'}\n";

$text_of_cart .= "DESCRIPTION: $form_data{'DESCRIPTION'}\n\n";
$text_of_admin_email .= "DESCRIPTION: $form_data{'DESCRIPTION'}\n\n";

$text_of_cart .= "BILLING INFORMATION --------------\n\n";
$text_of_admin_email .= "BILLING INFORMATION --------------\n\n";

$text_of_cart .= "NAME: $form_data{'NAME'}\n";
$text_of_admin_email .= "NAME: $form_data{'NAME'}\n";

$text_of_cart .= "ADDRESS: $form_data{'ADDRESS'}\n";
$text_of_admin_email .= "ADDRESS: $form_data{'ADDRESS'}\n";

$text_of_cart .= "CITY: $form_data{'CITY'}\n";
$text_of_admin_email .= "CITY: $form_data{'CITY'}\n";

$text_of_cart .= "STATE: $form_data{'STATE'}\n";
$text_of_admin_email .= "STATE: $form_data{'STATE'}\n";

$text_of_cart .= "ZIP: $form_data{'ZIP'}\n";
$text_of_admin_email .= "ZIP: $form_data{'ZIP'}\n";

$text_of_cart .= "COUNTRY: $form_data{'COUNTRY'}\n";
$text_of_admin_email .= "COUNTRY: $form_data{'COUNTRY'}\n";

$text_of_cart .= "PHONE: $form_data{'PHONE'}\n";
$text_of_admin_email .= "PHONE: $form_data{'PHONE'}\n";

$text_of_cart .= "EMAIL: $form_data{'EMAIL'}\n\n";
$text_of_admin_email .= "EMAIL: $form_data{'EMAIL'}\n\n";

$text_of_cart .= "SHIPPING INFORMATION --------------\n\n";
$text_of_admin_email .= "SHIPPING INFORMATION --------------\n\n";

$text_of_cart .= "NAME: $form_data{'SHIPNAME'}\n";
$text_of_admin_email .= "NAME: $form_data{'SHIPNAME'}\n";

$text_of_cart .= "ADDRESS: $form_data{'SHIPTOSTREET'}\n";
$text_of_admin_email .= "ADDRESS: $form_data{'SHIPTOSTREET'}\n";

$text_of_cart .= "CITY: $form_data{'SHIPTOCITY'}\n";
$text_of_admin_email .= "CITY: $form_data{'SHIPTOCITY'}\n";

$text_of_cart .= "STATE: $form_data{'SHIPTOSTATE'}\n";
$text_of_admin_email .= "STATE: $form_data{'SHIPTOSTATE'}\n";

$text_of_cart .= "ZIP: $form_data{'SHIPTOZIP'}\n";
$text_of_admin_email .= "ZIP: $form_data{'SHIPTOZIP'}\n";

$text_of_cart .= "COUNTRY: $form_data{'SHIPTOCOUNTRY'}\n\n";
$text_of_admin_email .= "COUNTRY: $form_data{'SHIPTOCOUNTRY'}\n\n";

if ($sc_use_pgp =~ /yes/i)
{
&require_supporting_libraries(__FILE__, __LINE__, "$sc_pgp_lib_path");
$text_of_cart = &make_pgp_file($text_of_cart, "$sc_pgp_temp_file_path/$$.pgp");
$text_of_cart = "\n" . $text_of_cart . "\n";

$text_of_admin_email = &make_pgp_file($text_of_admin_email, "$sc_pgp_temp_file_path/$$.pgp");
$text_of_admin_email = "\n" . $text_of_admin_email . "\n";
}

if ($sc_send_order_to_email =~ /yes/i)
{
&send_mail($sc_order_email, $sc_order_email, "Online Order",$text_of_admin_email);
}

if ($sc_send_order_to_log =~ /yes/i) {
open (ORDERLOG, "+>>./log_files/$sc_order_log_name");
print ORDERLOG "-" x 60 . "\n";
print ORDERLOG $text_of_cart;
print ORDERLOG "-" x 60 . "\n";
close (ORDERLOG);
}

if ($cartData)
{
&send_mail($sc_admin_email, $form_data{'EMAIL'}, "Thank you for your order!", "$text_of_confirm_email");
}




print <<ENDPRINT;
<CENTER>
<TABLE WIDTH=500>
<TR>
<TD WIDTH=500>
<FONT FACE=ARIAL>
<P> </P>
Thank you for shopping with us.Please visit us again soon!<br>
<p>
<b>Click below to download your order:</b>
<p>
ENDPRINT

if ($product eq "T-Shirt with Pocket"){
print "<a href=\"http://www.domain.com/graphic1.zip\">Download T-Shirt with Pocket </a> <p>"
}
if ($product eq "Cosmos") {
print "<a href=\"http://www.domain.com/graphic2.zip\">Download Cosmos </a> <p>"
}
if ($product eq "Cooking at the Kashbah"){
print "<a href=\"http://www.domain.com/graphic1.zip\">Download Cooking at the Kashbah </a> <p>"
}
if ($product eq "Through a Window") {
print "<a href=\"http://www.domain.com/graphic2.zip\">Download Through a Window </a> <p>"
}


print <<ENDofPRINT;
<P> </P>
<a href=$sc_store_url>Return To Front Page</a>
<P> </P>
<P> </P>
</FONT>
</TD>
</TR>
</TABLE>
<CENTER>
ENDofPRINT


# This empties the cart after the order is successful

open (CART, ">$sc_cart_path");
close (CART);

# and the footer is printed

&SecureStoreFooter;

print qq!
</BODY>
</HTML>
!;

} # End of process_order_form

#################################################################

sub display_calculations {

local($subtotal,
$are_we_before_or_at_process_form,
$total_measured_quantity,
$text_of_cart) = @_;

local ($final_shipping,
$final_discount,
$final_sales_tax,$grand_total) =
&calculate_final_values($subtotal,
$total_quantity,
$total_measured_quantity,
$are_we_before_or_at_process_form);

if ($final_shipping > 0)
{
$final_shipping = &format_price($final_shipping);

$final_shipping = &display_price($final_shipping);

print "<TR>\n";
print "<TD>\n";
print "<CENTER>$cart_font_style Shipping: $final_shipping</FONT></CENTER>\n";
print "</TD>\n";
print "</TR>\n";

$text_of_cart .= &format_text_field("Shipping:") .
"= $final_shipping\n\n";
};

if ($final_discount > 0)
{
$final_discount = &format_price($final_discount);

$final_discount = &display_price($final_discount);

print "<TR>\n";
print "<TD>\n";
print "<CENTER>$cart_font_style Discount: $final_discount</FONT></CENTER>\n";
print "</TD>\n";
print "</TR>\n";

$text_of_cart .= &format_text_field("Discount:") .
"= $final_discount\n\n";
}

if ($final_sales_tax > 0)
{
$final_sales_tax = &format_price($final_sales_tax);

$final_sales_tax = &display_price($final_sales_tax);

print "<TR>\n";
print "<TD>\n";
print "<CENTER>$cart_font_style Sales Tax: $final_sales_tax</FONT></CENTER>\n";
print "</TD>\n";
print "</TR>\n";

$text_of_cart .= &format_text_field("Sales Tax:") .
"= $final_sales_tax\n\n";
}

$authPrice = $grand_total;
$grand_total = &display_price($grand_total);

print "<TR>\n";
print "<TD>\n";
print "<CENTER>$cart_font_style Grand Total: $grand_total</FONT></CENTER><P>\n";
print "</TD>\n";
print "</TR>\n";
print "</TABLE>\n";

if ($are_we_before_or_at_process_form =~ /at/i)
{
print <<ENDOFTEXT;

<FORM METHOD=POST ACTION=\"$sc_order_script_url\">
<INPUT TYPE=HIDDEN NAME=cart_id VALUE=\"$cart_id\">
<INPUT TYPE=HIDDEN NAME=AMOUNT VALUE=\"$sc_money_symbol $authPrice\">
<INPUT TYPE=HIDDEN NAME=SHIPPING VALUE=\"$final_shipping\">
<INPUT TYPE=HIDDEN NAME=DISCOUNT VALUE=\"$final_discount\">
<INPUT TYPE=HIDDEN NAME=SALESTAX VALUE=\"$final_sales_tax\">
ENDOFTEXT
}

$text_of_cart .= &format_text_field("Grand Total:") .
"= $grand_total\n\n";

return ($text_of_cart);

}


These are products in my demo store (books & T-Shirts) but I am designing sites for an artist and another for a musician who want to sell graphics and MP3 files.

Many thanks for helping!
Jeanette


zyppit
Deleted

Apr 16, 2000, 10:08 AM

Post #6 of 8 (2067 views)
Re: Changing shopping cart Thank You page [In reply to] Can't Post

I tried the above code with 4 if statements for 4 products. In a demo of the store I ordered 3 products. Only one product shows up on the Thank You page.

Why is that?

Thanks,
Jeanette


zyppit
Deleted

Apr 16, 2000, 1:18 PM

Post #7 of 8 (2067 views)
Re: Changing shopping cart Thank You page [In reply to] Can't Post

This part generates all the products and prices for the customer email. Maybe I need to put the if statements in the middle of something like this:

open (CART, "$sc_cart_path") | |
&file_open_error("$sc_cart_path", "display_cart_contents", __FILE__, __LINE__);

while (<CART> )
{
$cartData++;
@cart_fields = split (/\|/, $_);
$quantity = $cart_fields[0];
$product_price = $cart_fields[3];
$product = $cart_fields[4];
$options = $cart_fields[7];
$options =~ s/<br>/ /g;
$text_of_cart .= "Quantity: $quantity\nProduct: $product $sc_money_symbol $product_price
(each)\n";
$text_of_cart .= "Options: $options\n\n";
}
close(CART);


zyppit
Deleted

Apr 16, 2000, 1:41 PM

Post #8 of 8 (2067 views)
Re: Changing shopping cart Thank You page [In reply to] Can't Post

Peter,

It worked!!

It's displaying all the product downloads. Wow, I'm thrilled to have figured this out!

Thanks alot for posting. Writing to you helped me stay with it until I could figure it out. Maybe I'll learn Perl someday?

Jeanette

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives