View Basket"; $subtotal = 0; // display contents of basket // get basket id $basket_query = " SELECT basket_id, status FROM $basket WHERE session_id = $sid"; $basket_result = db_query($basket_query); if (!$basket_result) { // error include ("templates/footer.htm"); exit; } $basket_row = db_fetch_array($basket_result); $basket_id = $basket_row['basket_id']; if ($basket_row['Status'] == "OK") { // already paid echo "

You have already purchased these products.

"; include ("templates/footer.htm"); exit; } /* // get products with options $producto_query = " SELECT $versions.title AS version, $versions.price AS price, $licences.title AS licence, $licences.price_extra AS option_price, $basket_items.item_id AS item_id, $basket_items.quantity AS quantity FROM $versions, $licences, $basket_items WHERE $basket_items.basket_id = $basket_id AND $basket_items.version_id = $versions.version_id AND $versions.version_id = $licences.version_id AND $licences.licence_id = $basket_items.licence_id"; // get products without options $productn_query = " SELECT $versions.title AS version, $versions.price AS price, \"-\" AS licence, 0 AS option_price, $basket_items.item_id AS item_id, $basket_items.quantity AS quantity FROM $versions, $basket_items WHERE $basket_items.basket_id = $basket_id AND $basket_items.version_id = $versions.version_id AND $basket_items.licence_id = 0"; $producto_result = db_query($producto_query); $productn_result = db_query($productn_query); */ $product_query = " SELECT item_id, description, price, quantity, extended_price FROM $basket_items WHERE basket_id = $basket_id"; $product_result = db_query($product_query); //if ( (!$producto_result || db_num_rows($producto_result) < 1) && (!$productn_result || db_num_rows($productn_result) < 1) ) if (!$product_result || db_num_rows($product_result) < 1) { // empty basket echo "

Your basket is empty.

"; include ("templates/footer.htm"); exit; } echo ""; echo ""; $product_counter = 1; while (list($item_id, $description, $price, $quantity, $extended_price) = db_fetch_array($product_result)) { $subtotal += $price; echo ""; echo ""; $product_counter ++; } // update subtotal $sub_query = " SELECT SUM(extended_price) FROM basket_items WHERE basket_id = $basket_id"; $sub_result = db_query($sub_query); list($subtotal) = db_fetch_array($sub_result); $update_query = " UPDATE basket SET subtotal = $subtotal WHERE basket_id = $basket_id"; /* echo ""; echo "
ItemPriceQuantityExtended Price
$description£"; printf ("%01.2f", $price); ?>
 
remove from basket
Subtotal"; printf("£%01.2f", $subtotal); echo " 
"; */ /* if (!$productn_result || db_num_rows($productn_result) < 1) {} else { /* echo ""; echo ""; */ /* if (!isset($product_counter)) $product_counter = 1; while ($productn_row = db_fetch_array($productn_result)) { $subtotal += (($productn_row['price'] + $productn_row['option_price']) * $productn_row['quantity']); echo ""; echo ""; echo ""; $producto_counter ++; } */ echo ""; echo "
ItemOptionPriceQuantityExtended PriceChange
" . $productn_row['version'] . "" . $productn_row['licence'] . "£"; printf ("%01.2f", $productn_row['price'] + $productn_row['option_price']); //echo "" . $productn_row['quantity'] . ""; ?>
 
remove from basket
Subtotal"; printf("£%01.2f", $subtotal); echo "
"; //} ?>
Tax and shipping will be calculated at checkout.