By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,190 Members | 1,555 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,190 IT Pros & Developers. It's quick & easy.

Needs help with old PHP scrips on new server with update version of PHP

P: n/a
Hi all,

I'm trying to help out a friend who has inherited a client with a PHP
shopping cart application. Neither of us know PHP, but I've been
muddling my way through, trying to get these old scripts working on a
new server with the most recent version of PHP. I've pretty much
taken care of all the various errors that were popping up. Most only
pointed out out non-fatal undefined or assumed variables. I've been
able to cure most of them by adding single quotes to array variables
and pre-defining variables that weren't being defined previously. But
I'm absolutely stumped on one last error that I can't seem to shake.

The error itself is:

Notice: Undefined index: cart.sum.tax.6 in
G:\squaretwo\inc.specialscart.php on line 54

Line 54 of the above mentioned script is:

$cart->tabulate_items("\$",0,($state == "NJ" ?
$values['cart.sum.tax.6'] : 0));

I don't know enough PHP to even know what cart.sum.tax.6 is supposed
to be. As I said, most of the problems I've encountered thus far have
been solved by adding single quotes (this line already has them) or
pre-defining variables (I don't even know what to define here!)

Any help would be much appreciated. The entire script in question is
below. Line 54 marked with **.

Thanks!
-laurie
th*********@yahoo.com

<?php

// if we're in the checkout
if (isset($checkout))
{
if (!isset($idhash))
{
// show cart
// create md5 hash as unique key and add to db with date
// show form for contact/delivery details

echo "<p>Current order status:</p>\n";
$cart->tabulate_items("\$");
echo "<p><a href=\"specials.php\">Continue shopping</a></p><br>\n";
$hash = md5(uniqid(microtime(),1));
echo "<p>Please complete your details:</p>\n";
show_contact_form($hash);
}
else
{
// when form submitted add details to db with md5 hash
// show form for credit card details

if (isset($firststage))
{
if ($lname=="" || $fname=="" || $address=="" || $city=="" ||
$state=="" || $zip=="" || $phone=="" || $email=="")
{
echo "<p>Current order status:</p>\n";
$cart->tabulate_items("\$");
echo "<p><a href=\"specials.php\">Continue
shopping</a></p><br>\n";
echo "<p>You must complete the entire form.</p>\n";
$sf->odSlashes($gpcVars,1);
show_contact_form($idhash);
}
else if (!$sf->validate_email($email))
{
echo "<p>Current order status:</p>\n";
$cart->tabulate_items("\$");
echo "<p><a href=\"specials.php\">Continue
shopping</a></p><br>\n";
echo "<p>That email address is invalid. You must enter your full
and correct email address.</p>\n";
$sf->odSlashes($gpcVars,1);
show_contact_form($idhash);
}
else
{
$gpcVars = string_functions::doSlashes($gpcVars,1);
$db->Insert("INSERT INTO {$cfgVars['tbl_purchases']}
(id,added,lname,fname,address,city,state,zip,phone ,email) " .
"VALUES('{$idhash}',NOW(),'{$gpcVars['lname']}','{$gpcVars['fname']}','{$gpcVars['address']}','{$gpcVars['city']}','{$gpcVars['state']}','{$gpcVars['zip']}','{$gpcVars['phone']}','{$gpcVars['email']}')");
$values = $cart->sum();
$ship->SetQuantity($cart->item_count());
$ship->setList($cart->print_list());
echo "<p>Current order status:</p>\n";
** $cart->tabulate_items("\$",0,($state == "NJ" ?
$values['cart.sum.tax.6'] : 0));
echo "<hr noshade>\n";
echo "<p>Shipping details:</p>\n";
show_shipping_form($idhash);
shipping_details();
echo "<hr noshade>\n";
echo "<p>Please enter your credit card details:</p>\n";
show_creditcard_form($idhash);
}
}

// get contact details

if (isset($secondstage))
{
//echo "<h1>List: ".$cart->print_list()."</h1>";
$ship->SetQuantity($cart->item_count());
$ship->setList($cart->print_list());
if (isset($shipchange))
{
echo "<h1>Shipcharge set</h2>";
$ship->SetOption($shipping);
$cart->tabulate_items("\$",0,($state == "NJ" ?
$values['cart.sum.tax.6'] : 0));
echo "<hr noshade>\n";
echo "<p>Shipping details:</p>\n";
show_shipping_form($idhash);
shipping_details();
echo "<hr noshade>\n";
echo "<p>Please enter your credit card details:</p>\n";
show_creditcard_form($idhash);
}
//commented out for testing
else if ($cc_name=="" || $cc_type=="" || $cc_number=="" ||
$cc_exp_mm=="" || $cc_exp_yy=="")
{
$cart->tabulate_items("\$",0,($state == "NJ" ?
$values['cart.sum.tax.6'] : 0));
echo "<hr noshade>\n";
echo "<p>Shipping details:</p>\n";
show_shipping_form($idhash);
shipping_details();
echo "<hr noshade>\n";
echo "<p>You must complete all of the form.</p>\n";
show_creditcard_form($idhash);
}
else if (!$cc->CheckCard($cc_type, $cc_number, $cc_exp_mm,
$cc_exp_yy))
{
$cart->tabulate_items("\$",0,($state == "NJ" ?
$values['cart.sum.tax.6'] : 0));
echo "<hr noshade>\n";
echo "<p>Shipping details:</p>\n";
show_shipping_form($idhash);
shipping_details();
echo "<hr noshade>\n";
echo "<p>That credit card number could not be verfied because of
an {$cc->CCerror}.</p>\n";
show_creditcard_form($idhash);
}

else
{
$db->QueryRow("SELECT * FROM {$cfgVars['tbl_purchases']} WHERE id
= '$idhash'");
$db->data = $sf->odSlashes($db->data);
$gpcVars = $sf->odSlashes($gpcVars);
echo "<p>Please verify the following information you
entered.</p>\n";

echo "<p><b>Address</b></p>\n";
echo "<p>{$db->data['fname']} {$db->data['lname']}<br>\n";
echo "{$db->data['address']}<br>\n";
echo "{$db->data['city']}, {$db->data['state']},
{$db->data['zip']}</p>\n";
echo "{$db->data['phone']}<br>{$db->data['email']}</p>\n";

echo "<p><b>Credit card details</b></p>\n";
echo "<p>{$gpcVars['cc_name']}<br>\n";
echo $cc->CardName($gpcVars['cc_type']),"<br>\n";
echo $gpcVars['cc_number'],"<br>\n";
echo "Expires on
{$gpcVars['cc_exp_mm']}/{$gpcVars['cc_exp_yy']}</p>\n";

echo "<p><b>Shopping Cart</b></p>\n";
$cart->tabulate_items("\$",0,($db->data['state'] == "NJ" ?
$values['cart.sum.tax.6'] : 0));

echo "<p><b>Shipping details</b><p>\n";
// if ($ship->ShowShippingDetails()) echo
"<p>",$ship->GetName(),": ", $ship->GetStrAtCost(1), "</p>\n";
if ($ship->ShowShippingDetails()) echo "<p>",$ship->GetName(),":
", $ship->GetStrAtCost(1), "</p>\n";

echo "<br>\n";

echo "<table border=\"0\" cellpadding=\"0\"
cellspacing=\"0\"><tr>";
echo "<td>",okay_form($db->data['id']),"</td><td>&nbsp;</td><td>",cancel_form($db->data['id']),"</td>";
echo "</tr></table>\n";
}
}

// cancel order
// remove from database

if (isset($cancel))
{
$db->Delete("DELETE FROM {$cfgVars['tbl_purchases']} WHERE id =
'$idhash'");
$ship->Reset();
echo "<p>You have cancelled the order form process. <a
href=\"$PHP_SELF\">Click here</a> to return to the shopping
cart.</p>\n";
}

// store cart
// compose and send email to wgu
// compose and send email to user
// give thank you

if (isset($complete))
{
$thecart = urlencode(base64_encode(gzcompress(serialize($cart ))));

$db->Update("UPDATE {$cfgVars['tbl_purchases']} SET
cart='$thecart',shipping='{$ship->SOusing}' WHERE id='$idhash'");

$cc_name = string_functions::odSlashes($cc_name);
$db->QueryRow("SELECT * FROM {$cfgVars['tbl_purchases']} WHERE id
= '$idhash'");
$db->data = $sf->odSlashes($db->data);
$details = "";
$details .= "Contact Information\n\n";
$details .= "{$db->data['fname']} {$db->data['lname']}\n";
$details .= "{$db->data['address']}\n";
$details .= "{$db->data['city']}, {$db->data['state']},
{$db->data['zip']}\n\n";
$details .= "Phone: {$db->data['phone']}\nEmail:
{$db->data['email']}\n\n";
$ccdetails = "";
$ccdetails .= "Credit Card Information\n\n";
$ccdetails .= "Name on card : {$cc_name}\n";
$ccdetails .= "CC Type : " . $cc->CardName($cc_type) . "\n";
$ccdetails .= "CC Number : {$cc_number}\n";
$ccdetails .= "CC Expiration : {$cc_exp_mm}/{$cc_exp_yy}\n\n";
$cartdetails = "";
$cartdetails .= "Cart details\n\n";
while ($values = $cart->show_next_item())
{
$values = string_functions::odSlashes($values);
// JohnO: Replace certain characters for readability
$patterns = array ("/°/");
$replace = array (" Deg.");
$values = preg_replace ($patterns, $replace, $values);

$cartdetails .= "SKU : {$values['cart.inumber']}\n";
$cartdetails .= "Name : {$values['cart.name']}\n";
$cartdetails .= "Size : {$values['cart.size']}\n";
$cartdetails .= "Description : {$values['cart.descr.0']}\n";
$cartdetails .= "Quantity : {$values['cart.quant']}\n";
$cartdetails .= "Price each : \${$values['cart.price']}\n\n";
}
$values = $cart->sum();
$tax = ($db->data['state'] == "NJ" ? $values['cart.sum.tax.6'] :
0);
$cartdetails .= "Total pre tax :
\${$values['cart.sum.gtotprice']}\n";
$cartdetails .= "Tax : \${$tax}\n";
$cartdetails .= "Total post tax : \$" .
($values['cart.sum.gtotprice'] + $tax) . "\n\n";
$shipdetails = "";
$shipdetails .= "Shipping Information\n\n";
if ($ship->GetType()=="E") {
$shipdetails .= "Shipping type : ***" . $ship->GetName() . "***
- " . $ship->GetDesc() . "\n";
}else{
$shipdetails .= "Shipping type : " . $ship->GetName() . " - " .
$ship->GetDesc() . "\n";
}
$shipdetails .= "Shipping cost : " . $ship->GetStrCost(1) .
"\n\n";
$total = "";
$total .= "Grand total : \$" .
sprintf("%.02f",$values['cart.sum.gtotprice'] + $tax +
($ship->GetTotalCost()==-1?0:$ship->GetTotalCost())) . "\n\n";

// do email to WGU

$headers = "From: {$db->data['fname']} {$db->data['lname']}
<{$db->data['email']}>\n";
$headers .= "X-Mailer: Specials Purchase Email\n";
$msg = "ATTENTION:\n\nA purchase was made from Square Two Golf
website. The details are as follows:\n\n";
$msg .= "---------------------------------------------------------------------------\n\n";
$msg .= $details;
$msg .= "---------------------------------------------------------------------------\n\n";
$msg .= $ccdetails;
$msg .= "---------------------------------------------------------------------------\n\n";
$msg .= $cartdetails;
$msg .= "---------------------------------------------------------------------------\n\n";
$msg .= $shipdetails;
$msg .= "---------------------------------------------------------------------------\n\n";
$msg .= $total;
$msg .= "---------------------------------------------------------------------------\n\n";
$msg .= "Purchase was made on " . date("l, F jS, Y \a\\t g:i a"
,time()) . ".\n\n";
$msg = wordwrap($msg,75);
@mail($cfgVars['email_purchase'],"PURCHASE MADE:
Specials",$msg,$headers);
//@mail("an****@innismaggiore.com","PURCHASE MADE:
Specials",$msg,$headers);
//@mail("jo***@innismaggiore.com","PURCHASE MADE:
Specials",$msg,$headers);

// do email to user

$headers = "From: Square Two Golf Specials Confirmation
<{$cfgVars['email_purchase']}>\n";
$headers .= "X-Mailer: Specials Purchase Confirmation Email\n";
$msg = "Thank you for your purchase from the Square Two Golf
website. This is your receipt, so please ";
$msg .= "save it or make a print out for your records.\n\n";
$msg .= "The details are as follows:\n\n";
$msg .= "--------------------------------------------------------------------------\n\n";
$msg .= $details;
$msg .= "---------------------------------------------------------------------------\n\n";
$msg .= $cartdetails;
$msg .= "---------------------------------------------------------------------------\n\n";
$msg .= $shipdetails;
$msg .= "---------------------------------------------------------------------------\n\n";
$msg .= $total;
$msg .= "---------------------------------------------------------------------------\n\n";
$msg .= "Purchase was made on " . date("l, F jS, Y \a\\t g:i a"
,time()) . ".\n\n";
$msg .= "Thank you very much for your order. We will ship your
merchandise promptly.\n";
$msg = wordwrap($msg,75);
@mail($db->data['email'],"PURCHASE CONFIRMATION: Square Two Golf
Specials",$msg,$headers);

// do finish up
$cart->Clear();
$ship->Reset();
echo "<p>Thank you for your order! We will ship your merchandise
promptly. A receipt has been ";
echo "sent to your email address. Please save or print it out for
your records.</p>\n";
}
}
}
else
{
// add a new product into the cart
if (isset($additem))
{
if ($cart->in_cart($itemid)) $cart->add_one($itemid);
else $cart->add_item($itemid, $itemname, 1, $itemprice, $itemtax,
array($itemdesc), $itemsize);
}
// update quantities
if (isset($update))
{
foreach ($inumber as $id => $quant)
{
$cart->update_item($id,$quant);
}
}
// remove all
if (isset($dellall))
{
$cart->clear();
$ship->Reset();
}
// show all products from the cart
if ($cart->show())
{
echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "<tr>\n<td>\n";
$cart->tabulate_items("\$",1);
echo "</td>\n</tr>\n";
echo "<tr>\n<td>\n<br>";
echo "<p>If you alter the quantities listed above, please be sure
to click on the 'update quantities' button.</p>\n";
echo "<input type=\"submit\" name=\"dellall\" value=\"remove all
items\"> &nbsp; <input type=\"submit\" name=\"update\" value=\"update
quantities\"> &nbsp; <input type=\"submit\" name=\"checkout\"
value=\"go to checkout\">\n";
echo "</td>\n</tr>\n</table>\n";
echo "</form>\n";
echo "<p><a href=\"specials.php\">Continue shopping</a></p><br>\n";
policies();
}
else
{
echo "<p>There are currently no items in your shopping
basket.</p>\n";
echo "<p><a href=\"specials.php\">Continue shopping</a></p><br>\n";
policies();
}
}
function show_contact_form($hash)
{
global $gpcVars,$stateList,$PHP_SELF;

if (!array_key_exists('fname',$gpcVars)) {
$gpcVars['fname'] = "";
$gpcVars['lname'] = "";
$gpcVars['address'] = "";
$gpcVars['city'] = "";
$gpcVars['state'] = "";
$gpcVars['zip'] = "";
$gpcVars['phone'] = "";
$gpcVars['email'] = "";
}

echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"checkout\" value=\"1\">\n";
echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash}\">\n";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"10\">\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">First name</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"fname\" size=\"30\" maxlength=\"48\" style=\"width: 200px;\"
value=\"{$gpcVars['fname']}\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Last name</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"lname\" size=\"30\" maxlength=\"48\" style=\"width: 200px;\"
value=\"{$gpcVars['lname']}\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Address</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"address\" size=\"30\" maxlength=\"128\" style=\"width: 200px;\"
value=\"{$gpcVars['address']}\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">City</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"city\" size=\"30\" maxlength=\"64\" style=\"width: 200px;\"
value=\"{$gpcVars['city']}\"></td>\n";
echo "</tr>\n";

echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">State</td>\n";
echo " <td valign=\"middle\" align=\"left\"><select
name=\"state\">";
foreach ($stateList as $abbr => $state)
{
echo "<option value=\"{$abbr}\"",($gpcVars['state'] == $abbr?"
selected":""),">{$state}</option>";
}
echo "</select></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Zipcode</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"zip\" size=\"30\" maxlength=\"5\" style=\"width: 200px;\"
value=\"{$gpcVars['zip']}\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Phone number</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"phone\" size=\"30\" maxlength=\"32\" style=\"width: 200px;\"
value=\"{$gpcVars['phone']}\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Email address</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"email\" size=\"30\" maxlength=\"256\" style=\"width: 200px;\"
value=\"{$gpcVars['email']}\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">&nbsp;</td>\n";
echo " <td valign=\"middle\" align=\"right\"><input type=\"submit\"
name=\"firststage\" value=\"continue with order\"></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";
}

function show_creditcard_form($hash)
{
global $gpcVars,$stateList,$PHP_SELF;

if (!array_key_exists('cc_name',$gpcVars)) {
$gpcVars['cc_name'] = "";
$gpcVars['cc_number'] = "";
$gpcVars['cc_type'] = "";
$gpcVars['cc_exp_mm'] = "";
$gpcVars['cc_exp_yy'] = "";
}

echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"checkout\" value=\"1\">\n";
echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash}\">\n";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"10\">\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Name on card</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"cc_name\" size=\"30\" maxlength=\"128\" style=\"width: 200px;\"
value=\"{$gpcVars['cc_name']}\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Card type</td>\n";
echo " <td valign=\"middle\" align=\"left\"><select
name=\"cc_type\">";
echo "<option value=\"M\"",($gpcVars['cc_type']=="M"?"
selected":""),">Mastercard</option>";
echo "<option value=\"V\"",($gpcVars['cc_type']=="V"?"
selected":""),">Visa</option>";
//echo "<option value=\"A\"",($gpcVars['cc_type']=="A"?"
selected":""),">American Express</option>";
echo "</select></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Card number</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"cc_number\" size=\"30\" maxlength=\"48\" style=\"width:
200px;\" value=\"{$gpcVars['cc_number']}\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Card
expiration</td>\n";
echo " <td valign=\"middle\" align=\"left\"><select
name=\"cc_exp_mm\"><option value=\"\">MM</option>";
for ($i=1; $i<=12; $i++) echo "<option
value=\"",sprintf("%02d",$i),"\"",($i==$gpcVars['cc_exp_mm']?"
selected":""),">",sprintf("%02d",$i),"</option>";
echo "</select> / <select name=\"cc_exp_yy\"><option
value=\"\">YYYY</option>";
for ($i=2002; $i<=2022; $i++) echo "<option
value=\"{$i}\"",($i==$gpcVars['cc_exp_yy']?"
selected":""),">$i</option>";
echo "</select></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">&nbsp;</td>\n";
echo " <td valign=\"middle\" align=\"right\"><input type=\"submit\"
name=\"secondstage\" value=\"verify order\"></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";
}

function show_shipping_form($hash)
{
global $gpcVars,$ship,$PHP_SELF;

echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"checkout\" value=\"1\">\n";
echo "<input type=\"hidden\" name=\"shipchange\" value=\"1\">\n";
echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash}\">\n";
echo "<p><select name=\"shipping\">";
$ship->ShowOptions();
echo "</select> <input type=\"submit\" name=\"secondstage\"
value=\"change shipping option\"></p>\n";
echo "</form>\n";
}

function okay_form($hash)
{
global $gpcVars,$PHP_SELF;

echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"checkout\" value=\"1\">\n";
echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash}\">\n";
echo "<input type=\"hidden\" name=\"cc_name\"
value=\"{$gpcVars['cc_name']}\">\n";
echo "<input type=\"hidden\" name=\"cc_type\"
value=\"{$gpcVars['cc_type']}\">\n";
echo "<input type=\"hidden\" name=\"cc_number\"
value=\"{$gpcVars['cc_number']}\">\n";
echo "<input type=\"hidden\" name=\"cc_exp_mm\"
value=\"{$gpcVars['cc_exp_mm']}\">\n";
echo "<input type=\"hidden\" name=\"cc_exp_yy\"
value=\"{$gpcVars['cc_exp_yy']}\">\n";
echo "<input type=\"submit\" name=\"complete\" value=\"complete
order\">\n";
echo "</form>\n";
}

function cancel_form($hash)
{
global $gpcVars,$PHP_SELF;

echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"checkout\" value=\"1\">\n";
echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash}\">\n";
echo "<input type=\"submit\" name=\"cancel\" value=\"cancel
order\">\n";
echo "</form>\n";
}

function shipping_details()
{
echo "<p class='bit_bigger'><b>Standard Shipping (UPS Ground):</b>
All in-stock items will ship within 24 business hours.</p>\n";
echo "<p class='bit_bigger'><b>Expedited Shipping (UPS Next Day Air
Saver):</b> All in-stock orders must be received by 1:00 p.m. EST
(Monday-Friday) to guarantee next day delivery. <b>Although most items
can be expedited, some items cannot be guranteed for Next Day
Delivery. We recommend you contact Customer Service directly at
800.526.2250 to place orders to be expedited to ensure desired
delivery.</b> Please call our Customer Service Department for rates on
items shipped outside the U.S., Alaska and Hawaii. ";
//echo "Expedited Shipping (UPS Next Day Air Saver): All orders
must be received by 1:00 p.m. EST (Monday-Friday) to guarantee next
day delivery. Please call our Customer Service Department for rates
on items shipped outside the U.S., Alaska and Hawaii.</p>\n";
echo "<p class='bit_bigger'><b>2nd Business Day Shipping (UPS 2nd
Day Air):</b> All orders must be received by 1:00 p.m. EST
(Monday-Friday) to guarantee 2nd day delivery. Please call our
Customer Service Department for rates on items shipped outside the
U.S., Alaska and Hawaii.</p>\n";
}

function policies()
{
?>
<p class="map_main">Return Policy</p>
<p>We are unable to accept product for return if it has been used.
If you feel a product is defective, please contact Customer Service
(800) 526-2250 to obtain an RMA# to return for evaluation.
A Return Authorization number must be obtained prior to returning
merchandise. If items are returned without a Return Authorization
number, neither a credit nor exchange can be processed.</p>
<p>If you have a problem with your order (came in wrong), please <a
href="contact.php">contact Customer Service</a>.</p>
<?
}

?>
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Look for where $values['cart.sum.tax.6'] is defined. Search for the string
'cart.sum.tax.6' and see if there's something resembling
$xxxxxx['cart.sum.tax.6'] = ...

Uzytkownik "laurie" <th*********@yahoo.com> napisal w wiadomosci
news:9a**************************@posting.google.c om...
Hi all,

I'm trying to help out a friend who has inherited a client with a PHP
shopping cart application. Neither of us know PHP, but I've been
muddling my way through, trying to get these old scripts working on a
new server with the most recent version of PHP. I've pretty much
taken care of all the various errors that were popping up. Most only
pointed out out non-fatal undefined or assumed variables. I've been
able to cure most of them by adding single quotes to array variables
and pre-defining variables that weren't being defined previously. But
I'm absolutely stumped on one last error that I can't seem to shake.

The error itself is:

Notice: Undefined index: cart.sum.tax.6 in
G:\squaretwo\inc.specialscart.php on line 54

Line 54 of the above mentioned script is:

$cart->tabulate_items("\$",0,($state == "NJ" ?
$values['cart.sum.tax.6'] : 0));

I don't know enough PHP to even know what cart.sum.tax.6 is supposed
to be. As I said, most of the problems I've encountered thus far have
been solved by adding single quotes (this line already has them) or
pre-defining variables (I don't even know what to define here!)

Any help would be much appreciated. The entire script in question is
below. Line 54 marked with **.

Thanks!
-laurie
th*********@yahoo.com

<?php

// if we're in the checkout
if (isset($checkout))
{
if (!isset($idhash))
{
// show cart
// create md5 hash as unique key and add to db with date
// show form for contact/delivery details

echo "<p>Current order status:</p>\n";
$cart->tabulate_items("\$");
echo "<p><a href=\"specials.php\">Continue shopping</a></p><br>\n";
$hash = md5(uniqid(microtime(),1));
echo "<p>Please complete your details:</p>\n";
show_contact_form($hash);
}
else
{
// when form submitted add details to db with md5 hash
// show form for credit card details

if (isset($firststage))
{
if ($lname=="" || $fname=="" || $address=="" || $city=="" ||
$state=="" || $zip=="" || $phone=="" || $email=="")
{
echo "<p>Current order status:</p>\n";
$cart->tabulate_items("\$");
echo "<p><a href=\"specials.php\">Continue
shopping</a></p><br>\n";
echo "<p>You must complete the entire form.</p>\n";
$sf->odSlashes($gpcVars,1);
show_contact_form($idhash);
}
else if (!$sf->validate_email($email))
{
echo "<p>Current order status:</p>\n";
$cart->tabulate_items("\$");
echo "<p><a href=\"specials.php\">Continue
shopping</a></p><br>\n";
echo "<p>That email address is invalid. You must enter your full
and correct email address.</p>\n";
$sf->odSlashes($gpcVars,1);
show_contact_form($idhash);
}
else
{
$gpcVars = string_functions::doSlashes($gpcVars,1);
$db->Insert("INSERT INTO {$cfgVars['tbl_purchases']}
(id,added,lname,fname,address,city,state,zip,phone ,email) " .
"VALUES('{$idhash}',NOW(),'{$gpcVars['lname']}','{$gpcVars['fname']}','{$gpc
Vars['address']}','{$gpcVars['city']}','{$gpcVars['state']}','{$gpcVars['zip
']}','{$gpcVars['phone']}','{$gpcVars['email']}')"); $values = $cart->sum();
$ship->SetQuantity($cart->item_count());
$ship->setList($cart->print_list());
echo "<p>Current order status:</p>\n";
** $cart->tabulate_items("\$",0,($state == "NJ" ?
$values['cart.sum.tax.6'] : 0));
echo "<hr noshade>\n";
echo "<p>Shipping details:</p>\n";
show_shipping_form($idhash);
shipping_details();
echo "<hr noshade>\n";
echo "<p>Please enter your credit card details:</p>\n";
show_creditcard_form($idhash);
}
}

// get contact details

if (isset($secondstage))
{
//echo "<h1>List: ".$cart->print_list()."</h1>";
$ship->SetQuantity($cart->item_count());
$ship->setList($cart->print_list());
if (isset($shipchange))
{
echo "<h1>Shipcharge set</h2>";
$ship->SetOption($shipping);
$cart->tabulate_items("\$",0,($state == "NJ" ?
$values['cart.sum.tax.6'] : 0));
echo "<hr noshade>\n";
echo "<p>Shipping details:</p>\n";
show_shipping_form($idhash);
shipping_details();
echo "<hr noshade>\n";
echo "<p>Please enter your credit card details:</p>\n";
show_creditcard_form($idhash);
}
//commented out for testing
else if ($cc_name=="" || $cc_type=="" || $cc_number=="" ||
$cc_exp_mm=="" || $cc_exp_yy=="")
{
$cart->tabulate_items("\$",0,($state == "NJ" ?
$values['cart.sum.tax.6'] : 0));
echo "<hr noshade>\n";
echo "<p>Shipping details:</p>\n";
show_shipping_form($idhash);
shipping_details();
echo "<hr noshade>\n";
echo "<p>You must complete all of the form.</p>\n";
show_creditcard_form($idhash);
}
else if (!$cc->CheckCard($cc_type, $cc_number, $cc_exp_mm,
$cc_exp_yy))
{
$cart->tabulate_items("\$",0,($state == "NJ" ?
$values['cart.sum.tax.6'] : 0));
echo "<hr noshade>\n";
echo "<p>Shipping details:</p>\n";
show_shipping_form($idhash);
shipping_details();
echo "<hr noshade>\n";
echo "<p>That credit card number could not be verfied because of
an {$cc->CCerror}.</p>\n";
show_creditcard_form($idhash);
}

else
{
$db->QueryRow("SELECT * FROM {$cfgVars['tbl_purchases']} WHERE id
= '$idhash'");
$db->data = $sf->odSlashes($db->data);
$gpcVars = $sf->odSlashes($gpcVars);
echo "<p>Please verify the following information you
entered.</p>\n";

echo "<p><b>Address</b></p>\n";
echo "<p>{$db->data['fname']} {$db->data['lname']}<br>\n";
echo "{$db->data['address']}<br>\n";
echo "{$db->data['city']}, {$db->data['state']},
{$db->data['zip']}</p>\n";
echo "{$db->data['phone']}<br>{$db->data['email']}</p>\n";

echo "<p><b>Credit card details</b></p>\n";
echo "<p>{$gpcVars['cc_name']}<br>\n";
echo $cc->CardName($gpcVars['cc_type']),"<br>\n";
echo $gpcVars['cc_number'],"<br>\n";
echo "Expires on
{$gpcVars['cc_exp_mm']}/{$gpcVars['cc_exp_yy']}</p>\n";

echo "<p><b>Shopping Cart</b></p>\n";
$cart->tabulate_items("\$",0,($db->data['state'] == "NJ" ?
$values['cart.sum.tax.6'] : 0));

echo "<p><b>Shipping details</b><p>\n";
// if ($ship->ShowShippingDetails()) echo
"<p>",$ship->GetName(),": ", $ship->GetStrAtCost(1), "</p>\n";
if ($ship->ShowShippingDetails()) echo "<p>",$ship->GetName(),":
", $ship->GetStrAtCost(1), "</p>\n";

echo "<br>\n";

echo "<table border=\"0\" cellpadding=\"0\"
cellspacing=\"0\"><tr>";
echo "<td>",okay_form($db->data['id']),"</td><td>&nbsp;</td><td>",cancel_form($db
->data['id']),"</td>"; echo "</tr></table>\n";
}
}

// cancel order
// remove from database

if (isset($cancel))
{
$db->Delete("DELETE FROM {$cfgVars['tbl_purchases']} WHERE id =
'$idhash'");
$ship->Reset();
echo "<p>You have cancelled the order form process. <a
href=\"$PHP_SELF\">Click here</a> to return to the shopping
cart.</p>\n";
}

// store cart
// compose and send email to wgu
// compose and send email to user
// give thank you

if (isset($complete))
{
$thecart = urlencode(base64_encode(gzcompress(serialize($cart ))));

$db->Update("UPDATE {$cfgVars['tbl_purchases']} SET
cart='$thecart',shipping='{$ship->SOusing}' WHERE id='$idhash'");

$cc_name = string_functions::odSlashes($cc_name);
$db->QueryRow("SELECT * FROM {$cfgVars['tbl_purchases']} WHERE id
= '$idhash'");
$db->data = $sf->odSlashes($db->data);
$details = "";
$details .= "Contact Information\n\n";
$details .= "{$db->data['fname']} {$db->data['lname']}\n";
$details .= "{$db->data['address']}\n";
$details .= "{$db->data['city']}, {$db->data['state']},
{$db->data['zip']}\n\n";
$details .= "Phone: {$db->data['phone']}\nEmail:
{$db->data['email']}\n\n";
$ccdetails = "";
$ccdetails .= "Credit Card Information\n\n";
$ccdetails .= "Name on card : {$cc_name}\n";
$ccdetails .= "CC Type : " . $cc->CardName($cc_type) . "\n";
$ccdetails .= "CC Number : {$cc_number}\n";
$ccdetails .= "CC Expiration : {$cc_exp_mm}/{$cc_exp_yy}\n\n";
$cartdetails = "";
$cartdetails .= "Cart details\n\n";
while ($values = $cart->show_next_item())
{
$values = string_functions::odSlashes($values);
// JohnO: Replace certain characters for readability
$patterns = array ("/°/");
$replace = array (" Deg.");
$values = preg_replace ($patterns, $replace, $values);

$cartdetails .= "SKU : {$values['cart.inumber']}\n";
$cartdetails .= "Name : {$values['cart.name']}\n";
$cartdetails .= "Size : {$values['cart.size']}\n";
$cartdetails .= "Description : {$values['cart.descr.0']}\n";
$cartdetails .= "Quantity : {$values['cart.quant']}\n";
$cartdetails .= "Price each : \${$values['cart.price']}\n\n";
}
$values = $cart->sum();
$tax = ($db->data['state'] == "NJ" ? $values['cart.sum.tax.6'] :
0);
$cartdetails .= "Total pre tax :
\${$values['cart.sum.gtotprice']}\n";
$cartdetails .= "Tax : \${$tax}\n";
$cartdetails .= "Total post tax : \$" .
($values['cart.sum.gtotprice'] + $tax) . "\n\n";
$shipdetails = "";
$shipdetails .= "Shipping Information\n\n";
if ($ship->GetType()=="E") {
$shipdetails .= "Shipping type : ***" . $ship->GetName() . "***
- " . $ship->GetDesc() . "\n";
}else{
$shipdetails .= "Shipping type : " . $ship->GetName() . " - " .
$ship->GetDesc() . "\n";
}
$shipdetails .= "Shipping cost : " . $ship->GetStrCost(1) .
"\n\n";
$total = "";
$total .= "Grand total : \$" .
sprintf("%.02f",$values['cart.sum.gtotprice'] + $tax +
($ship->GetTotalCost()==-1?0:$ship->GetTotalCost())) . "\n\n";

// do email to WGU

$headers = "From: {$db->data['fname']} {$db->data['lname']}
<{$db->data['email']}>\n";
$headers .= "X-Mailer: Specials Purchase Email\n";
$msg = "ATTENTION:\n\nA purchase was made from Square Two Golf
website. The details are as follows:\n\n";
$msg .= "---------------------------------------------------------------------------
\n\n"; $msg .= $details;
$msg .= "---------------------------------------------------------------------------
\n\n"; $msg .= $ccdetails;
$msg .= "---------------------------------------------------------------------------
\n\n"; $msg .= $cartdetails;
$msg .= "---------------------------------------------------------------------------
\n\n"; $msg .= $shipdetails;
$msg .= "---------------------------------------------------------------------------
\n\n"; $msg .= $total;
$msg .= "---------------------------------------------------------------------------
\n\n"; $msg .= "Purchase was made on " . date("l, F jS, Y \a\\t g:i a"
,time()) . ".\n\n";
$msg = wordwrap($msg,75);
@mail($cfgVars['email_purchase'],"PURCHASE MADE:
Specials",$msg,$headers);
//@mail("an****@innismaggiore.com","PURCHASE MADE:
Specials",$msg,$headers);
//@mail("jo***@innismaggiore.com","PURCHASE MADE:
Specials",$msg,$headers);

// do email to user

$headers = "From: Square Two Golf Specials Confirmation
<{$cfgVars['email_purchase']}>\n";
$headers .= "X-Mailer: Specials Purchase Confirmation Email\n";
$msg = "Thank you for your purchase from the Square Two Golf
website. This is your receipt, so please ";
$msg .= "save it or make a print out for your records.\n\n";
$msg .= "The details are as follows:\n\n";
$msg .= "---------------------------------------------------------------------------
\n\n"; $msg .= $details;
$msg .= "---------------------------------------------------------------------------
\n\n"; $msg .= $cartdetails;
$msg .= "---------------------------------------------------------------------------
\n\n"; $msg .= $shipdetails;
$msg .= "---------------------------------------------------------------------------
\n\n"; $msg .= $total;
$msg .= "---------------------------------------------------------------------------
\n\n"; $msg .= "Purchase was made on " . date("l, F jS, Y \a\\t g:i a"
,time()) . ".\n\n";
$msg .= "Thank you very much for your order. We will ship your
merchandise promptly.\n";
$msg = wordwrap($msg,75);
@mail($db->data['email'],"PURCHASE CONFIRMATION: Square Two Golf
Specials",$msg,$headers);

// do finish up
$cart->Clear();
$ship->Reset();
echo "<p>Thank you for your order! We will ship your merchandise
promptly. A receipt has been ";
echo "sent to your email address. Please save or print it out for
your records.</p>\n";
}
}
}
else
{
// add a new product into the cart
if (isset($additem))
{
if ($cart->in_cart($itemid)) $cart->add_one($itemid);
else $cart->add_item($itemid, $itemname, 1, $itemprice, $itemtax,
array($itemdesc), $itemsize);
}
// update quantities
if (isset($update))
{
foreach ($inumber as $id => $quant)
{
$cart->update_item($id,$quant);
}
}
// remove all
if (isset($dellall))
{
$cart->clear();
$ship->Reset();
}
// show all products from the cart
if ($cart->show())
{
echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "<tr>\n<td>\n";
$cart->tabulate_items("\$",1);
echo "</td>\n</tr>\n";
echo "<tr>\n<td>\n<br>";
echo "<p>If you alter the quantities listed above, please be sure
to click on the 'update quantities' button.</p>\n";
echo "<input type=\"submit\" name=\"dellall\" value=\"remove all
items\"> &nbsp; <input type=\"submit\" name=\"update\" value=\"update
quantities\"> &nbsp; <input type=\"submit\" name=\"checkout\"
value=\"go to checkout\">\n";
echo "</td>\n</tr>\n</table>\n";
echo "</form>\n";
echo "<p><a href=\"specials.php\">Continue shopping</a></p><br>\n";
policies();
}
else
{
echo "<p>There are currently no items in your shopping
basket.</p>\n";
echo "<p><a href=\"specials.php\">Continue shopping</a></p><br>\n";
policies();
}
}
function show_contact_form($hash)
{
global $gpcVars,$stateList,$PHP_SELF;

if (!array_key_exists('fname',$gpcVars)) {
$gpcVars['fname'] = "";
$gpcVars['lname'] = "";
$gpcVars['address'] = "";
$gpcVars['city'] = "";
$gpcVars['state'] = "";
$gpcVars['zip'] = "";
$gpcVars['phone'] = "";
$gpcVars['email'] = "";
}

echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"checkout\" value=\"1\">\n";
echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash}\">\n";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"10\">\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">First name</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"fname\" size=\"30\" maxlength=\"48\" style=\"width: 200px;\"
value=\"{$gpcVars['fname']}\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Last name</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"lname\" size=\"30\" maxlength=\"48\" style=\"width: 200px;\"
value=\"{$gpcVars['lname']}\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Address</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"address\" size=\"30\" maxlength=\"128\" style=\"width: 200px;\"
value=\"{$gpcVars['address']}\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">City</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"city\" size=\"30\" maxlength=\"64\" style=\"width: 200px;\"
value=\"{$gpcVars['city']}\"></td>\n";
echo "</tr>\n";

echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">State</td>\n";
echo " <td valign=\"middle\" align=\"left\"><select
name=\"state\">";
foreach ($stateList as $abbr => $state)
{
echo "<option value=\"{$abbr}\"",($gpcVars['state'] == $abbr?"
selected":""),">{$state}</option>";
}
echo "</select></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Zipcode</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"zip\" size=\"30\" maxlength=\"5\" style=\"width: 200px;\"
value=\"{$gpcVars['zip']}\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Phone number</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"phone\" size=\"30\" maxlength=\"32\" style=\"width: 200px;\"
value=\"{$gpcVars['phone']}\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Email address</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"email\" size=\"30\" maxlength=\"256\" style=\"width: 200px;\"
value=\"{$gpcVars['email']}\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">&nbsp;</td>\n";
echo " <td valign=\"middle\" align=\"right\"><input type=\"submit\"
name=\"firststage\" value=\"continue with order\"></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";
}

function show_creditcard_form($hash)
{
global $gpcVars,$stateList,$PHP_SELF;

if (!array_key_exists('cc_name',$gpcVars)) {
$gpcVars['cc_name'] = "";
$gpcVars['cc_number'] = "";
$gpcVars['cc_type'] = "";
$gpcVars['cc_exp_mm'] = "";
$gpcVars['cc_exp_yy'] = "";
}

echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"checkout\" value=\"1\">\n";
echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash}\">\n";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"10\">\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Name on card</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"cc_name\" size=\"30\" maxlength=\"128\" style=\"width: 200px;\"
value=\"{$gpcVars['cc_name']}\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Card type</td>\n";
echo " <td valign=\"middle\" align=\"left\"><select
name=\"cc_type\">";
echo "<option value=\"M\"",($gpcVars['cc_type']=="M"?"
selected":""),">Mastercard</option>";
echo "<option value=\"V\"",($gpcVars['cc_type']=="V"?"
selected":""),">Visa</option>";
//echo "<option value=\"A\"",($gpcVars['cc_type']=="A"?"
selected":""),">American Express</option>";
echo "</select></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Card number</td>\n";
echo " <td valign=\"middle\" align=\"left\"><input type=\"text\"
name=\"cc_number\" size=\"30\" maxlength=\"48\" style=\"width:
200px;\" value=\"{$gpcVars['cc_number']}\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">Card
expiration</td>\n";
echo " <td valign=\"middle\" align=\"left\"><select
name=\"cc_exp_mm\"><option value=\"\">MM</option>";
for ($i=1; $i<=12; $i++) echo "<option
value=\"",sprintf("%02d",$i),"\"",($i==$gpcVars['cc_exp_mm']?"
selected":""),">",sprintf("%02d",$i),"</option>";
echo "</select> / <select name=\"cc_exp_yy\"><option
value=\"\">YYYY</option>";
for ($i=2002; $i<=2022; $i++) echo "<option
value=\"{$i}\"",($i==$gpcVars['cc_exp_yy']?"
selected":""),">$i</option>";
echo "</select></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td valign=\"middle\" align=\"right\">&nbsp;</td>\n";
echo " <td valign=\"middle\" align=\"right\"><input type=\"submit\"
name=\"secondstage\" value=\"verify order\"></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";
}

function show_shipping_form($hash)
{
global $gpcVars,$ship,$PHP_SELF;

echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"checkout\" value=\"1\">\n";
echo "<input type=\"hidden\" name=\"shipchange\" value=\"1\">\n";
echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash}\">\n";
echo "<p><select name=\"shipping\">";
$ship->ShowOptions();
echo "</select> <input type=\"submit\" name=\"secondstage\"
value=\"change shipping option\"></p>\n";
echo "</form>\n";
}

function okay_form($hash)
{
global $gpcVars,$PHP_SELF;

echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"checkout\" value=\"1\">\n";
echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash}\">\n";
echo "<input type=\"hidden\" name=\"cc_name\"
value=\"{$gpcVars['cc_name']}\">\n";
echo "<input type=\"hidden\" name=\"cc_type\"
value=\"{$gpcVars['cc_type']}\">\n";
echo "<input type=\"hidden\" name=\"cc_number\"
value=\"{$gpcVars['cc_number']}\">\n";
echo "<input type=\"hidden\" name=\"cc_exp_mm\"
value=\"{$gpcVars['cc_exp_mm']}\">\n";
echo "<input type=\"hidden\" name=\"cc_exp_yy\"
value=\"{$gpcVars['cc_exp_yy']}\">\n";
echo "<input type=\"submit\" name=\"complete\" value=\"complete
order\">\n";
echo "</form>\n";
}

function cancel_form($hash)
{
global $gpcVars,$PHP_SELF;

echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"checkout\" value=\"1\">\n";
echo "<input type=\"hidden\" name=\"idhash\" value=\"{$hash}\">\n";
echo "<input type=\"submit\" name=\"cancel\" value=\"cancel
order\">\n";
echo "</form>\n";
}

function shipping_details()
{
echo "<p class='bit_bigger'><b>Standard Shipping (UPS Ground):</b>
All in-stock items will ship within 24 business hours.</p>\n";
echo "<p class='bit_bigger'><b>Expedited Shipping (UPS Next Day Air
Saver):</b> All in-stock orders must be received by 1:00 p.m. EST
(Monday-Friday) to guarantee next day delivery. <b>Although most items
can be expedited, some items cannot be guranteed for Next Day
Delivery. We recommend you contact Customer Service directly at
800.526.2250 to place orders to be expedited to ensure desired
delivery.</b> Please call our Customer Service Department for rates on
items shipped outside the U.S., Alaska and Hawaii. ";
//echo "Expedited Shipping (UPS Next Day Air Saver): All orders
must be received by 1:00 p.m. EST (Monday-Friday) to guarantee next
day delivery. Please call our Customer Service Department for rates
on items shipped outside the U.S., Alaska and Hawaii.</p>\n";
echo "<p class='bit_bigger'><b>2nd Business Day Shipping (UPS 2nd
Day Air):</b> All orders must be received by 1:00 p.m. EST
(Monday-Friday) to guarantee 2nd day delivery. Please call our
Customer Service Department for rates on items shipped outside the
U.S., Alaska and Hawaii.</p>\n";
}

function policies()
{
?>
<p class="map_main">Return Policy</p>
<p>We are unable to accept product for return if it has been used.
If you feel a product is defective, please contact Customer Service
(800) 526-2250 to obtain an RMA# to return for evaluation.
A Return Authorization number must be obtained prior to returning
merchandise. If items are returned without a Return Authorization
number, neither a credit nor exchange can be processed.</p>
<p>If you have a problem with your order (came in wrong), please <a
href="contact.php">contact Customer Service</a>.</p>
<?
}

?>

Jul 17 '05 #2

P: n/a
"Chung Leong" <ch***********@hotmail.com> wrote in message news:<su********************@comcast.com>...
Look for where $values['cart.sum.tax.6'] is defined. Search for the string
'cart.sum.tax.6' and see if there's something resembling
$xxxxxx['cart.sum.tax.6'] = ...


There isn't. However, there are "class" files being included at the
top of the page, and in those files are what appears to be classes
being defined. Rather than defining a function, such as this:

function myfunction {
....
}

they're this:

class myclass {
....
}

In that class are variables being defined (with var) called $cart,
$tax, etc. Is cart.sum.tax.6 some funky way of referencing values in
those classes? And is there something different between an old
version of PHP and the latest version that would make variables being
defined with "var" inaccessible when they're included in another file?

Thanks for your help,

-laurie
Jul 17 '05 #3

P: n/a
No. $values['cart.sum.tax.6'] means "getting the value from an associative
array with the key cart.sum.tax.6".

I seems to me that whoever wrote the code was being too clever. Insert this
snippet at the line where the error and trace backward through the code to
see where $values is set.

$backtrace = debug_backtrace();
foreach($backtrace as $call) {
extract($call);
if($class) {
echo "{$class}->";
}
echo "$function() <i>$file, line $line </i><br>";
}

Uzytkownik "laurie" <th*********@yahoo.com> napisal w wiadomosci
news:9a*************************@posting.google.co m...
In that class are variables being defined (with var) called $cart,
$tax, etc. Is cart.sum.tax.6 some funky way of referencing values in
those classes? And is there something different between an old
version of PHP and the latest version that would make variables being
defined with "var" inaccessible when they're included in another file?

Thanks for your help,

-laurie

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.