<?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'); }
fn_register_hooks(
'get_category_data_pre'
);
<?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'); }
function fn_advanced_addon_get_category_data_pre($category_id, $field_list, $get_main_pair, $skip_company_condition, $lang_code)
{
//ログイン中のユーザーIDをセッションから取得する
$auth = $_SESSION['auth'];
//ログイン中のユーザーがストアフロントにいるかどうかの判定
if (!empty($auth['user_id']) && AREA == 'C') {
//データベースにユーザーのデータが存在するかチェック
//必要に応じてアクセスデータを作成
$viewed_categories = db_get_field('SELECT categories FROM ?:advanced_addon_data WHERE user_id = ?i', $auth['user_id']);
if (!empty($viewed_categories)) {
$viewed_categories = unserialize($viewed_categories);
}
$viewed_categories[$category_id] = true;
$viewed_categories = serialize($viewed_categories);
//データベースに書き込む
db_query('REPLACE INTO ?:advanced_addon_data VALUES (?i, ?s)', $auth['user_id'], $viewed_categories);
}
}
<?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. *
****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) { die('Access denied'); }
$viewed_categories = db_get_array('SELECT * FROM ?:advanced_addon_data');
if (!empty($viewed_categories)) {
foreach ($viewed_categories as $key => $category_data) {
$category_data['user_name'] = fn_get_user_name($category_data['user_id']);
$category_data['categories'] = unserialize($category_data['categories']);
$category_data['categories'] = fn_get_category_name(array_keys($category_data['categories']));
$viewed_categories[$key] = $category_data;
}
Registry::get('view')->assign('viewed_categories', $viewed_categories);
}