本文整理汇总了PHP中fn_save_cart_content函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_save_cart_content函数的具体用法?PHP fn_save_cart_content怎么用?PHP fn_save_cart_content使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_save_cart_content函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fn_wishlist_sucess_user_login
function fn_wishlist_sucess_user_login($udata, $auth)
{
if (AREA == 'C') {
if ($cu_id = fn_get_session_data('cu_id')) {
fn_clear_cart($cart);
fn_save_cart_content($cart, $cu_id, 'W', 'U');
}
}
}
开发者ID:askzap,项目名称:ultimate,代码行数:9,代码来源:func.php
示例2: fn_checkout_update_steps
//.........这里部分代码省略.........
$user_data = fn_array_merge($current_user_data, $user_data);
$user_data['user_type'] = !empty($current_user_data['user_type']) ? $current_user_data['user_type'] : AREA;
$user_data = fn_fill_contact_info_from_address($user_data);
}
$user_data = fn_array_merge($current_user_data, $user_data);
if (empty($params['ship_to_another'])) {
$profile_fields = fn_get_profile_fields('O');
fn_fill_address($user_data, $profile_fields);
}
// Check if we need to send notification with new email to customer
$email = db_get_field('SELECT email FROM ?:users WHERE user_id = ?i', $auth['user_id']);
$send_notification = false;
if (isset($user_data['email']) && $user_data['email'] != $email) {
$send_notification = true;
}
list($user_id, $profile_id) = fn_update_user($auth['user_id'], $user_data, $auth, !empty($params['ship_to_another']), $send_notification, false);
$cart['profile_id'] = $profile_id;
}
// Add/Update additional fields
if (!empty($user_data['fields'])) {
fn_store_profile_fields($user_data, array('U' => $auth['user_id'], 'P' => $profile_id), 'UP');
// FIXME
}
} elseif (Registry::get('settings.Checkout.disable_anonymous_checkout') != 'Y') {
if (empty($auth['user_id']) && !empty($user_data['email'])) {
$email_exists = fn_is_user_exists(0, $user_data);
if (!empty($email_exists)) {
fn_set_notification('E', __('error'), __('error_user_exists'));
fn_save_post_data('user_data');
if (!empty($params['guest_checkout'])) {
$redirect_params['edit_step'] = $params['step_two'];
$redirect_params['guest_checkout'] = 1;
}
return $redirect_params;
}
}
if (isset($user_data['fields'])) {
$fields = fn_array_merge(isset($cart['user_data']['fields']) ? $cart['user_data']['fields'] : array(), $user_data['fields']);
}
if ($params['update_step'] == 'step_two' && !empty($user_data)) {
$user_data = fn_fill_contact_info_from_address($user_data);
}
$cart['user_data'] = fn_array_merge($cart['user_data'], $user_data);
// Fill shipping info with billing if needed
if (empty($params['ship_to_another']) && $params['update_step'] == 'step_two') {
$profile_fields = fn_get_profile_fields('O');
fn_fill_address($cart['user_data'], $profile_fields);
}
if (!empty($cart['user_data']['b_vat_id']) && !empty($cart['user_data']['b_country'])) {
if (fn_check_vat_id($user_data['b_vat_id'], $cart['user_data']['b_country'])) {
fn_set_notification('N', __('notice'), __('vat_id_number_is_valid'));
} else {
fn_set_notification('E', __('error'), __('vat_id_number_is_not_valid'));
$cart['user_data']['b_vat_id'] = '';
return $redirect_params;
}
} elseif (isset($user_data['b_vat_id'])) {
$user_data['b_vat_id'] = '';
}
}
if (!empty($params['next_step'])) {
$redirect_params['edit_step'] = $params['next_step'];
}
if (!empty($params['shipping_ids'])) {
fn_checkout_update_shipping($cart, $params['shipping_ids']);
}
if (!empty($params['payment_id'])) {
$cart['payment_id'] = (int) $params['payment_id'];
if (!empty($params['payment_info'])) {
$cart['extra_payment_info'] = $params['payment_info'];
if (!empty($cart['extra_payment_info']['card_number'])) {
$cart['extra_payment_info']['secure_card_number'] = preg_replace('/^(.+?)([0-9]{4})$/i', '***-$2', $cart['extra_payment_info']['card_number']);
}
} else {
unset($cart['extra_payment_info']);
}
fn_update_payment_surcharge($cart, $auth);
fn_save_cart_content($cart, $auth['user_id']);
}
if (!empty($params['customer_notes'])) {
$cart['notes'] = $params['customer_notes'];
}
// Recalculate the cart
$cart['recalculate'] = true;
if (!empty($params['next_step']) && ($params['next_step'] == 'step_three' || $params['next_step'] == 'step_four')) {
$cart['calculate_shipping'] = true;
}
$shipping_calculation_type = Registry::get('settings.General.estimate_shipping_cost') == 'Y' || !empty($completed_steps['step_two']) ? 'A' : 'S';
list($cart_products, $product_groups) = fn_calculate_cart_content($cart, $auth, $shipping_calculation_type, true, 'F');
$shipping_hash = fn_get_shipping_hash($cart['product_groups']);
if (!empty($_SESSION['shipping_hash']) && $_SESSION['shipping_hash'] != $shipping_hash && $params['next_step'] == 'step_four' && $cart['shipping_required']) {
if (!empty($cart['chosen_shipping'])) {
fn_set_notification('W', __('important'), __('text_shipping_rates_changed'));
}
$cart['chosen_shipping'] = array();
$redirect_params['edit_step'] = 'step_three';
return $redirect_params;
}
return $redirect_params;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:101,代码来源:fn.cart.php
示例3: fn_reorder
function fn_reorder($order_id, &$cart, &$auth)
{
$order_info = fn_get_order_info($order_id, false, false, false, true);
unset($_SESSION['shipping_hash']);
unset($_SESSION['edit_step']);
fn_set_hook('reorder', $order_info, $cart, $auth);
foreach ($order_info['products'] as $k => $item) {
// refresh company id
$company_id = db_get_field("SELECT company_id FROM ?:products WHERE product_id = ?i", $item['product_id']);
$order_info['products'][$k]['company_id'] = $company_id;
unset($order_info['products'][$k]['extra']['ekey_info']);
$order_info['products'][$k]['product_options'] = empty($order_info['products'][$k]['extra']['product_options']) ? array() : $order_info['products'][$k]['extra']['product_options'];
$order_info['products'][$k]['main_pair'] = fn_get_cart_product_icon($item['product_id'], $order_info['products'][$k]);
}
if (!empty($cart) && !empty($cart['products'])) {
$cart['products'] = fn_array_merge($cart['products'], $order_info['products']);
} else {
$cart['products'] = $order_info['products'];
}
foreach ($cart['products'] as $k => $v) {
$_is_edp = db_get_field("SELECT is_edp FROM ?:products WHERE product_id = ?i", $v['product_id']);
if ($amount = fn_check_amount_in_stock($v['product_id'], $v['amount'], $v['product_options'], $k, $_is_edp, 0, $cart)) {
$cart['products'][$k]['amount'] = $amount;
// Change the path of custom files
if (!empty($v['extra']['custom_files'])) {
foreach ($v['extra']['custom_files'] as $option_id => $_data) {
if (!empty($_data)) {
foreach ($_data as $file_id => $file) {
$cart['products'][$k]['extra']['custom_files'][$option_id][$file_id]['path'] = 'sess_data/' . fn_basename($file['path']);
}
}
}
}
} else {
unset($cart['products'][$k]);
}
}
// Restore custom files for editing
$dir_path = 'order_data/' . $order_id;
if (Storage::instance('custom_files')->isExist($dir_path)) {
Storage::instance('custom_files')->copy($dir_path, 'sess_data');
}
// Redirect customer to step three after reordering
$cart['payment_updated'] = true;
fn_save_cart_content($cart, $auth['user_id']);
unset($cart['product_groups']);
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:47,代码来源:orders.php
示例4: fn_set_notification
$msg = Registry::get('view')->fetch('addons/wishlist/views/wishlist/components/product_notification.tpl');
fn_set_notification('I', $title, $msg, 'I');
} else {
if ($product_ids) {
fn_set_notification('W', __('notice'), __('product_in_wishlist'));
}
}
$product_ids = fn_add_product_to_wishlist($_REQUEST['product_data'], $wishlist, $auth);
fn_save_cart_content($wishlist, $auth['user_id'], 'W'); */
//delete the cart product
fn_delete_cart_product($cart, $_REQUEST['ls_cart_combination_hash']);
if (fn_cart_is_empty($cart) == true) {
fn_clear_cart($cart);
}
fn_save_cart_content($cart, $_SESSION['settings']['cu_id']['value']);
$cart['recalculate'] = true;
fn_calculate_cart_content($cart, $auth, 'A', true, 'F', true);
} else {
// echo 'bad request';
}
exit;
} elseif ($mode == 'ls_generate_wishlist_markup') {
$base_url = fn_ls_get_base_url();
//changed parameters correction
$_REQUEST['ls_productId'] = reset(array_keys($_REQUEST['product_data']));
$_REQUEST['current_url'] = $_REQUEST["redirect_url"];
$_REQUEST['ls_cart_combination_hash'] = $_REQUEST['ls_product_combination_hash'];
//get thumbnail path
// $image_relative_path = fn_get_image_pairs($_REQUEST['ls_productId'], 'product', 'M', true, true, CART_LANGUAGE);
// $image_relative_path=$image_relative_path['detailed']['relative_path'];
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:31,代码来源:index.php
示例5: db_query
if ($mode == 'recover_password') {
// Cleanup expired keys
db_query("DELETE FROM ?:ekeys WHERE ttl > 0 AND ttl < ?i", TIME);
// FIXME: should be moved to another place
if (!empty($_REQUEST['ekey'])) {
$u_id = db_get_field("SELECT object_id FROM ?:ekeys WHERE ekey = ?s AND object_type = 'U' AND ttl > ?i", $_REQUEST['ekey'], TIME);
if (!empty($u_id)) {
$udata = db_get_row("SELECT user_id, user_type, tax_exempt, last_login, password_change_timestamp FROM ?:users WHERE user_id = ?i AND status = 'A'", $u_id);
// Delete this key
db_query("DELETE FROM ?:ekeys WHERE ekey = ?s", $_REQUEST['ekey']);
if (!empty($udata)) {
$auth = fn_fill_auth($udata, isset($auth['order_ids']) ? $auth['order_ids'] : array());
if (AREA == 'C') {
if ($cu_id = fn_get_cookie('cu_id')) {
fn_clear_cart($cart);
fn_save_cart_content($cart, $cu_id, 'C', 'U');
fn_delete_cookies('cu_id');
}
fn_init_user_session_data($_SESSION, $udata['user_id']);
}
fn_set_notification('N', fn_get_lang_var('notice'), fn_get_lang_var('text_change_password'));
return array(CONTROLLER_STATUS_OK, "profiles.update");
} else {
fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('error_account_disabled'));
return array(CONTROLLER_STATUS_OK, $index_script);
}
} else {
fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('text_ekey_not_valid'));
return array(CONTROLLER_STATUS_OK, "auth.recover_password");
}
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:auth.php
示例6: apiPlaceOrder
public static function apiPlaceOrder($data, &$response, $lang_code = CART_LANGUAGE)
{
$cart =& $_SESSION['cart'];
$auth =& $_SESSION['auth'];
$orderMethods = new OrderMethods();
if (empty($cart)) {
$response->addError('ERROR_ACCESS_DENIED', __('access_denied', $lang_code));
$response->returnResponse();
}
if (!empty($data['user'])) {
fn_twg_api_set_cart_user_data($data['user'], $response, $lang_code);
}
if (empty($auth['user_id']) && empty($cart['user_data'])) {
$response->addError('ERROR_ACCESS_DENIED', __('access_denied', $lang_code));
$response->returnResponse();
}
if (empty($data['payment_info']) && !empty($cart['extra_payment_info'])) {
$data['payment_info'] = $cart['extra_payment_info'];
}
if (!empty($data['payment_info'])) {
$cart['payment_id'] = (int) $data['payment_info']['payment_id'];
unset($data['payment_info']['payment_id']);
if (!empty($data['payment_info'])) {
$cart['payment_info'] = $data['payment_info'];
}
unset($cart['payment_updated']);
fn_update_payment_surcharge($cart, $auth);
fn_save_cart_content($cart, $auth['user_id']);
}
unset($cart['payment_info']['secure_card_number']);
// Remove previous failed order
if (!empty($cart['failed_order_id']) || !empty($cart['processed_order_id'])) {
$_order_ids = !empty($cart['failed_order_id']) ? $cart['failed_order_id'] : $cart['processed_order_id'];
foreach ($_order_ids as $_order_id) {
fn_delete_order($_order_id);
}
$cart['rewrite_order_id'] = $_order_ids;
unset($cart['failed_order_id'], $cart['processed_order_id']);
}
if (!empty($data['shippings'])) {
if (!fn_checkout_update_shipping($cart, $data['shippings'])) {
unset($cart['shipping']);
}
}
list(, $_SESSION['shipping_rates']) = fn_calculate_cart_content($cart, $auth, 'E');
if (empty($cart['shipping']) && $cart['shipping_failed']) {
$response->addError('ERROR_WRONG_CHECKOUT_DATA', __('wrong_shipping_info', $lang_code));
$response->returnResponse();
}
if (empty($cart['payment_info']) && !isset($cart['payment_id'])) {
$response->addError('ERROR_WRONG_CHECKOUT_DATA', __('wrong_payment_info', $lang_code));
$response->returnResponse();
}
if (!empty($data['notes'])) {
$cart['notes'] = $data['notes'];
}
$cart['details'] = __('twgadmin_order_via_twigmo');
list($order_id, $process_payment) = fn_place_order($cart, $auth);
if (empty($order_id)) {
return false;
}
if ($process_payment == true) {
$payment_info = !empty($cart['payment_info']) ? $cart['payment_info'] : array();
fn_twg_start_payment($order_id, array(), $payment_info);
}
$orderMethods->orderPlacementRoutines($order_id);
return $order_id;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:68,代码来源:TwigmoOrder.php
示例7: fn_twg_api_add_product_to_cart
function fn_twg_api_add_product_to_cart($products, &$cart)
{
$products_data = array();
foreach ($products as $product) {
$cid = fn_generate_cart_id($product['product_id'], $product);
if (!empty($products_data[$cid])) {
$products_data[$cid]['amount'] += $product['amount'];
}
// Get product options images
$product['combination_hash'] = $cid;
if (!empty($product['combination_hash']) && !empty($product['product_options'])) {
$image = fn_get_image_pairs($product['combination_hash'], 'product_option', 'M', true, true, CART_LANGUAGE);
if (!empty($image)) {
$product['main_pair'] = $image;
}
}
$products_data[$cid] = $product;
}
$auth =& $_SESSION['auth'];
// actions copied from the checkout.php 'add' action
$ids = fn_add_product_to_cart($products_data, $cart, $auth);
fn_save_cart_content($cart, $auth['user_id']);
$cart['change_cart_products'] = true;
fn_calculate_cart_content($cart, $auth, 'S', true, 'F', true);
return $ids;
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:26,代码来源:func.php
示例8: die
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
/**
* Act on behalf functionality
*/
if (!empty($_REQUEST['skey'])) {
$session_data = fn_get_storage_data('session_' . $_REQUEST['skey'] . '_data');
fn_set_storage_data('session_' . $_REQUEST['skey'] . '_data', '');
if (!empty($session_data)) {
Tygh::$app['session']->start();
Tygh::$app['session']->fromArray(unserialize($session_data));
Tygh::$app['session']->save(Tygh::$app['session']->getID(), Tygh::$app['session']->toArray());
if (!fn_cart_is_empty(Tygh::$app['session']['cart'])) {
fn_calculate_cart_content(Tygh::$app['session']['cart'], Tygh::$app['session']['auth'], 'S', true, 'F', true);
fn_save_cart_content(Tygh::$app['session']['cart'], Tygh::$app['session']['auth']['user_id']);
}
}
return array(CONTROLLER_STATUS_REDIRECT, fn_query_remove(REAL_URL, 'skey'));
}
// UK Cookies Law
if (Registry::get('settings.Security.uk_cookies_law') == 'Y') {
if (!empty($_REQUEST['cookies_accepted']) && $_REQUEST['cookies_accepted'] == 'Y') {
Tygh::$app['session']['cookies_accepted'] = true;
}
if (!defined('AJAX_REQUEST') && empty(Tygh::$app['session']['cookies_accepted'])) {
$url = fn_link_attach(Registry::get('config.current_url'), 'cookies_accepted=Y');
$url = str_replace('&', '&', $url);
$text = __('uk_cookies_law', array('[url]' => $url));
fn_delete_notification('uk_cookies_law');
fn_set_notification('W', __('warning'), $text, 'K', 'uk_cookies_law');
开发者ID:ambient-lounge,项目名称:site,代码行数:31,代码来源:init.php
示例9: die
use Tygh\Development;
use Tygh\Registry;
use Tygh\Session;
use Tygh\BlockManager\Location;
use Tygh\BlockManager\Layout;
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
if (!empty($_REQUEST['skey'])) {
$session_data = fn_get_storage_data('session_' . $_REQUEST['skey'] . '_data');
fn_set_storage_data('session_' . $_REQUEST['skey'] . '_data', '');
if (!empty($session_data)) {
$_SESSION = unserialize($session_data);
Session::save(Session::getId(), $_SESSION);
fn_calculate_cart_content($_SESSION['cart'], $_SESSION['auth'], 'S', true, 'F', true);
fn_save_cart_content($_SESSION['cart'], $_SESSION['auth']['user_id']);
}
return array(CONTROLLER_STATUS_REDIRECT, fn_query_remove(REAL_URL, 'skey'));
}
// UK Cookies Law
if (Registry::get('settings.Security.uk_cookies_law') == 'Y') {
if (!empty($_REQUEST['cookies_accepted']) && $_REQUEST['cookies_accepted'] == 'Y') {
$_SESSION['cookies_accepted'] = true;
}
if (!defined('AJAX_REQUEST') && empty($_SESSION['cookies_accepted'])) {
$url = fn_link_attach(Registry::get('config.current_url'), 'cookies_accepted=Y');
$text = __('uk_cookies_law', array('[url]' => $url));
fn_delete_notification('uk_cookies_law');
fn_set_notification('W', __('warning'), $text, 'K', 'uk_cookies_law');
} else {
fn_delete_notification('uk_cookies_law');
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:31,代码来源:init.php
示例10: die
<?php
/***************************************************************************
* *
* (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
* *
* This is commercial software, only users who have purchased a valid *
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
if ($mode == 'logout') {
fn_save_cart_content(Tygh::$app['session']['wishlist'], $auth['user_id'], 'W');
unset(Tygh::$app['session']['wishlist']);
}
开发者ID:ambient-lounge,项目名称:site,代码行数:21,代码来源:auth.pre.php
示例11: die
<?php
/***************************************************************************
* *
* (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
* *
* This is commercial software, only users who have purchased a valid *
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
if ($mode == 'logout') {
fn_save_cart_content($_SESSION['wishlist'], $auth['user_id'], 'W');
unset($_SESSION['wishlist']);
}
开发者ID:askzap,项目名称:ultimate,代码行数:21,代码来源:auth.pre.php
示例12: fn_order_placement_routines
function fn_order_placement_routines($order_id, $force_notification = array(), $clear_cart = true, $action = '')
{
$order_info = fn_get_order_info($order_id, true);
if (!empty($_SESSION['cart']['placement_action'])) {
if (empty($action)) {
$action = $_SESSION['cart']['placement_action'];
}
unset($_SESSION['cart']['placement_action']);
}
if (AREA == 'C' && !empty($order_info['user_id'])) {
$__fake = '';
fn_save_cart_content($__fake, $order_info['user_id']);
}
$edp_data = fn_generate_ekeys_for_edp(array(), $order_info);
fn_order_notification($order_info, $edp_data, $force_notification);
$_error = false;
if ($action == 'save') {
fn_set_notification('N', fn_get_lang_var('congratulations'), fn_get_lang_var('text_order_saved_successfully'));
} else {
if ($order_info['status'] == STATUS_PARENT_ORDER) {
$child_orders = db_get_hash_single_array("SELECT order_id, status FROM ?:orders WHERE parent_order_id = ?i", array('order_id', 'status'), $order_id);
$status = reset($child_orders);
$child_orders = array_keys($child_orders);
} else {
$status = $order_info['status'];
}
if (substr_count('OP', $status) > 0) {
if ($action == 'repay') {
fn_set_notification('N', fn_get_lang_var('congratulations'), fn_get_lang_var('text_order_repayed_successfully'));
} else {
fn_set_notification('N', fn_get_lang_var('order_placed'), fn_get_lang_var('text_order_placed_successfully'));
}
} elseif ($status == 'B') {
fn_set_notification('N', fn_get_lang_var('order_placed'), fn_get_lang_var('text_order_backordered'));
} else {
if (AREA == 'A' || $action == 'repay') {
if ($status != 'I') {
fn_set_notification('E', fn_get_lang_var('order_placed'), fn_get_lang_var('text_order_placed_error'));
}
} else {
$_error = true;
if (!empty($child_orders)) {
array_unshift($child_orders, $order_id);
} else {
$child_orders = array();
$child_orders[] = $order_id;
}
$_SESSION['cart'][$status == 'N' ? 'processed_order_id' : 'failed_order_id'] = $child_orders;
}
if ($status == 'N' || $action == 'repay' && $status == 'I') {
fn_set_notification('N', fn_get_lang_var('cancelled'), fn_get_lang_var('text_transaction_cancelled'));
}
}
}
// Empty cart
if ($clear_cart == true && $_error == false) {
$_SESSION['cart'] = array('user_data' => !empty($_SESSION['cart']['user_data']) ? $_SESSION['cart']['user_data'] : array(), 'profile_id' => !empty($_SESSION['cart']['profile_id']) ? $_SESSION['cart']['profile_id'] : 0, 'user_id' => !empty($_SESSION['cart']['user_id']) ? $_SESSION['cart']['user_id'] : 0);
db_query('DELETE FROM ?:user_session_products WHERE session_id = ?s AND type = ?s', Session::get_id(), 'C');
}
fn_set_hook('order_placement_routines', $order_id, $force_notification, $order_info);
$prefix = Registry::get('settings.General.secure_auth') == 'Y' && AREA == 'C' ? Registry::get('config.https_location') . '/' : '';
if (AREA == 'A' || $action == 'repay') {
fn_redirect($prefix . INDEX_SCRIPT . "?dispatch=orders.details&order_id={$order_id}", true);
} else {
fn_redirect($prefix . INDEX_SCRIPT . "?dispatch=checkout." . ($_error == true ? Registry::get('settings.General.one_page_checkout') == 'Y' ? "checkout" : "summary" : "complete&order_id={$order_id}"), true);
}
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:67,代码来源:fn.cart.php
示例13: fn_init_user
/**
* Init user
*
* @return boolean always true
*/
function fn_init_user($area = AREA)
{
$user_info = array();
if (!empty(Tygh::$app['session']['auth']['user_id'])) {
$user_info = fn_get_user_short_info(Tygh::$app['session']['auth']['user_id']);
if (empty($user_info)) {
// user does not exist in the database, but exists in session
Tygh::$app['session']['auth'] = array();
} else {
Tygh::$app['session']['auth']['usergroup_ids'] = fn_define_usergroups(array('user_id' => Tygh::$app['session']['auth']['user_id'], 'user_type' => $user_info['user_type']));
}
}
$first_init = false;
if (empty(Tygh::$app['session']['auth'])) {
$udata = array();
$user_id = fn_get_session_data($area . '_user_id');
if ($area == 'A' && defined('CONSOLE')) {
$user_id = 1;
}
if ($user_id) {
fn_define('LOGGED_VIA_COOKIE', true);
}
fn_login_user($user_id);
if (!defined('NO_SESSION')) {
Tygh::$app['session']['cart'] = isset(Tygh::$app['session']['cart']) ? Tygh::$app['session']['cart'] : array();
}
if (defined('LOGGED_VIA_COOKIE') && !empty(Tygh::$app['session']['auth']['user_id']) || ($cu_id = fn_get_session_data('cu_id'))) {
$first_init = true;
if (!empty($cu_id)) {
fn_define('COOKIE_CART', true);
}
// Cleanup cached shipping rates
unset(Tygh::$app['session']['shipping_rates']);
$_utype = empty(Tygh::$app['session']['auth']['user_id']) ? 'U' : 'R';
$_uid = empty(Tygh::$app['session']['auth']['user_id']) ? $cu_id : Tygh::$app['session']['auth']['user_id'];
fn_extract_cart_content(Tygh::$app['session']['cart'], $_uid, 'C', $_utype);
fn_save_cart_content(Tygh::$app['session']['cart'], $_uid, 'C', $_utype);
if (!empty(Tygh::$app['session']['auth']['user_id'])) {
Tygh::$app['session']['cart']['user_data'] = fn_get_user_info(Tygh::$app['session']['auth']['user_id']);
$user_info = fn_get_user_short_info(Tygh::$app['session']['auth']['user_id']);
}
}
}
if (fn_is_expired_storage_data('cart_products_next_check', SECONDS_IN_HOUR * 12)) {
db_query("DELETE FROM ?:user_session_products WHERE user_type = 'U' AND timestamp < ?i", TIME - SECONDS_IN_DAY * 30);
}
if (!fn_allowed_for('ULTIMATE:FREE')) {
// If administrative account has usergroup, it means the access restrictions are in action
if ($area == 'A' && !empty(Tygh::$app['session']['auth']['usergroup_ids'])) {
fn_define('RESTRICTED_ADMIN', true);
}
}
if (!empty($user_info) && $user_info['user_type'] == 'A' && (empty($user_info['company_id']) || fn_allowed_for('ULTIMATE') && $user_info['company_id'] == Registry::get('runtime.company_id'))) {
$customization_mode = fn_array_combine(explode(',', Registry::get('settings.customization_mode')), true);
if (!empty($customization_mode)) {
Registry::set('runtime.customization_mode', $customization_mode);
if ($area == 'A' || Embedded::isEnabled()) {
Registry::set('runtime.customization_mode.live_editor', false);
}
}
}
fn_set_hook('user_init', Tygh::$app['session']['auth'], $user_info, $first_init);
Registry::set('user_info', $user_info);
return array(INIT_STATUS_OK);
}
开发者ID:ambient-lounge,项目名称:site,代码行数:70,代码来源:fn.init.php
示例14: fn_reorder
function fn_reorder($order_id, &$cart, &$auth)
{
$order_info = fn_get_order_info($order_id, false, false, false, true);
fn_set_hook('reorder', $order_info, $cart, $auth);
foreach ($order_info['items'] as $k => $item) {
// refresh company id
$company_id = db_get_field("SELECT company_id FROM ?:products WHERE product_id = ?i", $item['product_id']);
$order_info['items'][$k]['company_id'] = $company_id;
unset($order_info['items'][$k]['extra']['ekey_info']);
$order_info['items'][$k]['product_options'] = empty($order_info['items'][$k]['extra']['product_options']) ? array() : $order_info['items'][$k]['extra']['product_options'];
}
if (!empty($cart) && !empty($cart['products'])) {
$cart['products'] = fn_array_merge($cart['products'], $order_info['items']);
} else {
$cart['products'] = $order_info['items'];
}
foreach ($cart['products'] as $k => $v) {
$_is_edp = db_get_field("SELECT is_edp FROM ?:products WHERE product_id = ?i", $v['product_id']);
if ($amount = fn_check_amount_in_stock($v['product_id'], $v['amount'], $v['product_options'], $k, $_is_edp, 0, $cart)) {
$cart['products'][$k]['amount'] = $amount;
} else {
unset($cart['products'][$k]);
}
}
// Restore custom files for editing
$dir_path = DIR_CUSTOM_FILES . 'order_data/' . $order_id;
if (is_dir($dir_path)) {
fn_mkdir(DIR_CUSTOM_FILES . 'sess_data');
fn_copy($dir_path, DIR_CUSTOM_FILES . 'sess_data');
}
// Redirect customer to step three after reordering
$cart['payment_updated'] = true;
fn_save_cart_content($cart, $auth['user_id']);
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:34,代码来源:orders.php
示例15: fn_set_notification
$gift_cert['gift_cert_id'] = $gift_cert_wishlist_id;
Registry::get('view')->assign('gift_cert', $gift_cert);
$msg = Registry::get('view')->fetch('addons/wishlist/views/wishlist/components/product_notification.tpl');
fn_set_notification('I', __('text_gift_cert_added_to_wishlist'), $msg, 'I');
}
}
return array(CONTROLLER_STATUS_REDIRECT, 'wishlist.view');
}
if ($mode == 'update') {
if (!empty($_REQUEST['gift_cert_data']) && !empty($_REQUEST['gift_cert_id']) && $_REQUEST['type'] == 'W') {
fn_delete_wishlist_gift_certificate($wishlist, $_REQUEST['gift_cert_id']);
list($gift_cert_id, $gift_cert) = fn_add_gift_certificate_to_wishlist($wishlist, $_REQUEST['gift_cert_data']);
if (!empty($gift_cert_id)) {
$wishlist['gift_certificates'][$gift_cert_id] = $gift_cert;
}
fn_save_cart_content($wishlist, $auth['user_id'], $_REQUEST['type']);
return array(CONTROLLER_STATUS_REDIRECT, 'wishlist.view');
}
}
if ($mode == 'wishlist_delete') {
if (isset($_REQUEST['gift_cert_wishlist_id'])) {
fn_delete_cart_gift_certificate($_SESSION['wishlist'], $_REQUEST['gift_cert_wishlist_id']);
}
return array(CONTROLLER_STATUS_REDIRECT, 'wishlist.view');
}
}
if ($mode == 'update') {
if (!empty($_REQUEST['gift_cert_wishlist_id'])) {
$gift_cert_data = fn_get_gift_certificate_info($_REQUEST['gift_cert_wishlist_id'], 'W');
if (!empty($gift_cert_data['extra']['exclude_from_calculate'])) {
return array(CONTROLLER_STATUS_NO_PAGE);
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:31,代码来源:gift_certificates.post.php
示例16: fn_init_user
/**
* Init user
*
* @return boolean always true
*/
function fn_init_user()
{
if (!empty($_SESSION['auth']['user_id'])) {
$user_info = fn_get_user_short_info($_SESSION['auth']['user_id']);
if (empty($user_info)) {
// user does not exist in the database, but exists in session
$_SESSION['auth'] = array();
} else {
$_SESSION['auth']['usergroup_ids'] = fn_define_usergroups(array('user_id' => $_SESSION['auth']['user_id'], 'user_type' => $user_info['user_type']));
}
}
$first_init = false;
if (empty($_SESSION['auth'])) {
$udata = array();
if (fn_get_cookie(AREA_NAME . '_user_id')) {
$udata = db_get_row("SELECT user_id, user_type, tax_exempt, last_login FROM ?:users WHERE user_id = ?i AND password = ?s", fn_get_cookie(AREA_NAME . '_user_id'), fn_get_cookie(AREA_NAME . '_password'));
fn_define('LOGGED_VIA_COOKIE', true);
}
$_SESSION['auth'] = fn_fill_auth($udata, isset($_SESSION['auth']['order_ids']) ? $_SESSION['auth']['order_ids'] : array());
if (!defined('NO_SESSION')) {
$_SESSION['cart'] = isset($_SESSION['cart']) ? $_SESSION['cart'] : array();
}
if (defined('LOGGED_VIA_COOKIE') && !empty($_SESSION['auth']['user_id']) || ($cu_id = fn_get_cookie('cu_id'))) {
$first_init = true;
if (!empty($cu_id)) {
fn_define('COOKIE_CART', true);
}
// Cleanup cached shipping rates
unset($_SESSION['shipping_rates']);
$_utype = empty($_SESSION['auth']['user_id']) ? 'U' : 'R';
$_uid = empty($_SESSION['auth']['user_id']) ? $cu_id : $_SESSION['auth']['user_id'];
fn_extract_cart_content($_SESSION['cart'], $_uid, 'C', $_utype);
fn_save_cart_content($_SESSION['cart'], $_uid, 'C', $_utype);
if (!empty($_SESSION['auth']['user_id'])) {
$_SESSION['cart']['user_data'] = fn_get_user_info($_SESSION['auth']['user_id']);
}
}
}
if (TIME > Registry::get('settings.cart_products_next_check')) {
fn_define('CART_PRODUCTS_CHECK_PERIOD', SECONDS_IN_HOUR * 12);
fn_define('CART_PRODUCTS_DELETE_TIME', TIME - SECONDS_IN_DAY * 30);
db_query("DELETE FROM ?:user_session_products WHERE user_type = 'U' AND timestamp < ?i", CART_PRODUCTS_DELETE_TIME);
db_query("UPDATE ?:settings SET value = ?s WHERE option_name = 'cart_products_next_check'", TIME + CART_PRODUCTS_CHECK_PERIOD);
}
// If administrative account has usergroup, it means the access restrictions are in action
if (AREA == 'A' && !empty($_SESSION['auth']['usergroup_ids'])) {
fn_define('RESTRICTED_ADMIN', true);
}
if (!empty($user_info) && $user_info['user_type'] == 'A') {
if (Registry::get('settings.translation_mode') == 'Y') {
fn_define('TRANSLATION_MODE', true);
}
if (Registry::get('settings.customization_mode') == 'Y') {
if (AREA != 'A') {
fn_define('PARSE_ALL', true);
}
fn_define('CUSTOMIZATION_MODE', true);
}
}
fn_set_hook('user_init', $_SESSION['auth'], $user_info, $first_init);
Registry::set('user_info', $user_info);
Registry::get('view')->assign('auth', $_SESSION['auth']);
Registry::get('view')->assign('user_info', $user_info);
return true;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:70,代码来源:fn.init.php
示例17: fn_order_placement_routines
function fn_order_placement_routines($action = '', $order_id = 0, $force_notification = array(), $clear_cart = true, $area = AREA)
{
if (Embedded::isLeft() && !Embedded::isEnabled()) {
Embedded::enable();
}
if ($action == 'checkout_redirect') {
if ($area == 'A') {
fn_redirect("order_management.edit?order_id=" . reset($_SESSION['cart']['processed_order_id']));
} else {
fn_redirect('checkout.' . (Registry::get('settings.General.checkout_style') != 'multi_page' ? 'checkout' : 'summary'));
}
} elseif (in_array($action, array('save', 'repay', 'route')) && !empty($order_id)) {
$order_info = fn_get_order_info($order_id, true);
$display_notification = true;
fn_set_hook('placement_routines', $order_id, $order_info, $force_notification, $clear_cart, $action, $display_notification);
if (!empty($_SESSION['cart']['placement_action'])) {
if (empty($action)) {
$action = $_SESSION['cart']['placement_action'];
}
unset($_SESSION['cart']['placement_action']);
}
if ($area == 'C' && !empty($order_info['user_id'])) {
$__fake = '';
fn_save_cart_content($__fake, $order_info['user_id']);
}
$edp_data = fn_generate_ekeys_for_edp(array(), $order_info);
fn_order_notification($order_info, $edp_data, $force_notification);
$_error = false;
if ($action == 'save') {
if ($display_notification) {
fn_set_notification('N', __('congratulations'), __('text_order_saved_successfully'));
}
} else {
if ($order_info['status'] == STATUS_PARENT_ORDER) {
$child_orders = db_get_hash_single_array("SELECT order_id, status FROM ?:orders WHERE parent_order_id = ?i", array('order_id', 'status'), $order_id);
$status = reset($child_orders);
$child_orders = array_keys($child_orders);
} else {
$status = $order_info['status'];
}
if (in_array($status, fn_get_order_paid_statuses())) {
if ($action == 'repay') {
fn_set_notification('N', __('congratulations'), __('text_order_repayed_successfully'));
} else {
fn_set_notification('N', __('order_placed'), __('text_order_placed_successfully'));
}
} elseif ($status == STATUS_BACKORDERED_ORDER) {
fn_set_notification('W', __('important'), __('text_order_backordered'));
} else {
if ($area == 'A' || $action == 'repay') {
if ($status != STATUS_CANCELED_ORDER) {
$_payment_info = db_get_field("SELECT data FROM ?:order_data WHERE order_id = ?i AND type = 'P'", $order_id);
if (!empty($_payment_info)) {
$_payment_info = unserialize(fn_decrypt_text($_payment_info));
$_msg = !empty($_payment_info['reason_text']) ? $_payment_info['reason_text'] : '';
$_msg .= empty($_msg) ? __('text_order_placed_error') : '';
fn_set_notification('E', '', $_msg);
}
}
} else {
$_error = true;
if (!empty($child_orders)) {
array_unshift($child_orders, $order_id);
} else {
$child_orders = array();
$child_orders[] = $order_id;
}
$_SESSION['cart'][$status == STATUS_INCOMPLETED_ORDER ? 'processed_order_id' : 'failed_order_id'] = $child_orders;
}
if ($status == STATUS_INCOMPLETED_ORDER || $action == 'repay' && $status == STATUS_CANCELED_ORDER) {
fn_set_notification('W', __('important'), __('text_transaction_cancelled'));
}
}
}
// Empty cart
if ($clear_cart == true && $_error == false) {
$_SESSION['cart'] = array('user_data' => !empty($_SESSION['cart']['user_data']) ? $_SESSION['cart']['user_data'] : array(), 'profile_id' => !empty($_SESSION['cart']['profile_id']) ? $_SESSION['cart']['profile_id'] : 0, 'user_id' => !empty($_SESSION['cart']['user_id']) ? $_SESSION['cart']['user_id'] : 0);
$_SESSION['shipping_rates'] = array();
unset($_SESSION['shipping_hash']);
db_query('DELETE FROM ?:user_session_products WHERE session_id = ?s AND type = ?s', Session::getId(), 'C');
}
fn_set_hook('order_placement_routines', $order_id, $force_notification, $order_info, $_error);
if ($area == 'A') {
fn_redirect("orders.details?order_id={$order_id}");
} else {
fn_redirect('checkout.' . ($_error == true ? Registry::get('settings.General.checkout_style') != 'multi_page
|
请发表评论