#!/usr/bin/perl #ViewCart.pl require "/usr/home/sites/www.townsquaremall.com/townsquaremall/public_html/cgi-bin/cgi-lib.pl"; require "/usr/home/sites/www.townsquaremall.com/townsquaremall/public_html/cgi-bin/cookie.lib"; require "/usr/home/sites/www.townsquaremall.com/townsquaremall/public_html/cgi-bin/Functions/routines.pl"; require "/usr/home/sites/www.townsquaremall.com/townsquaremall/public_html/cgi-bin/Functions/Functions.pl"; use DBI; $dbh=DBI->connect("dbi:mysql:database=townsquaremall;host=mysql01.datapipe.net", "townsquaremall", "townsquaremall143", { AutoCommit=>0, RaiseError=>1, PrintError=>1 }) || die $DBI::errstr; &ReadParse(*input); &GetCookies(); @daysofweek=('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); @months=('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); #Cookie will expire after 3 days ($sec, $min, $hr, $day, $mon, $year, $wday, $yday, $isdst) = localtime(time+(3*24*60*60)); $year+=1900; $ProdPriceTotal = 0; $ProdShippingTotal = 0; &getCartID(); &getCart(); if($input{'Action'} eq 'Delete') { $sth=$dbh->prepare("DELETE FROM Cart WHERE CartID=? AND MultiPriceID=? AND SKU=?"); $sth->bind_param(1, $CartID); $sth->bind_param(2, $input{'DeleteProductID'}); $sth->bind_param(3, $input{'DeleteSKU'}); $sth->execute; $sth->finish; } ####################################################################### # Set cookie and display order ####################################################################### &SetCookieExpDate("$daysofweek[$wday], $day\-$months[$mon]\-$year 23:59:59 GMT"); &SetCookiePath("/"); print "Content-type: text/html\n"; &SetCookies("TSQCartID", $CartID); print "\n"; $CategNameFieldName = "CategName"; $StoreNameFieldName = "StoreName"; $PageCountFieldName = "PageCount"; $StoreCountFieldName = "StoreID"; $ChosenProductOptionsHTMLFieldName = "ChosenProductOptionsHTML"; $StoreURLFieldName = "StoreURL"; $input{$StoreNameFieldName} =~ s/[^\w]/_/g; #need to send in the original page in to this menu area #print &secure_header($Keyword, "Down And Linen Sample Page", "", 1, "Comforter"); #this is specifically used in the deletion of the old featured products #get the available ids for this product my ($featuredProductMinID); $sth=$dbh->prepare("SELECT min(PRODUCTID) FROM FeaturedProducts where StoreCategoryID=?"); $sth->bind_param(1, $input{$StoreCountFieldName}); $sth->execute; while (($fpproductinfo,) = ($sth->fetchrow_array)) { $featuredProductMinID = $fproductinfo; } $sth->finish; #$ProductID is from getCart() if ($ProductID+=0 != 0) { print &header($Keyword, "$input{$StoreNameFieldName}", "$input{$StoreCountFieldName}", "$input{$StoreNameFieldName}", "", $input{$StoreCountFieldName}, "$input{$StoreURLFieldName}", "$input{$CategNameFieldName}", 0,"M".$ProductID, 1, "related product", $featuredProductMinID); } else { print &header($Keyword, "$input{$StoreNameFieldName}", "$input{$StoreCountFieldName}", "$input{$StoreNameFieldName}", "", $input{$StoreCountFieldName}, "$input{$StoreURLFieldName}", "$input{$CategNameFieldName}", 0, 0, 1, "", $featuredProductMinID); } #DEBUG #print "\&secure_header($Keyword, \"$input{$StoreNameFieldName}\", \"$input{$StoreNameFieldName}\", \"\", $input{$StoreCountFieldName}, \"$input{$StoreURLFieldName}\", \"$input{$CategNameFieldName}\")\n"; print < ENDOFOUTPUT #NOtE TO ME - fix shippingcost to include handling cost - fixed - FJB $sth=$dbh->prepare("SELECT MultiPrice.MultiPriceID, Cart.SKU, Cart.Quantity, Title, MultiPrice.RetailPrice, MultiPrice.Shipping_Cost + MultiPrice.Handling_Cost, Cart.ExpressDelivery, MultiPrice.ExpressDeliveryCost, MultiPrice.Description, ChosenProductOptions FROM Products, Cart, MultiPrice WHERE MultiPrice.ProductID=Products.ProductID AND CartID=? AND Cart.MultiPriceID=MultiPrice.MultiPriceID"); $sth->bind_param(1, $CartID); $sth->execute; while(($ProductID, $SKU, $Quantity, $Title, $Price, $SandH, $ExpressDeliveryCost, $ExpressCost, $DescString, $ChosenProductOptions)=$sth->fetchrow_array) { #THIS IS WHAT I NEED - FJB! 07/09/2002 $QuantityFieldName = "$ProductID:$SKU"; $ExpressFieldName = $ProductID.':'.$SKU."Express"; $VendorFieldName = $ProductID.':'.$SKU."Origin"; $StoreIDFieldName = $ProductID.':'.$SKU."StoreID"; $ChosenProductOptionsFieldName = $ProductID.':'.$SKU."ChosenProductOptions"; #special accumulation of select chosen product options #$ChosenProductOptions = $input{$ChosenProductOptionsFieldName}; #prepare the checkout button for the chosen product options if already set #from previous submission if ($input{$ChosenProductOptionsHTMLFieldName} ne "") { $ChosenProductOptionsHTML = $input{$ChosenProductOptionsHTMLFieldName}; } else { $ChosenProductOptionsHTML .= $ChosenProductOptions . ","; } #print &PrintHeader . "$Quantity AND $Price AND $SandH AND $ExpressDeliveryCost\n
\n"; $ProdPrice = ($Quantity * $Price) + ($Quantity * $SandH) + ($Quantity * $ExpressDeliveryCost); $GrandTotal += $ProdPrice; if($ChosenProductOptions ne "") { $productOptionDesc = "($ChosenProductOptions)"; } else { $productOptionDesc = ""; } print < ENDOFOUTPUT printf " \n", $Price; printf " \n", $SandH; print " \n"; printf " \n", $ProdPrice; print <Delete Item ENDOFOUTPUT # print <Delete Item # #ENDOFOUTPUT #differentiate options per product by '|' if ($input{$ChosenProductOptionsHTMLFieldName} eq "") { #remove trailing comma chop ($ChosenProductOptionsHTML); $ChosenProductOptionsHTML .= '|'; } $NUM++; } print < ENDOFOUTPUT printf" ", $GrandTotal; print < 


View Your Shopping Cart

Please Do Not Bookmark This Page

Product

Qty

Price
Each

Shipping

Check for
X-press Delivery

Total

Delete

$DescString
$productOptionDesc
\$%6.2f\$%4.2f"; #if($ExpressCost > 0) if($input{$ExpressFieldName} > 0 && $ExpressCost > 0) { #print " 0)?" CHECKED":"", ">"; print " 0)?" CHECKED":"", ">"; } elsif(($input{$ExpressFieldName}+=0) == 0 && $ExpressCost > 0) { print " 0)?" CHECKED":"", ">"; } else { print "N/A"; } print "%6.2f
  Total Sale:>%6.2f

 Continue Shopping   Check Out Now

 
If you have changed any items in your shopping cart, you will need to   
 

*If you would like Express Delivery, an additional charge will be added to your total. Please take note.


Home | About Us | Customer Service | Security | Privacy Policy
Affiliate Program | Newsletter | Your Account | View Cart

Copyright © 2002 TownSquareMall.com

ENDOFOUTPUT $dbh->disconnect;