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', 0); $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'];
} $data_pro[] = array('id' => $id, 'listcatid' => $listcatid, 'publtime' => $publtime, 'title' => $title, 'alias' => $alias, 'hometext' => $hometext, 'homeimgalt' => $homeimgalt, 'homeimgthumb' => $thumb, 'product_code' => $product_code, 'product_number' => $product_number, 'product_price' => $product_price, 'discount_id' => $discount_id, 'money_unit' => $money_unit, 'showprice' => $showprice, 'gift_content' => $gift_content, 'gift_from' => $gift_from, 'gift_to' => $gift_to, 'newday' => $global_array_shops_cat[$listcatid]['newday'], 'link_pro' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_shops_cat[$catid_i]['alias'] . '/' . $alias . $global_config['rewrite_exturl'], 'link_order' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=setcart&id=' . $id); } $data_content[] = array('catid' => $catid_i, 'subcatid' => $array_info_i['subcatid'], 'title' => $array_info_i['title'], 'link' => $array_info_i['link'], 'data' => $data_pro, 'num_pro' => $num_pro, 'num_link' => $array_info_i['numlinks']); } } if ($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; } } elseif ($pro_config['home_view'] == 'view_home_group') { $num_links = $pro_config['per_row'] * 3; foreach ($global_array_group as $groupid_i => $array_info_i) { if ($array_info_i['parentid'] == 0 and $array_info_i['inhome'] != 0) { $array_group = array(); $array_group = GetGroupidInParent($groupid_i, true); $sql_regexp = array(); foreach ($array_group as $_gid) { $sql_regexp[] = "( t3.group_id='" . $_gid . "' )"; } $sql_regexp = "(" . implode(" OR ", $sql_regexp) . ")"; // Fetch Limit $db->sqlreset()->select('DISTINCT id')->from($db_config['prefix'] . '_' . $module_data . '_rows t1')->join('INNER JOIN ' . $db_config['prefix'] . '_' . $module_data . '_group_items t3 ON t3.pro_id = t1.id')->where($sql_regexp . ' AND t1.inhome=1 AND t1.status =1'); $num_pro = $db->query($db->sql())->rowCount(); $db->select('DISTINCT t1.id, t1.listcatid, t1.publtime, t1.' . NV_LANG_DATA . '_title, t1.' . NV_LANG_DATA . '_alias, t1.' . NV_LANG_DATA . '_hometext, t1.homeimgalt, t1.homeimgfile, t1.homeimgthumb, t1.product_code, t1.product_number, t1.product_price, t1.money_unit, t1.discount_id, t1.showprice, t1.' . NV_LANG_DATA . '_gift_content, t1.gift_from, t1.gift_to')->order('t1.id DESC')->limit($num_links); $result = $db->query($db->sql()); $data_pro = array(); while (list($id, $listcatid, $publtime, $title, $alias, $hometext, $homeimgalt, $homeimgfile, $homeimgthumb, $product_code, $product_number, $product_price, $money_unit, $discount_id, $showprice, $gift_content, $gift_from, $gift_to) = $result->fetch(3)) { if ($homeimgthumb == 1) { $thumb = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_upload . '/' . $homeimgfile; } elseif ($homeimgthumb == 2) {
/** * nv_filter_product_cat() * * @return */ function nv_filter_product_cat($block_config) { global $module_name, $lang_module, $module_info, $site_mods, $module_file, $module_upload, $db, $module_data, $db_config, $id, $catid, $pro_config, $global_config, $global_array_group, $global_array_shops_cat, $nv_Request, $array_id_group, $catid, $op; if ($op != 'viewcat') { return ''; } $module = $block_config['module']; $array_cat = GetCatidInParent($catid); $group_style = $block_config['group_style']; $xtpl = new XTemplate('block.filter_product_cat.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('CATID', $catid); $xtpl->assign('MODULE_URL', nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true)); $xtpl->assign('CAT_ALIAS', $global_array_shops_cat[$catid]['alias']); $catid = GetParentCatFilter($catid); $result = $db->query('SELECT groupid FROM ' . $db_config['prefix'] . '_' . $site_mods[$module]['module_data'] . '_group_cateid WHERE cateid = ' . $catid); $i = 0; while (list($groupid) = $result->fetch(3)) { $groupinfo = $global_array_group[$groupid]; $groupinfo['key'] = str_replace('-', '_', $groupinfo['alias']); $groupinfo['class'] = strtolower($groupinfo['alias']); $xtpl->assign('MAIN_GROUP', $groupinfo); $subgroup = GetGroupidInParent($groupid, 0, 1); if (!empty($subgroup)) { foreach ($subgroup as $subgroup_id) { if (!empty($global_array_group[$subgroup_id]['image'])) { $global_array_group[$subgroup_id]['image'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $global_array_group[$subgroup_id]['image']; } $global_array_group[$subgroup_id]['checked'] = ''; if ($group_style[$groupid] == 'label') { if (in_array($subgroup_id, $array_id_group)) { $global_array_group[$subgroup_id]['checked'] = 'checked="checked"'; } } elseif ($group_style[$groupid] == 'image') { if (in_array($subgroup_id, $array_id_group)) { $global_array_group[$subgroup_id]['checked'] = 'checked="checked"'; } } $xtpl->assign('SUB_GROUP', $global_array_group[$subgroup_id]); if ($group_style[$groupid] == 'label') { if (in_array($subgroup_id, $array_id_group)) { $xtpl->parse('main.group.sub_group.loop.label.active'); } $xtpl->parse('main.group.sub_group.loop.label'); } elseif ($group_style[$groupid] == 'image') { if (in_array($subgroup_id, $array_id_group)) { $xtpl->parse('main.group.sub_group.loop.image.active'); } $xtpl->parse('main.group.sub_group.loop.image'); } else { $xtpl->parse('main.group.sub_group.loop.checkbox'); } $xtpl->parse('main.group.sub_group.loop'); } $xtpl->parse('main.group.sub_group'); } if ($i == 0) { $xtpl->parse('main.group.border_top'); } $xtpl->parse('main.group'); $i++; } $xtpl->parse('main'); return $xtpl->text('main'); }
$contents_temp .= '<label class="col-xs-24 col-sm-4"><input type="checkbox" name="groupids[]" value="' . $groupid_i . '"' . $ch . ' />' . $image . $data_group['title'] . '</label>'; } } return $contents_temp; } $cid = $nv_Request->get_int('cid', 'get', 0); $inrow = $nv_Request->get_string('inrow', 'get', ''); $inrow = nv_base64_decode($inrow); $array_groupid_in_row = unserialize($inrow); $contents_temp_cate = ''; if ($cid > 0) { $cid = GetParentCatFilter($cid); $arr_groupid = array(); $result = $db->query('SELECT t1.groupid FROM ' . $db_config['prefix'] . '_' . $module_data . '_group t1 INNER JOIN ' . $db_config['prefix'] . '_' . $module_data . '_group_cateid t2 ON t1.groupid = t2.groupid WHERE t2.cateid = ' . $cid); while (list($groupid) = $result->fetch(3)) { $arr_groupid[$groupid] = GetGroupidInParent($groupid, 0, 1); } foreach ($arr_groupid as $groupid_i => $subgroupid_i) { $data_group = $global_array_group[$groupid_i]; $require = ''; if ($data_group['is_require']) { $require = ' <span class="require">(*)</span>'; } $contents_temp_cate .= '<div class="row">'; $contents_temp_cate .= '<label class="col-sm-3 control-label"><strong>' . $data_group['title'] . $require . '</strong></label>'; $contents_temp_cate .= '<div class="col-sm-21">'; if ($data_group['numsubgroup'] > 0) { $contents_temp_cate .= getgroup_ckhtml($subgroupid_i, $array_groupid_in_row); } $contents_temp_cate .= '</div>'; $contents_temp_cate .= '</div>';
/** * GetGroupidInParent() * * @param mixed $groupid * @param integer $check_inhome * @return */ function GetGroupidInParent($groupid, $check_inhome = 0, $only_children = 0) { global $global_array_group, $array_group; if ($only_children) { $array_group = array(); } else { $array_group[] = $groupid; } $subgroupid = explode(',', $global_array_group[$groupid]['subgroupid']); if (!empty($subgroupid)) { foreach ($subgroupid as $id) { if ($id > 0) { if ($global_array_group[$id]['numsubgroup'] == 0) { if (!$check_inhome or $check_inhome and $global_array_group[$id]['inhome'] == 1) { $array_group[] = $id; } } else { $array_group_temp = GetGroupidInParent($id, $check_inhome); foreach ($array_group_temp as $groupid_i) { if (!$check_inhome or $check_inhome and $global_array_group[$groupid_i]['inhome'] == 1) { $array_group[] = $groupid_i; } } } } } } return array_unique($array_group); }