Ejemplo n.º 1
0
function _getShippingMethodsToAllow($PID)
{
    $res = array();
    $shipping_methods = shGetAllShippingMethods();
    for ($i = 0; $i < count($shipping_methods); $i++) {
        $q = db_query("select count(*) from " . SHIPPING_METHODS_PAYMENT_TYPES_TABLE . " where SID=" . (int) $shipping_methods[$i]["SID"] . " AND " . " PID=" . (int) $PID);
        $row = db_fetch_row($q);
        $item["SID"] = $shipping_methods[$i]["SID"];
        $item["allow"] = $row[0];
        $item["name"] = $shipping_methods[$i]["Name"];
        $res[] = $item;
    }
    return $res;
}
Ejemplo n.º 2
0
 }
 if (isset($_GET["selectedNewAddressID"])) {
     if (!isset($_GET["defaultBillingAddressID"])) {
         RedirectProtected("index.php?order2_shipping=yes" . "&shippingAddressID=" . $_GET["selectedNewAddressID"]);
     } else {
         RedirectProtected("index.php?order2_shipping=yes" . "&shippingAddressID=" . $_GET["selectedNewAddressID"] . "&defaultBillingAddressID=" . $_GET["defaultBillingAddressID"]);
     }
 }
 $shippingAddressID = $_GET["shippingAddressID"];
 $order = _getOrder();
 $strAddress = regGetAddressStr($shippingAddressID);
 $moduleFiles = GetFilesInDirectory("core/modules/shipping", "php");
 foreach ($moduleFiles as $fileName) {
     include $fileName;
 }
 $shipping_methods = shGetAllShippingMethods(true);
 $shipping_costs = array();
 $res = cartGetCartContent();
 $sh_address = regGetAddress($shippingAddressID);
 $addresses = array($sh_address, $sh_address);
 $j = 0;
 foreach ($shipping_methods as $key => $shipping_method) {
     $_ShippingModule = modGetModuleObj($shipping_method["module_id"], SHIPPING_RATE_MODULE);
     if ($_ShippingModule) {
         if ($_ShippingModule->allow_shipping_to_address(regGetAddress($shippingAddressID))) {
             $shipping_costs[$j] = oaGetShippingCostTakingIntoTax($res, $shipping_method["SID"], $addresses, $order);
         } else {
             $shipping_costs[$j] = array(array('rate' => -1));
         }
     } else {
         $shipping_costs[$j] = oaGetShippingCostTakingIntoTax($res, $shipping_method["SID"], $addresses, $order);
Ejemplo n.º 3
0
            $smarty->assign("configuration_saved", 1);
        }
        if (isset($_GET["delete"])) {
            if (CONF_BACKEND_SAFEMODE) {
                Redirect(ADMIN_FILE . "?dpt=conf&sub=shipping&safemode=yes");
            }
            shDeleteShippingMethod($_GET["delete"]);
            Redirect(ADMIN_FILE . "?dpt=conf&sub=shipping");
        }
        if (isset($_POST["save_shipping"])) {
            if (CONF_BACKEND_SAFEMODE) {
                Redirect(ADMIN_FILE . "?dpt=conf&sub=shipping&safemode=yes");
            }
            $values = ScanPostVariableWithId(array("Enabled", "name", "description", "email_comments_text", "module", "sort_order"));
            foreach ($values as $key => $value) {
                shUpdateShippingMethod($key, $value["name"], $value["description"], isset($value["Enabled"]) ? 1 : 0, (int) $value["sort_order"], $value["module"], $value["email_comments_text"]);
            }
            if (trim($_POST["new_name"]) != "") {
                shAddShippingMethod($_POST["new_name"], $_POST["new_description"], isset($_POST["new_Enabled"]) ? 1 : 0, (int) $_POST["new_sort_order"], $_POST["new_module"], $_POST["new_email_comments_text"]);
            }
            Redirect(ADMIN_FILE . "?dpt=conf&sub=shipping&save_successful=yes");
        }
        /**
         * get all installed module objects
         */
        $smarty->assign("shipping_types", shGetAllShippingMethods());
        $smarty->assign("shipping_modules", modGetAllInstalledModuleObjs(SHIPPING_RATE_MODULE));
        //set sub-department template
        $smarty->assign("admin_sub_dpt", "conf_shipping.tpl");
    }
}
Ejemplo n.º 4
0
<?php

//payment types list
if (!strcmp($sub, "payment")) {
    if (CONF_BACKEND_SAFEMODE != 1 && (!isset($_SESSION["log"]) || !in_array(15, $relaccess))) {
        $smarty->assign("admin_sub_dpt", "error_forbidden.tpl");
    } else {
        $shipping_methods = shGetAllShippingMethods();
        $moduleFiles = GetFilesInDirectory("core/modules/payment", "php");
        foreach ($moduleFiles as $fileName) {
            include $fileName;
        }
        if (isset($_GET["save_successful"])) {
            //show successful save confirmation message
            $smarty->assign("configuration_saved", 1);
        }
        if (isset($_GET["delete"])) {
            if (CONF_BACKEND_SAFEMODE) {
                Redirect(ADMIN_FILE . "?dpt=conf&sub=payment&safemode=yes");
            }
            payDeletePaymentMethod($_GET["delete"]);
            Redirect(ADMIN_FILE . "?dpt=conf&sub=payment");
        }
        if (isset($_POST["save_payment"])) {
            if (CONF_BACKEND_SAFEMODE) {
                Redirect(ADMIN_FILE . "?dpt=conf&sub=payment&safemode=yes");
            }
            $values = ScanPostVariableWithId(array("Enabled", "name", "description", "email_comments_text", "module", "sort_order", "calculate_tax"));
            foreach ($values as $PID => $value) {
                payUpdatePaymentMethod($PID, $value["name"], $value["description"], isset($value["Enabled"]) ? 1 : 0, (int) $value["sort_order"], $value["module"], $value["email_comments_text"], isset($value["calculate_tax"]) ? 1 : 0);
                payResetPaymentShippingMethods($PID);