"; print_r( $_COOKIE ); echo "";
require( "includes.req" );
require_once( "class_checkout.req" );
require_once( "class_cart.req" );
require_once( "class_item_master.req" );
require_once( "class_products.req" );
require_once( "class_skipjack.req" );
ExpireHeaders();
$sUseraction = isset( $_POST[ "useraction" ] ) ? $_POST[ "useraction" ] :
( isset( $_GET[ "useraction" ] ) ? $_GET[ "useraction" ] : "" );
$bNo_Account = isset( $_POST[ "no_account" ] ) ?
( $_POST[ "no_account" ] == 1 ? true : false ) : false;
$sNew_User = isset( $_POST[ "new_user" ] ) ? $_POST[ "new_user" ] : 'f';
if ( $sNew_User == 't')
{
$sUseraction = "sign_up";
}
//
// Layout value holders
//
$sFocus = "";
$sView = "";
//
// Standard object creation. These must be global as .view files
// expect them to exist.
//
$oForm = new Form();
//
// Module-specific objects
//
$oCheckout = new Checkout();
$bHas_Session = $oCheckout->HasSession();
$oProducts = new Products();
$oCart = new Cart;
//echo "[" . $sUseraction . "]
";
if ( $oCart->ItemCount() < 1 )
{
$oCart->bChecking_Out = true;
$oCart->SetView( false );
$sUseraction = "view";
require( "cart.view" );
exit;
}
//echo "
";
switch ( $sUseraction )
{
case "photo":
$sUseraction = "uploaded";
$sView = "upload_photos.view";
break;
case "payment":
$oCheckout->SetPaymentForm();
$sUseraction = "proc_payment";
$sView = "checkout_payment.view";
break;
case "proc_payment":
if ( !$oCheckout->ProcessPaymentForm() )
{
$oCheckout->SetPaymentForm( true );
$sUseraction = "proc_payment";
$sView = "checkout_payment.view";
break;
}
$oCheckout->SetFinishedForm( false );
$sUseraction = "";
$sView = "checkout_finished.view";
break;
case "change_ship_method":
case "review_cart_back":
$oCheckout->oForm->LoadSubmit( $oCheckout->aFields );
$oCheckout->SetReviewCartForm();
$sUseraction = "payment";
$sView = "checkout_review_cart.view";
break;
case "proc_billing_shipping":
if ( !$oCheckout->ProcessBillingShippingForm( $bNo_Account ) )
{
$oCheckout->SetBillingShippingForm( true, true );
$sView = "checkout_billing_shipping.view";
break;
}
$oCheckout->SetReviewCartForm();
$sUseraction = "payment";
$sView = "checkout_review_cart.view";
break;
case "billing_shipping_back":
$oCheckout->oForm->LoadSubmit( $oCheckout->aFields );
case "billing_shipping":
$oCheckout->SetBillingShippingForm( true );
$sUseraction = "proc_billing_shipping";
$sView = "checkout_billing_shipping.view";
break;
case "":
default:
//
// If the user has already signed in, do billing/shipping/coupon
// form.
//
if ( $bHas_Session )
{
//echo "HAS SESSION-=--------------
";
$oCheckout->SetBillingShippingForm( false, false );
$sUseraction = "proc_billing_shipping";
$sView = "checkout_billing_shipping.view";
break;
}
else
{
//echo "no session-------------------------
";
}
$oCheckout->SetStartForm();
//$sUseraction = "proc_sign_in";
$sView = "checkout_start.view";
break;
}
echo "
";
if ( !blank( $sView ) )
{
require( $sView );
}
?>