예제 #1
0
function shipping($sub)
{
    $r1 = "";
    $r2 = "";
    if ($_SESSION["shipping"] == "standard") {
        $r1 = "checked";
    } else {
        $r2 = "checked";
    }
    $shipping;
    echo '<input id = "r1" type="radio" name="option" value="standard" ' . $r1 . ' > Standard Shipping<br>';
    echo '<input id = "r2" type="radio" name="option" value="express"  ' . $r2 . '> Express Shipping';
    echo '<h3 class = "pull-right">Shipping Cost</h3><br>';
    //if else that calculates the shipping cost based on it being standard or express.
    if (isset($_SESSION["shipping"]) && $_SESSION['shipping'] == "express") {
        if ($sub >= 300) {
            $shipping = 0;
        } else {
            $frameC = frameCount();
            if ($frameC == 0) {
                $shipping = 15;
            } elseif ($frameC <= 10) {
                $shipping = 25;
            } elseif ($frameC > 10) {
                $shipping = 45;
            } else {
            }
        }
    } else {
        if ($sub >= 100) {
            $shipping = 0;
        } else {
            $frameC = frameCount();
            if ($frameC == 0) {
                $shipping = 5;
            } elseif ($frameC <= 10) {
                $shipping = 15;
            } elseif ($frameC > 10) {
                $shipping = 30;
            } else {
            }
        }
    }
    //outptus shipping cost.
    echo "<br><br><br><div id = 'shipCost' class = 'pull-right'>\$" . number_format((double) $shipping, 2, '.', '') . "</div>";
    return $shipping;
}
예제 #2
0
        } else {
            $frameC = frameCount();
            if ($frameC == 0) {
                $shipping = 15;
            } elseif ($frameC <= 10) {
                $shipping = 25;
            } elseif ($frameC > 10) {
                $shipping = 45;
            } else {
            }
        }
    } else {
        if ($sub >= 100) {
            $shipping = 0;
        } else {
            $frameC = frameCount();
            if ($frameC == 0) {
                $shipping = 5;
            } elseif ($frameC <= 10) {
                $shipping = 15;
            } elseif ($frameC > 10) {
                $shipping = 30;
            } else {
            }
        }
    }
    //adds the new shipping cost to the JSON return object.
    $shipping = number_format((double) $shipping, 2, '.', '');
    $serArr["shipCost"] = $shipping;
}
if (isset($_POST["remove"]) && $_POST["remove"] == "yes") {