Merge branch 'master' of github.com:gnuboard/yc5
This commit is contained in:
@ -72,48 +72,52 @@ if($_FILES['excelfile']['tmp_name']) {
|
||||
$succ_count = 0;
|
||||
$comma = '';
|
||||
|
||||
/*
|
||||
$sql = " INSERT INTO {$g5['g5_shop_item_table']}
|
||||
( it_id, ca_id, ca_id2, ca_id3, it_name, it_maker, it_origin, it_brand, it_model, it_type1, it_type2, it_type3, it_type4, it_type5, it_basic, it_explan, it_mobile_explan, it_cust_price, it_price, it_point, it_sell_email, it_use, it_stock_qty, it_time, it_ip, it_order, it_tel_inq, it_img1, it_img2, it_img3, it_img4, it_img5, it_img6, it_img7, it_img8, it_img9, it_img10 )
|
||||
VALUES ";
|
||||
*/
|
||||
|
||||
for ($i = 3; $i <= $data->sheets[0]['numRows']; $i++) {
|
||||
$total_count++;
|
||||
|
||||
$it_id = addslashes($data->sheets[0]['cells'][$i][1]);
|
||||
$ca_id = addslashes($data->sheets[0]['cells'][$i][2]);
|
||||
$ca_id2 = addslashes($data->sheets[0]['cells'][$i][3]);
|
||||
$ca_id3 = addslashes($data->sheets[0]['cells'][$i][4]);
|
||||
$it_name = addslashes($data->sheets[0]['cells'][$i][5]);
|
||||
$it_maker = addslashes($data->sheets[0]['cells'][$i][7]);
|
||||
$it_origin = addslashes($data->sheets[0]['cells'][$i][8]);
|
||||
$it_brand = addslashes($data->sheets[0]['cells'][$i][9]);
|
||||
$it_model = addslashes($data->sheets[0]['cells'][$i][10]);
|
||||
$it_type1 = addslashes($data->sheets[0]['cells'][$i][11]);
|
||||
$it_type2 = addslashes($data->sheets[0]['cells'][$i][12]);
|
||||
$it_type3 = addslashes($data->sheets[0]['cells'][$i][13]);
|
||||
$it_type4 = addslashes($data->sheets[0]['cells'][$i][14]);
|
||||
$it_type5 = addslashes($data->sheets[0]['cells'][$i][15]);
|
||||
$it_basic = addslashes($data->sheets[0]['cells'][$i][16]);
|
||||
$it_explan = addslashes($data->sheets[0]['cells'][$i][17]);
|
||||
$it_mobile_explan = addslashes($data->sheets[0]['cells'][$i][18]);
|
||||
$it_cust_price = addslashes(only_number($data->sheets[0]['cells'][$i][19]));
|
||||
$it_price = addslashes(only_number($data->sheets[0]['cells'][$i][20]));
|
||||
$it_tel_inq = addslashes($data->sheets[0]['cells'][$i][21]);
|
||||
$it_point = addslashes(only_number($data->sheets[0]['cells'][$i][22]));
|
||||
$it_sell_email = addslashes($data->sheets[0]['cells'][$i][23]);
|
||||
$it_use = addslashes($data->sheets[0]['cells'][$i][24]);
|
||||
$it_stock_qty = addslashes(only_number($data->sheets[0]['cells'][$i][25]));
|
||||
$it_order = addslashes(only_number($data->sheets[0]['cells'][$i][26]));
|
||||
$it_img1 = addslashes($data->sheets[0]['cells'][$i][27]);
|
||||
$it_img2 = addslashes($data->sheets[0]['cells'][$i][28]);
|
||||
$it_img3 = addslashes($data->sheets[0]['cells'][$i][29]);
|
||||
$it_img4 = addslashes($data->sheets[0]['cells'][$i][30]);
|
||||
$it_img5 = addslashes($data->sheets[0]['cells'][$i][31]);
|
||||
$it_img6 = addslashes($data->sheets[0]['cells'][$i][32]);
|
||||
$it_img7 = addslashes($data->sheets[0]['cells'][$i][33]);
|
||||
$it_img8 = addslashes($data->sheets[0]['cells'][$i][34]);
|
||||
$it_img9 = addslashes($data->sheets[0]['cells'][$i][35]);
|
||||
$it_img10 = addslashes($data->sheets[0]['cells'][$i][36]);
|
||||
$j = 1;
|
||||
|
||||
$it_id = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$ca_id = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$ca_id2 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$ca_id3 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_name = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_maker = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_origin = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_brand = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_model = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_type1 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_type2 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_type3 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_type4 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_type5 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_basic = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_explan = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_mobile_explan = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_cust_price = addslashes(only_number($data->sheets[0]['cells'][$i][$j++]));
|
||||
$it_price = addslashes(only_number($data->sheets[0]['cells'][$i][$j++]));
|
||||
$it_tel_inq = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_point = addslashes(only_number($data->sheets[0]['cells'][$i][$j++]));
|
||||
$it_sell_email = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_use = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_stock_qty = addslashes(only_number($data->sheets[0]['cells'][$i][$j++]));
|
||||
$it_order = addslashes(only_number($data->sheets[0]['cells'][$i][$j++]));
|
||||
$it_img1 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_img2 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_img3 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_img4 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_img5 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_img6 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_img7 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_img8 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_img9 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
$it_img10 = addslashes($data->sheets[0]['cells'][$i][$j++]);
|
||||
|
||||
if(!$it_id || !$ca_id || !$it_name) {
|
||||
$fail_count++;
|
||||
@ -140,14 +144,57 @@ if($_FILES['excelfile']['tmp_name']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
$sql .= $comma." ( '$it_id', '$ca_id', '$ca_id2', '$ca_id3', '$it_name', '$it_maker', '$it_origin', '$it_brand', '$it_model', '$it_type1', '$it_type2', '$it_type3', '$it_type4', '$it_type5', '$it_basic', '$it_explan', '$it_mobile_explan', '1', '$it_cust_price', '$it_price', '$it_point', '$it_sell_email', '$it_use', '$it_stock_qty', '".G5_TIME_YMDHIS."', '".$_SERVER['REMOTE_ADDR']."', '$it_order', '$it_tel_inq', '$it_img1', '$it_img2', '$it_img3', '$it_img4', '$it_img5', '$it_img6', '$it_img7', '$it_img8', '$it_img9', '$it_img10' ) ";
|
||||
|
||||
$comma = ' , ';
|
||||
*/
|
||||
|
||||
$sql = " INSERT INTO {$g5['g5_shop_item_table']}
|
||||
SET it_id = '$it_id',
|
||||
ca_id = '$ca_id',
|
||||
ca_id2 = '$ca_id2',
|
||||
ca_id3 = '$ca_id3',
|
||||
it_name = '$it_name',
|
||||
it_maker = '$it_maker',
|
||||
it_origin = '$it_origin',
|
||||
it_brand = '$it_brand',
|
||||
it_model = '$it_model',
|
||||
it_type1 = '$it_type1',
|
||||
it_type2 = '$it_type2',
|
||||
it_type3 = '$it_type3',
|
||||
it_type4 = '$it_type4',
|
||||
it_type5 = '$it_type5',
|
||||
it_basic = '$it_basic',
|
||||
it_explan = '$it_explan',
|
||||
it_mobile_explan = '$it_mobile_explan',
|
||||
it_cust_price = '$it_cust_price',
|
||||
it_price = '$it_price',
|
||||
it_point = '$it_point',
|
||||
it_use = '$it_use',
|
||||
it_time = '".G5_TIME_YMDHIS."',
|
||||
it_ip = '{$_SERVER['REMOTE_ADDR']}',
|
||||
it_order = '$it_order',
|
||||
it_tel_inq = '$it_tel_inq',
|
||||
it_img1 = '$it_img1',
|
||||
it_img2 = '$it_img2',
|
||||
it_img3 = '$it_img3',
|
||||
it_img4 = '$it_img4',
|
||||
it_img5 = '$it_img5',
|
||||
it_img6 = '$it_img6',
|
||||
it_img7 = '$it_img7',
|
||||
it_img8 = '$it_img8',
|
||||
it_img9 = '$it_img9',
|
||||
it_img10 = '$it_img10' ";
|
||||
sql_query($sql);
|
||||
|
||||
$succ_count++;
|
||||
}
|
||||
|
||||
/*
|
||||
if($succ_count > 0)
|
||||
sql_query($sql);
|
||||
*/
|
||||
}
|
||||
|
||||
$g5['title'] = '상품 엑셀일괄등록 결과';
|
||||
|
||||
@ -260,8 +260,6 @@ $it_name = strip_tags(trim($_POST['it_name']));
|
||||
if ($it_name == "")
|
||||
alert("상품명을 입력해 주십시오.");
|
||||
|
||||
$it_explan_strip_tags = strip_tags(trim($_POST['it_explan']));
|
||||
|
||||
$sql_common = " ca_id = '$ca_id',
|
||||
ca_id2 = '$ca_id2',
|
||||
ca_id3 = '$ca_id3',
|
||||
@ -280,7 +278,7 @@ $sql_common = " ca_id = '$ca_id',
|
||||
it_type5 = '$it_type5',
|
||||
it_basic = '$it_basic',
|
||||
it_explan = '$it_explan',
|
||||
it_explan_strip_tags= '$it_explan_strip_tags',
|
||||
it_explan2 = '".strip_tags(trim($_POST['it_explan']))."',
|
||||
it_mobile_explan = '$it_mobile_explan',
|
||||
it_cust_price = '$it_cust_price',
|
||||
it_price = '$it_price',
|
||||
|
||||
@ -23,23 +23,6 @@ if (G5_HTTPS_DOMAIN) {
|
||||
define('G5_HTTPS_MSHOP_URL', G5_MSHOP_URL);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// 쇼핑몰 상수 모음 끝
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// 쇼핑몰 필수 실행코드 모음 시작
|
||||
//==============================================================================
|
||||
|
||||
// 쇼핑몰 설정값 배열변수
|
||||
$default = sql_fetch(" select * from {$g5['g5_shop_default_table']} ");
|
||||
|
||||
define('G5_SHOP_SKIN_PATH', G5_PATH.'/'.G5_SKIN_DIR.'/shop/'.$default['de_shop_skin']);
|
||||
define('G5_SHOP_SKIN_URL', G5_URL .'/'.G5_SKIN_DIR.'/shop/'.$default['de_shop_skin']);
|
||||
define('G5_MSHOP_SKIN_PATH', G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/shop/'.$default['de_shop_mobile_skin']);
|
||||
define('G5_MSHOP_SKIN_URL', G5_MOBILE_URL .'/'.G5_SKIN_DIR.'/shop/'.$default['de_shop_mobile_skin']);
|
||||
|
||||
/*
|
||||
배송업체에 데이터를 추가하는 경우 아래 형식으로 추가하세요.
|
||||
.'(배송업체명^택배조회URL^연락처)'
|
||||
@ -59,6 +42,26 @@ define('G5_DELIVERY_COMPANY',
|
||||
.'(KGB택배^http://www.kgbls.co.kr/sub5/trace.asp?f_slipno=^1577-4577)'
|
||||
);
|
||||
|
||||
define('G5_SHOP_SEARCH_SKIN', 'list.10.skin.php'); // 상품검색스킨
|
||||
define('G5_SHOP_SEARCH_MOD', 4); // 상품검색 1라인에 몇개
|
||||
define('G5_SHOP_SEARCH_ROW', 5); // 상품검색 라인수
|
||||
//------------------------------------------------------------------------------
|
||||
// 쇼핑몰 상수 모음 끝
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// 쇼핑몰 필수 실행코드 모음 시작
|
||||
//==============================================================================
|
||||
|
||||
// 쇼핑몰 설정값 배열변수
|
||||
$default = sql_fetch(" select * from {$g5['g5_shop_default_table']} ");
|
||||
|
||||
define('G5_SHOP_SKIN_PATH', G5_PATH.'/'.G5_SKIN_DIR.'/shop/'.$default['de_shop_skin']);
|
||||
define('G5_SHOP_SKIN_URL', G5_URL .'/'.G5_SKIN_DIR.'/shop/'.$default['de_shop_skin']);
|
||||
define('G5_MSHOP_SKIN_PATH', G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/shop/'.$default['de_shop_mobile_skin']);
|
||||
define('G5_MSHOP_SKIN_URL', G5_MOBILE_URL .'/'.G5_SKIN_DIR.'/shop/'.$default['de_shop_mobile_skin']);
|
||||
|
||||
/*
|
||||
// 주문상태 상수
|
||||
define('G5_OD_STATUS_ORDER' , '입금확인중');
|
||||
|
||||
@ -650,8 +650,8 @@ if(stripos($row['Type'], 'enum') !== false) {
|
||||
|
||||
|
||||
// 상품테이블에 검색을 위하여 태그없는 상품설명 저장용 필드 추가
|
||||
if(!sql_query(" select it_explan_strip_tags from {$g5['g5_shop_item_table']} limit 1 ", false)) {
|
||||
if(!sql_query(" select it_explan2 from {$g5['g5_shop_item_table']} limit 1 ", false)) {
|
||||
sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
|
||||
ADD `it_explan_strip_tags` MEDIUMTEXT NOT NULL AFTER `it_explan` ", true);
|
||||
ADD `it_explan2 METIUMTEXT NOT NULL AFTER `it_explan` ", true);
|
||||
}
|
||||
?>
|
||||
|
||||
@ -421,7 +421,7 @@ CREATE TABLE IF NOT EXISTS `g5_shop_item` (
|
||||
`it_type5` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`it_basic` text NOT NULL,
|
||||
`it_explan` mediumtext NOT NULL,
|
||||
`it_explan_strip_tags` mediumtext NOT NULL,
|
||||
`it_explan2` mediumtext NOT NULL,
|
||||
`it_mobile_explan` mediumtext NOT NULL,
|
||||
`it_cust_price` int(11) NOT NULL DEFAULT '0',
|
||||
`it_price` int(11) NOT NULL DEFAULT '0',
|
||||
|
||||
Binary file not shown.
234
shop/search.php
234
shop/search.php
@ -9,142 +9,138 @@ if (G5_IS_MOBILE) {
|
||||
$g5['title'] = "상품 검색 결과";
|
||||
include_once('./_head.php');
|
||||
|
||||
$q = utf8_strcut(escape_trim($_GET['q']), 30, "");
|
||||
$qname = escape_trim($_GET['qname']);
|
||||
$qexplan = escape_trim($_GET['qexplan']);
|
||||
$qid = escape_trim($_GET['qid']);
|
||||
$qcaid = escape_trim($_GET['qcaid']);
|
||||
$qfrom = escape_trim($_GET['qfrom']);
|
||||
$qto = escape_trim($_GET['qto']);
|
||||
|
||||
// QUERY 문에 공통적으로 들어가는 내용
|
||||
// 상품명에 검색어가 포한된것과 상품판매가능인것만
|
||||
$sql_common = " from {$g5['g5_shop_item_table']} a,
|
||||
{$g5['g5_shop_category_table']} b
|
||||
where a.ca_id=b.ca_id
|
||||
and a.it_use = 1
|
||||
and b.ca_use = 1
|
||||
/* 중복검색에 대한 오류로 인해 막음 : where (a.ca_id=b.ca_id or a.ca_id2=b.ca_id or a.ca_id3=b.ca_id) */ ";
|
||||
if ($search_str) {
|
||||
$sql_common .= " and ( a.it_id like '$search_str%' or
|
||||
a.it_name like '%$search_str%' or
|
||||
a.it_basic like '%$search_str%' or
|
||||
a.it_explan like '%$search_str%' ) ";
|
||||
}
|
||||
/*
|
||||
// 공백을 구분하여 검색을 할때는 이 코드를 사용하십시오. or 조건
|
||||
if ($search_str) {
|
||||
$s_str = explode(" ", $search_str);
|
||||
$or = " ";
|
||||
$sql_common .= " and ( ";
|
||||
for ($i=0; $i<count($s_str); $i++) {
|
||||
$sql_common .= " $or (a.it_id like '$s_str[$i]%' or a.it_name like '%$s_str[$i]%' or a.it_basic like '%$s_str[$i]%' or a.it_explan like '%$s_str[$i]%' ) ";
|
||||
$or = " or ";
|
||||
}
|
||||
$sql_common .= " ) ";
|
||||
}
|
||||
*/
|
||||
$sql_common = " from {$g5['g5_shop_item_table']} a, {$g5['g5_shop_category_table']} b ";
|
||||
|
||||
// 분류선택이 있다면 특정 분류만
|
||||
if ($search_ca_id != "")
|
||||
$sql_common .= " and a.ca_id like '$search_ca_id%' ";
|
||||
$where = array();
|
||||
$where[] = " (a.ca_id = b.ca_id and a.it_use = 1 and b.ca_use = 1) ";
|
||||
|
||||
$search_all = true;
|
||||
// 상세검색 이라면
|
||||
if (isset($qname) || isset($qexplan) || isset($qid))
|
||||
$search_all = false;
|
||||
|
||||
if ($q) {
|
||||
$arr = explode(" ", $q);
|
||||
$detail_where = array();
|
||||
for ($i=0; $i<count($arr); $i++) {
|
||||
$word = trim($arr[$i]);
|
||||
if (!$word) continue;
|
||||
|
||||
$or = array();
|
||||
if ($search_all || $qname)
|
||||
$or[] = " a.it_name like '%$word%' ";
|
||||
if ($search_all || $qexplan)
|
||||
$or[] = " a.it_explan2 like '%$word%' "; // tag 를 제거한 상품설명을 검색한다.
|
||||
if ($search_all || $qid)
|
||||
$or[] = " a.it_id like '%$word%' ";
|
||||
|
||||
$detail_where[] = "(" . implode(" or ", $or) . ")";
|
||||
|
||||
// 인기검색어
|
||||
$sql = " insert into {$g5['popular_table']} set pp_word = '$word', pp_date = '".G5_TIME_YMD."', pp_ip = '{$_SERVER['REMOTE_ADDR']}' ";
|
||||
sql_query($sql, FALSE);
|
||||
}
|
||||
|
||||
$where[] = "(".implode(" or ", $detail_where).")";
|
||||
}
|
||||
|
||||
if ($qcaid)
|
||||
$where[] = " a.ca_id like '$qcaid%' ";
|
||||
|
||||
if ($qfrom || $qto)
|
||||
$where[] = " a.it_price between '$qfrom' and '$qto' ";
|
||||
|
||||
$sql_where = " where " . implode(" and ", $where);
|
||||
|
||||
// 상품 출력순서가 있다면
|
||||
if ($sort != "")
|
||||
$order_by = $sort.' '.$sortodr.' , it_order, it_id desc';
|
||||
|
||||
// 검색된 내용이 몇행인지를 얻는다
|
||||
$sql = " select COUNT(*) as cnt $sql_common ";
|
||||
$sql = " select COUNT(*) as cnt $sql_common $sql_where ";
|
||||
$row = sql_fetch($sql);
|
||||
$total_count = $row['cnt'];
|
||||
?>
|
||||
|
||||
<form name="frmdetailsearch" onsubmit="return detail_search_submit(this);">
|
||||
상세검색 :
|
||||
<input type="checkbox" name="qname" <?php echo isset($qname)?'checked="checked"':'';?>> 상품명
|
||||
<input type="checkbox" name="qexplan" <?php echo isset($qexplan)?'checked="checked"':'';?>> 상품설명
|
||||
<input type="checkbox" name="qid" <?php echo isset($qid)?'checked="checked"':'';?>> 상품코드<br>
|
||||
상품가격 :
|
||||
<input type="text" name="qfrom" value="<?php echo $qfrom; ?>" size="10">원 부터
|
||||
<input type="text" name="qto" value="<?php echo $qto; ?>" size="10">원 까지<br>
|
||||
검색어 : <input type="text" name="q" value="<?php echo $q; ?>" size="40" maxlength="30">
|
||||
<input type="submit" value="검색">
|
||||
<p>상세검색을 선택하지 않거나, 상품가격을 입력하지 않으면 전체에서 검색합니다.</p>
|
||||
</form>
|
||||
|
||||
<!-- 검색결과 시작 { -->
|
||||
<div id="ssch">
|
||||
|
||||
<div id="ssch_ov">검색어 <strong><?php echo ($search_str ? stripslashes(get_text($search_str)) : '없음'); ?></strong> | 검색 결과 <strong><?php echo $total_count; ?></strong>건</div>
|
||||
<div id="ssch_ov">검색어 <strong><?php echo ($q ? stripslashes(get_text($q)) : '없음'); ?></strong> | 검색 결과 <strong><?php echo $total_count; ?></strong>건</div>
|
||||
|
||||
<?php
|
||||
// 임시배열에 저장해 놓고 분류별로 출력한다.
|
||||
// write_serarch_save() 함수가 임시배열에 있는 내용을 출력함
|
||||
if ($total_count > 0) {
|
||||
if (trim($search_str)) {
|
||||
// 인기검색어
|
||||
$sql = " insert into {$g5['popular_table']}
|
||||
set pp_word = '$search_str',
|
||||
pp_date = '".G5_TIME_YMD."',
|
||||
pp_ip = '{$_SERVER['REMOTE_ADDR']}' ";
|
||||
sql_query($sql, FALSE);
|
||||
}
|
||||
|
||||
unset($save); // 임시 저장 배열
|
||||
$sql = " select a.ca_id,
|
||||
a.it_id
|
||||
$sql_common
|
||||
order by a.ca_id, a.it_id desc ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=mysql_fetch_array($result); $i++) {
|
||||
if ($save['ca_id'] != $row['ca_id']) {
|
||||
if ($save['ca_id']) {
|
||||
write_search_save($save);
|
||||
unset($save);
|
||||
}
|
||||
$save['ca_id'] = $row['ca_id'];
|
||||
$save['cnt'] = 0;
|
||||
}
|
||||
$save['it_id'][$save['cnt']] = $row['it_id'];
|
||||
$save[cnt]++;
|
||||
}
|
||||
mysql_free_result($result);
|
||||
}
|
||||
|
||||
write_search_save($save);
|
||||
|
||||
function write_search_save($save)
|
||||
{
|
||||
global $g5, $search_str , $default , $image_rate , $cart_dir;
|
||||
|
||||
$sql = " select ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$save['ca_id']}' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
// 김선용 2006.12 : 중복 하위분류명이 많으므로 대분류 포함하여 출력
|
||||
$ca_temp = "";
|
||||
if(strlen($save['ca_id']) > 2) // 중분류 이하일 경우
|
||||
{
|
||||
$sql2 = " select ca_name from {$g5['g5_shop_category_table']} where ca_id='".substr($save['ca_id'],0,2)."' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
$ca_temp = '<a href="./list.php?ca_id='.substr($save['ca_id'],0,2).'">'.$row2['ca_name'].'</a> > ';
|
||||
}
|
||||
?>
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $ca_temp?><a href="./list.php?ca_id=<?php echo $save['ca_id']; ?>"><?php echo $row['ca_name']; ?></a> 상품<?php echo (int)$save['cnt']; ?>개</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">이미지</td>
|
||||
<th scope="col">상품명</th>
|
||||
<th scope="col">판매가격</td>
|
||||
<th scope="col">포인트</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<div>
|
||||
<?php
|
||||
for ($i=0; $i<$save['cnt']; $i++) {
|
||||
$sql = " select it_id,
|
||||
it_name,
|
||||
it_price,
|
||||
it_tel_inq,
|
||||
it_point,
|
||||
it_type1,
|
||||
it_type2,
|
||||
it_type3,
|
||||
it_type4,
|
||||
it_type5
|
||||
from {$g5['g5_shop_item_table']} where it_id = '{$save['it_id'][$i]}' ";
|
||||
$row = sql_fetch($sql);
|
||||
// 리스트 유형별로 출력
|
||||
$list_file = G5_SHOP_SKIN_PATH.'/'.G5_SHOP_SEARCH_SKIN;
|
||||
if (file_exists($list_file)) {
|
||||
|
||||
$image = get_it_image($row['it_id'], (int)($default['de_simg_width']), (int)($default['de_simg_height']), true);
|
||||
// 총몇개 = 한줄에 몇개 * 몇줄
|
||||
$items = 4 * 5;
|
||||
// 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
if ($page == "") $page = 1;
|
||||
// 시작 레코드 구함
|
||||
$from_record = ($page - 1) * $items;
|
||||
|
||||
$list = new item_list(G5_SHOP_SEARCH_SKIN, G5_SHOP_SEARCH_MOD, G5_SHOP_SEARCH_ROW, $default['de_simg_width'], $default['de_simg_height']);
|
||||
$list->set_query(" select * $sql_common $sql_where ");
|
||||
$list->set_is_page(true);
|
||||
$list->set_order_by($order_by);
|
||||
$list->set_from_record($from_record);
|
||||
$list->set_view('it_img', true);
|
||||
$list->set_view('it_id', true);
|
||||
$list->set_view('it_name', true);
|
||||
$list->set_view('it_basic', true);
|
||||
$list->set_view('it_cust_price', false);
|
||||
$list->set_view('it_price', true);
|
||||
$list->set_view('it_icon', true);
|
||||
$list->set_view('sns', true);
|
||||
echo $list->run();
|
||||
|
||||
// where 된 전체 상품수
|
||||
$total_count = $list->total_count;
|
||||
// 전체 페이지 계산
|
||||
$total_page = ceil($total_count / $items);
|
||||
}
|
||||
else
|
||||
{
|
||||
$i = 0;
|
||||
$error = '<p class="sct_nofile">'.$ca['ca_skin'].' 파일을 찾을 수 없습니다.<br>관리자에게 알려주시면 감사하겠습니다.</p>';
|
||||
}
|
||||
|
||||
if ($i==0)
|
||||
{
|
||||
echo '<div>'.$error.'</div>';
|
||||
}
|
||||
|
||||
$qstr1 .= 'ca_id='.$ca_id;
|
||||
if($skin)
|
||||
$qstr1 .= '&skin='.$skin;
|
||||
$qstr1 .='&sort='.$sort.'&sortodr='.$sortodr;
|
||||
echo get_paging($config['cf_write_pages'], $page, $total_page, $_SERVER['PHP_SELF'].'?'.$qstr1.'&page=');
|
||||
?>
|
||||
<tr>
|
||||
<td class="ssch_it_img"><?php echo $image; ?></td>
|
||||
<td><?php echo get_text($row['it_name']); ?></td>
|
||||
<td class="ssch_num"><?php echo display_price(get_price($row), $row['it_tel_inq']); ?></td>
|
||||
<td class="ssch_num"><?php echo display_point($row['it_point']); ?></td>
|
||||
</tr>
|
||||
<?php } // for 끝 ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php } // function 끝 ?>
|
||||
|
||||
</div>
|
||||
<!-- } 검색결과 끝 -->
|
||||
|
||||
@ -44,21 +44,22 @@ include_once(G5_LIB_PATH.'/popular.lib.php');
|
||||
<input type="hidden" name="stx" value="">
|
||||
|
||||
<span>
|
||||
<label for="sch_all_flag" class="sound_only">검색대상</label>
|
||||
<select name="search_flag" id="sch_all_flag">
|
||||
<label for="search_flag" class="sound_only">검색대상</label>
|
||||
<select id="search_flag">
|
||||
<option value="상품" <?php echo get_selected($search_flag, '상품'); ?>>상품</option>
|
||||
<option value="게시판" <?php echo get_selected($search_flag, '게시판'); ?>>게시판</option>
|
||||
</select>
|
||||
</span>
|
||||
|
||||
<label for="sch_all_str" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
|
||||
<input type="text" name="search_str" value="<?php echo stripslashes(get_text($search_str)); ?>" id="sch_all_str" required>
|
||||
<input type="text" name="q" value="<?php echo stripslashes(get_text($q)); ?>" id="sch_all_str" required>
|
||||
<input type="submit" value="검색" id="sch_all_submit">
|
||||
|
||||
</form>
|
||||
<script>
|
||||
function search_submit(f) {
|
||||
if (f.search_flag.value == '상품') {
|
||||
var flag = document.getElementById("search_flag");
|
||||
if (flag.value == '상품') {
|
||||
f.action = '<?php echo G5_SHOP_URL; ?>/search.php';
|
||||
} else {
|
||||
f.stx.value = f.search_str.value;
|
||||
|
||||
Reference in New Issue
Block a user