<?php
	include "includes/config.php";
	include "includes/session.php";
	include "includes/functions.php";
	$transstatus=$_REQUEST['transStatus'];
	$cartId=$_REQUEST['cartId'];
	$_SESSION['cartId']=$cartId;
	
	if(isset($_REQUEST['transStatus']) && $_REQUEST['transStatus']=='Y')
		{ // check while cart status is updated or not 
				
				if (!empty($cartId)) { // updating cart page 
        $sql = mysql_query("UPDATE  " . $tableprefix . "orders SET vpayment_status='C' WHERE order_id='" . $_SESSION['cartId'] . "'") or die(mysql_error());
    }

    $check_shipping_enable = checkShippingEnable();
    if ($check_shipping_enable == "Y") { 
        if (function_exists('session_unregister')) {
            session_unregister('SESS_upstype');

            session_unregister('SESS_upscost');

            session_unregister('SESS_upsweight');
        } else {

            unset($_SESSION['SESS_upstype']);
            unset($_SESSION['SHIPPING_TOTAL']);
            unset($_SESSION['SESS_upsweight']);
        }
    }

    emptyCart($_SESSION["sess_userid"]);

    $_SESSION["sess_addresses_collected"] = false;

    $_SESSION["sess_stock_adjusted"] = false;
    $_SESSION["sess_addresses_collected"] = false;
    $_SESSION["sess_stock_adjusted"] = false;
    $_SESSION['couponCode_det'] = '';
    if (isset($_SESSION['guest_login']) && $_SESSION['guest_login'] != '') {
        if (function_exists('session_unregister')) {
            session_unregister($_SESSION['guest_login']);
            session_unregister($_SESSION['sess_userid']);
        } else {
            unset($_SESSION['guest_login']);
            unset($_SESSION['sess_userid']);
        }
        $_SESSION['guest_login'] = '';
        $_SESSION["sess_userid"] = '';
    }
    $_SESSION["sess_guest_username"] = '';
    $_SESSION["sess_guest_password"] = '';
    $_SESSION["sessShippingDisplayName"] = '';
    $_SESSION['sess_giftcertificate_code'] = '';
    $_SESSION['sess_gift_amount_used'] = '';
    $_SESSION['amount_paid'] = '';
    $_SESSION['sess_giftcertificate_available_amt'] = '';
    $_SESSION["SESS_BUYER_COMMENTS"] = '';
    $_SESSION["TAX_TOTAL"] = '';
    unset($_SESSION['SHIPPING_TOTAL']);
    $_SESSION["SHIPPING_DETAILS"] = array();
    unset($_SESSION["SHIPPING_DETAILS"]);
    unset($_SESSION["TAX_DETAILS"]);
    unset($_SESSION['couponCode_det']);
		
} // end cart ststus check 

?>