0 && $_SESSION['scl_i_id'][$key] == $i_id) { /* * The item is already in the cart ... incease * the quenity by one */ $_SESSION['scl_qty'][$key]++; } else { /* * Item not in the cart ... lookup item data and * add it with quantity 1 */ $row = wrap('db_shop_cart_get_item', $i_id); if (!$row) { tpcw_error("Illegal item ID " . $i_id); } $_SESSION['scl_i_id'][] = $i_id; $_SESSION['scl_qty'][] = 1; $_SESSION['scl_cost'][] = $row[0]; $_SESSION['scl_srp'][] = $row[1]; $_SESSION['scl_title'][] = $row[2]; $_SESSION['scl_backing'][] = $row[3]; } $_SESSION['sc_date_sec'] = time(); } else { $cart_full = true; } } else { /* * add_flag not "Y" - get all updates/removes from the form */ $keys = array_keys($_SESSION['scl_i_id']); while (list($idx, $key) = each($keys)) { $name_id = "I_ID_" . $key; $name_qty = "QTY_" . $key; if (isset($vars[$name_id]) && $_SESSION['scl_i_id'][$key] == $vars[$name_id]) { $qty = (integer)$vars[$name_qty]; if ($qty == 0) { unset($_SESSION['scl_i_id'][$key]); unset($_SESSION['scl_qty'][$key]); unset($_SESSION['scl_cost'][$key]); unset($_SESSION['scl_srp'][$key]); unset($_SESSION['scl_title'][$key]); unset($_SESSION['scl_backing'][$key]); } else { $_SESSION['scl_qty'][$key] = $qty; } $_SESSION['sc_date_sec'] = time(); } } /* * If we have an empty shopping cart, add a promotional item */ if (sizeof($_SESSION['scl_i_id']) == 0) { $i_id = tpcw_rand(1, $num_items); $row = wrap('db_shop_cart_get_promitem', $i_id); if (!$row) { tpcw_error("Promotional item for " . $i_id . " not found"); } $_SESSION['scl_i_id'][] = $row[0]; $_SESSION['scl_qty'][] = 1; $_SESSION['scl_cost'][] = $row[1]; $_SESSION['scl_srp'][] = $row[2]; $_SESSION['scl_title'][] = $row[3]; $_SESSION['scl_backing'][] = $row[4]; $_SESSION['sc_date_sec'] = time(); } } /* * Generate the promotional item output */ $promotional = tpcw_promotional(); db_commit_transaction(); db_disconnect(); ?> TPC-W Shopping Cart

TPC Web Commerce Benchmark (TPC-W)

Shopping Cart Page

"; echo "Cannot add more items, shopping cart is full!"; echo "\n"; } ?>
"; echo ""; echo ""; echo "\n"; $sc_sub_total = $sc_sub_total + (double)$_SESSION['scl_cost'][$key] * (double)$_SESSION['scl_qty'][$key]; } ?>
Qty: Product:
"; echo ""; echo ""; echo "

"; echo "" . $_SESSION['scl_title'][$key] . " - Backing: " . $_SESSION['scl_backing'][$key]; echo " (ID:" . $_SESSION['scl_i_id'][$key] . ") "; echo "
"; echo "SRP. $" . $_SESSION['scl_srp'][$key] . ", "; echo "Your Price: $" . $_SESSION['scl_cost'][$key] . ""; echo "

Subtotal Price: $
Last updated:


If you have changed the quantities and/or taken anything out
of your shopping cart, click here to refresh your shopping cart:

\n"; ?>