$top_message = array('content' => $fillerror, 'type' => 'E'); cw_header_location('index.php?target=cart&mode=checkout'); } $ord_tmp = array(); foreach ($rules as $k => $tmp) { // $ord_tmp[] = $k.": ".stripslashes($request_prepared[$k]); $ord_tmp[] = $k . ": --not saved--"; } $order_details = implode("\n", $ord_tmp); } cw_payment_header(); global $userinfo, $app_catalogs; if ($customer_id) { $userinfo = cw_user_get_info($customer_id, 65535); } if (empty($userinfo) || cw_is_cart_empty($cart)) { cw_header_location($current_location . '/index.php?target=error_message&error=ccprocessor_baddata'); } $userinfo = cw_array_merge($userinfo, $_POST); $userinfo = cw_array_merge($userinfo, $user_address); $order_type = 'O'; if ($action == 'request_for_quote') { $order_type = 'I'; } $secure_oid =& cw_session_register("secure_oid"); if (!$secure_oid) { $doc_ids = cw_func_call('cw_doc_place_order', array('order_type' => $order_type, 'order_status' => 'I', 'order_details' => $order_details, 'customer_notes' => $customer_notes, 'userinfo' => $userinfo, 'prefix' => $config[$payment_data['processor']]['prefix'])); if (!$doc_ids) { cw_header_location('index.php?target=error_message&error=product_in_cart_expired'); } if (!empty($cart['info']['quote_doc_id'])) {
$identifiers[$current_area == 'R' ? 'C' : $current_area] = array('customer_id' => $user_data['customer_id']); $customer_id = $user_data['customer_id']; if (in_array($current_area, array("C", "R"))) { cw_session_register("login_redirect"); $login_redirect = 1; } // Update addresses in session from database $user_address =& cw_session_register('user_address', array()); $user_address['current_address'] = cw_user_get_address($customer_id, 'current'); $user_address['main_address'] = cw_user_get_address($customer_id, 'main'); db_query("update {$tables['customers_system_info']} set last_login='******' where customer_id='{$customer_id}'"); $current_language = $user_data['language']; $items_per_page_targets = cw_core_restore_navigation($customer_id); cw_include('init/lng.php'); $cart =& cw_session_register('cart', array()); if ($current_area == "C" && cw_is_cart_empty($cart)) { $cart = cw_user_get_stored_cart($customer_id); } $userinfo = cw_user_get_info($customer_id); $products = cw_call('cw_products_in_cart', array($cart, $userinfo)); $cart = cw_func_call('cw_cart_calc', array('cart' => $cart, 'products' => $products, 'userinfo' => $userinfo)); cw_event('on_login', array($customer_id, $current_area, 0)); if (!empty($instagram_login_info['return_url'])) { cw_header_location($instagram_login_info['return_url']); } else { cw_header_location($instagram_redirect_url); } } } else { //For Guest user, get instagram login url $instagram_login_authUrl = $instagram->getLoginUrl();
$fields_area = cw_profile_fields_get_area($customer_id, $salesman_membership, 1); list($profile_sections, $profile_fields, $additional_fields) = cw_profile_fields_get_sections('U', true, $fields_area); # kornev, the web information is not required here. if ($customer_id) { unset($profile_sections['web']); } $smarty->assign('userinfo', $userinfo); $smarty->assign('profile_fields', $profile_fields); $smarty->assign('profile_sections', $profile_sections); cw_addons_add_css('customer/checkout/opc.css'); cw_func_call('cw_checkout_prepare'); } $giftcerts = !empty($cart['giftcerts']) ? $cart['giftcerts'] : array(); $wcart = cw_func_call('cw_cart_get_warehouses_cart', array('cart' => $cart, 'products' => $products, 'userinfo' => $userinfo)); $smarty->assign('warehouses_cart', $wcart); if (!cw_is_cart_empty($cart)) { $smarty->assign('products', $products); $smarty->assign('cart_products', cw_warehouse_group_products($products)); $smarty->assign('giftcerts', $giftcerts); } $smarty->assign('from_quote', !empty($cart['info']['quote_doc_id']) ? 1 : 0); cw_save_customer_cart($customer_id, $cart); if ($addons['recommended_products']) { $config['recommended_products']['number_of_recommends'] = 4; cw_include('addons/recommended_products/recommends.php'); } if ($action == 'print') { $smarty->assign('home_style', 'popup'); } $smarty->assign('current_section_dir', 'cart'); if (!in_array($mode, array('auth', 'checkout', 'order_message'))) {