-
Notifications
You must be signed in to change notification settings - Fork 74
/
group.php
93 lines (73 loc) · 3.74 KB
/
group.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/**
* @Project NUKEVIET 4.x
* @Author VINADES.,JSC (contact@vinades.vn)
* @Copyright (C) 2014 VINADES., JSC. All rights reserved
* @License GNU/GPL version 2 or any later version
* @Createdate 3-6-2010 0:14
*/
if (! defined('NV_IS_MOD_SHOPS')) {
die('Stop!!!');
}
if (empty($groupid)) {
Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true));
exit();
}
$page_title = $lang_module['group_title'];
if (preg_match('/^page\-([0-9]+)$/', (isset($array_op[2]) ? $array_op[2] : ''), $m)) {
$page = ( int )$m[1];
}
$page_title = $global_array_group[$groupid]['title'];
$key_words = $global_array_group[$groupid]['keywords'];
$description = $global_array_group[$groupid]['description'];
$data_content = array();
$chirld_groupid = GetGroupidInParent($groupid, 1);
$nv_Request->get_int('sorts', 'session', 0);
$sorts = $nv_Request->get_int('sort', 'post', 0);
$sorts_old = $nv_Request->get_int('sorts', 'session', $pro_config['sortdefault']);
$sorts = $nv_Request->get_int('sorts', 'post', $sorts_old);
$nv_Request->get_string('viewtype', 'session', '');
$viewtype = $nv_Request->get_string('viewtype', 'post', '');
$viewtype_old = $nv_Request->get_string('viewtype', 'session', '');
$viewtype = $nv_Request->get_string('viewtype', 'post', $viewtype_old);
if (!empty($viewtype)) {
$global_array_group[$groupid]['viewgroup'] = $viewtype;
}
$compare_id = $nv_Request->get_string($module_data . '_compare_id', 'session', '');
$compare_id = unserialize($compare_id);
$link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=';
$base_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=group/' . $global_array_group[$groupid]['alias'];
$array_pro_id = array();
$_sql = 'SELECT pro_id FROM ' . $db_config['prefix'] . '_' . $module_data . '_group_items WHERE group_id IN (' . implode(',', $chirld_groupid) . ')';
$_query = $db->query($_sql);
while (list($pro_id) = $_query->fetch(3)) {
$array_pro_id[] = $pro_id;
}
$array_pro_id = array_unique($array_pro_id);
$array_pro_id = !empty($array_pro_id) ? implode(',', $array_pro_id) : 0;
// Fetch Limit
$db->sqlreset()
->select('COUNT(*)')
->from($db_config['prefix'] . '_' . $module_data . '_rows')
->where('status=1 AND id IN ( ' . $array_pro_id . ' )');
$num_items = $db->query($db->sql())->fetchColumn();
$db->select('id, listcatid, publtime, ' . NV_LANG_DATA . '_title, ' . NV_LANG_DATA . '_alias, ' . NV_LANG_DATA . '_hometext, homeimgalt, homeimgfile, homeimgthumb, product_code, product_number, product_price, money_unit, discount_id, showprice, ' . NV_LANG_DATA . '_gift_content, gift_from, gift_to')
->order('id DESC')
->limit($per_page)
->offset(($page - 1) * $per_page);
$result = $db->query($db->sql());
$data_content = GetDataInGroup($result, $groupid);
$data_content['count'] = $num_items;
if (sizeof($data_content['data']) < 1 and $page > 1) {
Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true));
exit();
}
$pages = nv_alias_page($page_title, $base_url, $num_items, $per_page, $page);
if ($page > 1) {
$page_title .= ' ' . NV_TITLEBAR_DEFIS . ' ' . $lang_global['page'] . ' ' . $page;
$description .= ' ' . $page;
}
$contents = call_user_func($global_array_group[$groupid]['viewgroup'], $data_content, $compare_id, $pages, $sorts, $viewtype);
include NV_ROOTDIR . '/includes/header.php';
echo nv_site_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';