Click to See Complete Forum and Search --> : shopping cart problem


ibo_dngo
04-27-2005, 05:54 PM
i have a simple shopping cart to be work and i come up to this problem
when i want to move from show_cart script to checkout_php script it gives me checkout form ampty with massege tall that there is no itmes in your crad
i have not set up ssl and i want to work with out it to see how to work
and this is my code:
Thanks so much!!!!

...

<?php
include ('book_sc_fns.php');
// The shopping cart needs sessions, so start one
session_start();
@ $new = $_GET['new'];
if($new)
{
//new item selected
if(!session_is_registered('cart'))
{
$_SESSION['cart'] = array();
$_SESSION['items'] = 0;
$_SESSION['total_price'] ='0.00';
}
if(isset($_SESSION['cart'][$new]))
$_SESSION['cart'][$new]++;
else
$_SESSION['cart'][$new] = 1;
$_SESSION['total_price'] = calculate_price($_SESSION['cart']);
$_SESSION['items'] = calculate_items($_SESSION['cart']);
}
if(isset($_SESSION['save']))
{
foreach ($_SESSION['cart'] as $modelnum => $qty)
{
if
($_SESSION[$modelnum]=='0')
unset($_SESSION['cart'][$modelnum]);
else
$_SESSION['cart'][$modelnum] = $_SESSION[$modelnum];
}
$_SESSION['total_price'] = calculate_price($_SESSION['cart']);
$_SESSION['items'] = calculate_items($_SESSION['cart']);
}
do_html_header('Your Shopping Cart');
if($_SESSION['cart']&&array_count_values($_SESSION['cart']))
display_cart($_SESSION['cart']);
else
{
echo '<p>There are no items in your cart</p>';
echo '<hr />';
}
$target = 'index.php';
// if we have just added an item to the cart, continue shopping in that category
if($new)
{
$details = get_book_details($new);
if($details['catid'])
$target = 'show_cat.php?catid='.$details['catid'];
}
display_button($target, 'continue-shopping', 'Continue Shopping');
// use this if SSL is set up
// $path = $HTTP_SERVER_VARS['PHP_SELF'];
// $server = $HTTP_SERVER_VARS['SERVER_NAME'];
// $path = str_replace('show_cart.php', '', $path);
// display_button('https://'.$server.$path.'checkout.php','go-to-checkout', 'Go To Checkout');
// if no SSL use below code
display_button('checkout.php', 'go-to-checkout', 'Go To Checkout');
do_html_footer();
?>

and here is the checkout.php script

<?php
//include our function set
include ('book_sc_fns.php');
// The shopping cart needs sessions, so start one
session_start();
do_html_header('Checkout');
if($_SESSION['cart']&&array_count_values($_SESSION['cart']))
{
display_checkout_form();
display_cart($_SESSION['cart'], true, 1);
}
else
echo '<p>There are no items in your cart</p>';
display_button('show_cart.php', 'continue-shopping', 'Continue Shopping');
do_html_footer();
?>
i need your help to learn what is wrong with my shopping card

planetsim
04-27-2005, 08:56 PM
This forum is for finished working code to be critiqued by members. Secondly when posting code use tags, you would get more help then.

Weedpacket
04-30-2005, 02:56 AM
And when you post, try a little bit harder to write properly, and then people will try a little bit harder to help.