// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
include_once "./includes/config.php";
include_once BASE_URL . "/includes/session.php";
include_once BASE_URL . "/includes/functions.php";
include_once BASE_URL . "/classes/cls_users.php";
include_once BASE_URL . "/classes/cls_couponcode.php";
if (isset($_SESSION["sess_userid"]) and $_SESSION["sess_userid"] != "") {
    $userId = $_SESSION["sess_userid"];
} else {
    echo 'failed';
    exit;
}
// set shipping details
$result_cart_details = clsUser::getCartDetails($userId);
if ($result_cart_details != 0) {
    $_SESSION["SHIPPING_DETAILS"] = array();
    $_SESSION["SHIPPING_TOTAL"] = 0;
    if (mysql_num_rows($result_cart_details)) {
        while ($cartObj = mysql_fetch_object($result_cart_details)) {
            $shipVal = $_POST["shipping_option_" . $cartObj->product_option_id];
            if ($shipVal != "") {
                $shipValArr = explode('=>', $shipVal);
                $_SESSION["SHIPPING_DETAILS"][$cartObj->product_option_id] = array("preffered_shipping" => $shipValArr[0], "rate" => $shipValArr[1]);
                $_SESSION["SHIPPING_TOTAL"] += $shipValArr[1];
            } else {
                $_SESSION["SHIPPING_DETAILS"][$cartObj->product_option_id] = array();
            }
        }
    }