* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
$cart =& $_SESSION['cart'];
$customer_auth =& $_SESSION['customer_auth'];
$suffix = !empty($cart['order_id']) ? '.update' : '.add';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    //
    // Delete point in use from the cart
    //
    if ($mode == 'delete_points_in_use') {
        if (isset($cart['points_info']['in_use'])) {
            $cart['deleted_points_info'] = $cart['points_info'];
            unset($cart['points_info']['in_use']);
        }
        return array(CONTROLLER_STATUS_REDIRECT, 'order_management' . $suffix);
    }
    return;
}
//
// Display totals
//
if ($mode == 'update' || $mode == 'add') {
    $prev_points = !empty($cart['previous_points_info']['in_use']['points']) ? $cart['previous_points_info']['in_use']['points'] : 0;
    $user_points = fn_get_user_additional_data(POINTS, $customer_auth['user_id']) + $prev_points;
    Tygh::$app['view']->assign('user_points', $user_points);
}
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
$cart =& $_SESSION['cart'];
$customer_auth =& $_SESSION['customer_auth'];
$_suffix = !empty($cart['order_id']) ? 'update' : 'add';
if (!empty($customer_auth['user_id']) && !isset($customer_auth['points'])) {
    $customer_auth['points'] = db_get_field("SELECT data FROM ?:user_data WHERE type='W' AND user_id = ?i", $customer_auth['user_id']);
    Registry::get('view')->assign('customer_auth', $customer_auth);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    return;
}
//
// Display totals
//
if ($mode == 'update' || $mode == 'add') {
    Registry::get('view')->assign('user_points', fn_get_user_additional_data(POINTS, $customer_auth['user_id']) + (!empty($cart['previous_points_info']['in_use']['points']) ? $cart['previous_points_info']['in_use']['points'] : 0));
    //
    // Delete point in use from the cart
    //
} elseif ($mode == 'delete_points_in_use') {
    unset($cart['points_info']['in_use']);
    return array(CONTROLLER_STATUS_REDIRECT, "order_management." . $_suffix);
}
Example #3
0
function fn_reward_points_user_init(&$auth, &$user_info)
{
    if (empty($auth['user_id']) || AREA != 'C') {
        return false;
    }
    $points = fn_get_user_additional_data(POINTS, $auth['user_id']);
    if (empty($points)) {
        $points = 0;
    }
    $auth['points'] = $user_info['points'] = $points;
    return true;
}
Example #4
0
$context_vars['%MODE'] = MODE;
$context_vars['%INDEX_SCRIPT'] = $index_script;
foreach ($actions as $item) {
    if (empty($item) || !empty($item['extra']) && strpos(Registry::get('config.current_url'), (string) $item['extra']) === false) {
        continue;
    }
    $_cache[] = (string) $item['title'];
    $navigation['dynamic']['actions'][(string) $item['title']] = array('href' => strtr((string) $item['href'], $context_vars), 'meta' => !empty($item['meta']) ? (string) $item['meta'] : '', 'target' => !empty($item['target']) ? (string) $item['target'] : '');
}
fn_preload_lang_vars($_cache);
// Navigation is passed in view->display method to allow its modification in controllers
$view->assign('quick_menu', fn_get_quick_menu_data());
$schema = fn_get_schema('last_edited_items', 'schema');
$last_items_cnt = LAST_EDITED_ITEMS_COUNT;
if (empty($_SESSION['last_edited_items'])) {
    $stored_items = fn_get_user_additional_data('L');
    $last_edited_items = empty($stored_items) ? array() : $stored_items;
    $_SESSION['last_edited_items'] = $last_edited_items;
} else {
    $last_edited_items = $_SESSION['last_edited_items'];
}
$last_items = array();
foreach ($last_edited_items as $_k => $v) {
    if (!empty($v['func'])) {
        $func = array_shift($v['func']);
        if (function_exists($func)) {
            $content = call_user_func_array($func, $v['func']);
            if (!empty($content)) {
                $name = (empty($v['text']) ? '' : fn_get_lang_var($v['text']) . ': ') . $content;
                array_unshift($last_items, array('name' => $name, 'url' => $v['url'], 'icon' => $v['icon']));
            } else {