include $fileName; } $payment_methods = payGetAllPaymentMethods(true); $payment_methodsToShow = array(); foreach ($payment_methods as $payment_method) { if ($_GET["shippingMethodID"] == 0) { $shippingMethodsToAllow = true; } else { $shippingMethodsToAllow = false; foreach ($payment_method["ShippingMethodsToAllow"] as $ShippingMethod) { if ((int) $_GET["shippingMethodID"] == (int) $ShippingMethod["SID"] && $ShippingMethod["allow"]) { $shippingMethodsToAllow = true; break; } } } if ($shippingMethodsToAllow) { $payment_methodsToShow[] = $payment_method; } } if (count($payment_methodsToShow) == 0) { RedirectProtected("index.php?order4_confirmation=yes&" . "shippingAddressID=" . $_GET["shippingAddressID"] . "&" . "shippingMethodID=" . $_GET["shippingMethodID"] . "&" . "billingAddressID=" . regGetDefaultAddressIDByLogin($_SESSION["log"]) . "&" . "paymentMethodID=0" . (isset($_GET['shServiceID']) ? "&shServiceID=" . $_GET['shServiceID'] : '')); } $smarty->assign("shippingAddressID", $_GET["shippingAddressID"]); $smarty->assign("billingAddressID", $_GET["billingAddressID"]); $smarty->assign("shippingMethodID", $_GET["shippingMethodID"]); $smarty->assign("strAddress", regGetAddressStr($_GET["billingAddressID"])); $smarty->assign("payment_methods", $payment_methodsToShow); $smarty->assign("payment_methods_count", count($payment_methodsToShow)); $smarty->assign("main_content_template", "order3_billing.tpl"); }
$addressID = regAddAddress($first_name, $last_name, $countryID, $zoneID, $state, $city, $address, $login, $errorCode); regSetDefaultAddressIDByLogin($login, $addressID); } regEmailNotification($smarty_mail, $login, $cust_password, $Email, $first_name, $last_name, $subscribed4news, $additional_field_values, $countryID, $zoneID, $state, $city, $address, 0); if (!CONF_ENABLE_REGCONFIRMATION) { regAuthenticate($login, $cust_password); } $RedirectURL = ''; if (isset($order)) { if (isset($billingAddressID)) { $RedirectURL = "index.php?order2_shipping=yes&shippingAddressID=" . regGetDefaultAddressIDByLogin($login) . "&defaultBillingAddressID=" . $billingAddressID; } else { $RedirectURL = "index.php?order2_shipping=yes&shippingAddressID=" . regGetDefaultAddressIDByLogin($login); } } elseif (isset($order_without_billing_address)) { $RedirectURL = "index.php?order2_shipping=yes&shippingAddressID=" . regGetDefaultAddressIDByLogin($login); } else { $RedirectURL = "index.php?r_successful=yes"; } if (CONF_ENABLE_REGCONFIRMATION && (isset($order) || isset($order_without_billing_address))) { xSaveData('xREGMAILCONF_URLORDER2', $RedirectURL); $RedirectURL = "index.php?act_customer=1&order2=yes"; } RedirectJavaScript($RedirectURL); } else { $smarty->assign("reg_error", ERROR_INPUT_STATE); } } else { $smarty->assign("reg_error", $error); } }
if (isset($_REQUEST['logout'])) { unset($_SESSION['log']); unset($_SESSION['pass']); session_unregister('log'); session_unregister('pass'); cartClearCartContet(); RedirectJavaScript('/'); } //login if (isset($_POST["login"]) && !isset($_SESSION["log"])) { if (regAuthenticate($_POST["user_login"], $_POST["user_pw"])) { $relaccess = checklogin(); if (isset($_POST['check_order'])) { $cartIsEmpty = cartCartIsEmpty($_POST['user_login']); if ($cartIsEmpty) { Redirect('index.php?order2_shipping=yes&shippingAddressID=' . regGetDefaultAddressIDByLogin($_SESSION['log'])); } else { Redirect('index.php?shopping_cart=yes&make_more_exact_cart_content=yes'); } } else { if (in_array(100, $relaccess)) { Redirect(ADMIN_FILE); } else { Redirect("index.php?user_details=yes"); } } } else { $wrongLoginOrPw = true; $smarty->assign("wrongLoginOrPw", true); } }
<?php if (isset($address_book) && isset($_SESSION["log"])) { if (isset($_GET["delete"])) { $aID = (int) $_GET["delete"]; if (regGetAddressByLogin($aID, $_SESSION["log"])) { redDeleteAddress($aID); } } if (isset($_POST["save"])) { $aID = (int) $_POST["DefaultAddress"]; if (regGetAddressByLogin($aID, $_SESSION["log"])) { regSetDefaultAddressIDByLogin($_SESSION["log"], $aID); } } $addresses = regGetAllAddressesByLogin($_SESSION["log"]); for ($i = 0; $i < count($addresses); $i++) { $addresses[$i]["addressStr"] = regGetAddressStr($addresses[$i]["addressID"]); } $defaultAddressID = regGetDefaultAddressIDByLogin($_SESSION["log"]); $smarty->assign("defaultAddressID", $defaultAddressID); $smarty->assign("addresses", $addresses); $smarty->assign("main_content_template", "address_book.tpl"); }
} $log1 = regGetLoginById($_GET["customerID"]); $customerInfo = regGetCustomerInfo2($log1); $reg_fields_values = GetRegFieldsValues($log1); $customer_groups = GetAllCustGroups(); $smarty->assign("customer_groups", $customer_groups); $smarty->assign("reg_fields_values", $reg_fields_values); $smarty->assign("customerInfo", $customerInfo); } if ($_GET["customer_details"] == "address_book") { $log1 = regGetLoginById($_GET["customerID"]); $addresses = regGetAllAddressesByLogin($log1); for ($i = 0; $i < count($addresses); $i++) { $addresses[$i]["addressStr"] = regGetAddressStr($addresses[$i]["addressID"]); } $defaultAddressID = regGetDefaultAddressIDByLogin($log1); $smarty->assign("addresses", $addresses); $smarty->assign("defaultAddressID", $defaultAddressID); } if ($_GET["customer_details"] == "order_history") { $data = ScanPostVariableWithId(array("set_order_status")); foreach ($data as $orderID => $value) { ostSetOrderStatusToOrder($orderID, $_POST["order_status_in_table_" . $orderID]); } $orders = array(); $callBackParam = array(); $callBackParam["customerID"] = $_GET["customerID"]; if (isset($_GET["sort"])) { $callBackParam["sort"] = $_GET["sort"]; } if (isset($_GET["direction"])) {
$result_methods = array(); $result_costs = array(); foreach ($shipping_methods as $key => $shipping_method) { if ($shipping_costs[$key] != 'n/a') { $result_methods[] = $shipping_method; $result_costs[] = $shipping_costs[$key]; } } $shipping_methods = $result_methods; $shipping_costs = $result_costs; if (isset($_POST["continue_button"])) { $_POST['shServiceID'] = isset($_POST['shServiceID'][$_POST['select_shipping_method']]) ? $_POST['shServiceID'][$_POST['select_shipping_method']] : 0; if (!isset($_GET["defaultBillingAddressID"])) { RedirectProtected("index.php?order3_billing=yes&" . "shippingAddressID=" . $_GET["shippingAddressID"] . "&" . "shippingMethodID=" . $_POST["select_shipping_method"] . "&" . "billingAddressID=" . regGetDefaultAddressIDByLogin($_SESSION["log"]) . "&shServiceID=" . $_POST['shServiceID']); } else { RedirectProtected("index.php?order3_billing=yes&" . "shippingAddressID=" . $_GET["shippingAddressID"] . "&" . "shippingMethodID=" . $_POST["select_shipping_method"] . "&" . "billingAddressID=" . $_GET["defaultBillingAddressID"] . "&shServiceID=" . $_POST['shServiceID']); } } if (count($shipping_methods) == 0) { RedirectProtected("index.php?order3_billing=yes&" . "shippingAddressID=" . regGetDefaultAddressIDByLogin($_SESSION["log"]) . "&" . "shippingMethodID=0&" . "billingAddressID=" . regGetDefaultAddressIDByLogin($_SESSION["log"])); } if (isset($_GET["defaultBillingAddressID"])) { $smarty->assign("defaultBillingAddressID", $_GET["defaultBillingAddressID"]); } $smarty->assign("shippingAddressID", $_GET["shippingAddressID"]); $smarty->assign("strAddress", $strAddress); $smarty->assign("shipping_costs", $shipping_costs); $smarty->assign("shipping_methods", $shipping_methods); $smarty->assign("shipping_methods_count", count($shipping_methods)); $smarty->assign("main_content_template", "order2_shipping.tpl"); }
if (isset($_SESSION["log"])) { $smarty->assign("discount_prompt", 1); $smarty->assign("discount_value", $discount_value); $smarty->assign("discount_percent", $discount_percent); } else { $smarty->assign("discount_prompt", 3); $smarty->assign("discount_value", $discount_value); $smarty->assign("discount_percent", $discount_percent); } break; // discount is calculated as MAX( discount is based on customer group, // discount calculated with help general order price ) // discount is calculated as MAX( discount is based on customer group, // discount calculated with help general order price ) case 5: if (isset($_SESSION["log"])) { $smarty->assign("discount_prompt", 1); $smarty->assign("discount_value", $discount_value); $smarty->assign("discount_percent", $discount_percent); } else { $smarty->assign("discount_prompt", 3); $smarty->assign("discount_value", $discount_value); $smarty->assign("discount_percent", $discount_percent); } break; } if (isset($_SESSION["log"])) { $smarty->assign("shippingAddressID", regGetDefaultAddressIDByLogin($_SESSION["log"])); } $smarty->assign("main_content_template", "shopping_cart.tpl"); }
function main() { $Register =& Register::getInstance(); $smarty =& $Register->get(VAR_SMARTY); /*@var $smarty Smarty*/ // shopping cart //iframe cookie security workaround if (isset($_GET['check_cookie'])) { if ($_GET['check_cookie'] != session_id()) { $productID = (int) $_GET['productID']; $product_data = GetProduct($productID); $product_slug = $product_data && isset($product_data['slug']) ? $product_data['slug'] : ''; $url = "?ukey=product_widget&productID={$productID}&product_slug={$product_slug}&check_cookie&"; $widgets = false; $Register->set('widgets', $widgets); $_SERVER['REQUEST_URI'] = preg_replace('/(^|&)widgets=1/', '', $_SERVER['REQUEST_URI']); RedirectSQ($url); } else { renderURL('check_cookie&productID', '', true); } } if (isset($_GET["make_more_exact_cart_content"])) { $smarty->assign("make_more_exact_cart_content", 1); } if (isset($_GET["remove"]) && $_GET["remove"] > 0) { //remove from cart product with productID == $remove $cartEntry = new ShoppingCart(); $cartEntry->loadCurrentCart(); $cartEntry->setItemQuantity($_GET['remove'], 0); $cartEntry->saveCurrentCart(); if ($cartEntry->isEmpty()) { //remove coupon from empty cart ClassManager::includeClass('discount_coupon'); discount_coupon::remove(); } RedirectSQ('remove='); } $cart_view = $this->_detect_cart_view(); if (isset($_POST["update"]) || isset($_POST["recalculate"])) { //update shopping cart content if ($_POST['discount_coupon_code'] != '') { $this->_check_and_apply_coupon($_POST['discount_coupon_code']); } $cartEntry = new ShoppingCart(); $cartEntry->loadCurrentCart(); $upd_data = scanArrayKeysForID($_POST, 'count'); foreach ($upd_data as $_itemID => $_data) { $cartEntry->setItemQuantity($_itemID, intval($_data['count'])); } $cartEntry->saveCurrentCart(); if ($cartEntry->isEmpty()) { //remove coupon from empty cart ClassManager::includeClass('discount_coupon'); discount_coupon::remove(); } if (cartCheckMinOrderAmount() && cartCheckMinTotalOrderAmount()) { switch ($cart_view) { case CARTVIEW_FRAME: if (isset($_POST['checkout']) && $Register->get('store_mode') == 'facebook') { $store_mode = false; $Register->set('store_mode', $store_mode); $jsgoto = '?ukey=checkout&view=noframe'; RedirectSQ($jsgoto ? 'jsgoto=' . base64_encode(set_query($jsgoto)) : ''); } RedirectSQ(isset($_POST['checkout']) ? '?ukey=checkout' : (isset($_POST['ppe_checkout_x']) ? 'ppexpresscheckout2=1' : (isset($_POST['google_checkout_x']) ? 'googlecheckout2=1' : ''))); break; case CARTVIEW_WIDGET: case CARTVIEW_FADE: $jsgoto = isset($_POST['checkout']) ? '?ukey=checkout&view=noframe' : (isset($_POST['ppe_checkout_x']) ? 'ppexpresscheckout2=1&view=frame' : (isset($_POST['google_checkout_x']) ? 'googlecheckout2=1&view=frame' : '')); RedirectSQ($jsgoto ? 'jsgoto=' . base64_encode(set_query($jsgoto)) : ''); break; } } elseif (isset($_POST['checkout']) || isset($_POST['google_checkout_x']) || isset($_POST['ppe_checkout_x'])) { $smarty->assign('cart_error_show', '1'); } } if (isset($_GET["clear_cart"])) { //completely clear shopping cart $cartEntry = new ShoppingCart(); $cartEntry->loadCurrentCart(); $cartEntry->cleanCurrentCart('erase'); //remove coupon from empty cart ClassManager::includeClass('discount_coupon'); discount_coupon::remove(); RedirectSQ('clear_cart='); } if (isset($_POST['checkout'])) { if (SystemSettings::is_hosted() && file_exists(WBS_DIR . '/kernel/classes/class.metric.php')) { include_once WBS_DIR . '/kernel/classes/class.metric.php'; $DB_KEY = SystemSettings::get('DB_KEY'); $U_ID = sc_getSessionData('U_ID'); $metric = metric::getInstance(); $metric->addAction($DB_KEY, $U_ID, 'SC', 'CHECKOUT', isset($_GET['widgets']) ? 'WIDGET' : 'STOREFRONT', ''); } } $resCart = cartGetCartContent(); $resDiscount = dscGetCartDiscounts($resCart["total_price"], isset($_SESSION["log"]) ? $_SESSION["log"] : ""); $currencyEntry = Currency::getSelectedCurrencyInstance(); $cart_discount_show = $resDiscount['other_discounts']['cu'] > 0 ? $currencyEntry->getView($resDiscount['other_discounts']['cu']) : ''; $coupon_discount_show = $resDiscount['coupon_discount']['cu'] > 0 ? $currencyEntry->getView($resDiscount['coupon_discount']['cu']) : ''; $smarty->assign("cart_content", xHtmlSpecialChars($resCart["cart_content"], null, 'name')); $smarty->assign("cart_amount", $resCart["total_price"] - $resDiscount["discount_standart_unit"]); $smarty->assign('cart_min', show_price(CONF_MINIMAL_ORDER_AMOUNT)); $smarty->assign("cart_total", $currencyEntry->getView($resDiscount['total']['cu'])); $smarty->assign('cart_discount', $cart_discount_show); $smarty->assign('discount_percent', round($resDiscount['discount_percent'], 1)); $smarty->assign('coupon_discount', $coupon_discount_show); $smarty->assign("current_coupon", discount_coupon::getCurrentCoupon()); if (isset($_SESSION['log'])) { $smarty->assign('shippingAddressID', regGetDefaultAddressIDByLogin($_SESSION['log'])); } if (isset($_GET['min_order'])) { $smarty->assign('minOrder', 'error'); } if (isset($_GET['jsgoto'])) { $smarty->assign('jsgoto', base64_decode($_GET['jsgoto'])); } $smarty->assign('main_content_template', 'shopping_cart.html'); $smarty->assign('main_body_style', 'style="' . (CONF_SHOPPING_CART_VIEW == 2 || $cart_view == CARTVIEW_FRAME ? '' : 'background:#FFFFFF;') . 'min-width:auto;width:auto;_width:auto;"'); }