모바일 사용후기 상품문의 추가

This commit is contained in:
chicpro
2013-07-18 17:30:19 +09:00
parent 73b838aff3
commit 2d6423301e
14 changed files with 1196 additions and 526 deletions

View File

@ -1,5 +1,11 @@
<?php
include_once('./_common.php');
if (G4_IS_MOBILE) {
include_once(G4_MSHOP_PATH.'/itemqa.php');
return;
}
include_once(G4_LIB_PATH.'/thumbnail.lib.php');
//$it_id = $_REQUEST['it_id'];
@ -39,7 +45,6 @@ $thumbnail_width = 500;
$iq_subject = conv_subject($row['iq_subject'],50,"…");
$iq_question = get_view_thumbnail($row['iq_question'], $thumbnail_width);
$iq_time = substr($row['iq_time'], 2, 8);
$iq_href = './itemqalist.php?bo_table=itemqa&amp;wr_id='.$row['wr_id'];
$hash = md5($row['iq_id'].$row['iq_time'].$row['iq_ip']);
@ -114,7 +119,7 @@ function itemqa_page($write_pages, $cur_page, $total_page, $url, $add="")
$str = '';
if ($cur_page > 1) {
$str .= '<a href="'.$url.'1'.$add.'" class="pg_page pg_start" onclick="return false;">처음</a>'.PHP_EOL;
$str .= '<a href="'.$url.'1'.$add.'" class="qa_page qa_start">처음</a>'.PHP_EOL;
}
$start_page = ( ( (int)( ($cur_page - 1 ) / $write_pages ) ) * $write_pages ) + 1;
@ -122,21 +127,21 @@ function itemqa_page($write_pages, $cur_page, $total_page, $url, $add="")
if ($end_page >= $total_page) $end_page = $total_page;
if ($start_page > 1) $str .= '<a href="'.$url.($start_page-1).$add.'" class="pg_page pg_prev" onclick="return false;">이전</a>'.PHP_EOL;
if ($start_page > 1) $str .= '<a href="'.$url.($start_page-1).$add.'" class="qa_page pg_prev">이전</a>'.PHP_EOL;
if ($total_page > 1) {
for ($k=$start_page;$k<=$end_page;$k++) {
if ($cur_page != $k)
$str .= '<a href="'.$url.$k.$add.'" class="pg_page" onclick="return false;">'.$k.'</a><span class="sound_only">페이지</span>'.PHP_EOL;
$str .= '<a href="'.$url.$k.$add.'" class="qa_page">'.$k.'</a><span class="sound_only">페이지</span>'.PHP_EOL;
else
$str .= '<span class="sound_only">열린</span><strong class="pg_current">'.$k.'</strong><span class="sound_only">페이지</span>'.PHP_EOL;
}
}
if ($total_page > $end_page) $str .= '<a href="'.$url.($end_page+1).$add.'" class="pg_page pg_next">다음</a>'.PHP_EOL;
if ($total_page > $end_page) $str .= '<a href="'.$url.($end_page+1).$add.'" class="qa_page pg_next">다음</a>'.PHP_EOL;
if ($cur_page < $total_page) {
$str .= '<a href="'.$url.$total_page.$add.'" class="pg_page pg_end" onclick="return false;">맨끝</a>'.PHP_EOL;
$str .= '<a href="'.$url.$total_page.$add.'" class="qa_page pg_end">맨끝</a>'.PHP_EOL;
}
if ($str)
@ -145,12 +150,12 @@ function itemqa_page($write_pages, $cur_page, $total_page, $url, $add="")
return "";
}
echo itemqa_page(10, $page, $total_page, "./itemqa.php?it_id=$it_id&amp;page=", "");
echo itemqa_page($config['cf_write_pages'], $page, $total_page, "./itemqa.php?it_id=$it_id&amp;page=", "");
?>
<div id="sit_qa_wbtn">
<!-- <a href="javascript:itemqawin('it_id=<?php echo $it_id; ?>');">상품문의 쓰기<span class="sound_only"> 새 창</span></a> -->
<a href="<?php echo $itemqa_form; ?>" class="btn02 itemqa_form" onclick="return false;">상품문의 쓰기<span class="sound_only"> 새 창</span></a>
<a href="<?php echo $itemqa_form; ?>" class="btn02 itemqa_form">상품문의 쓰기<span class="sound_only"> 새 창</span></a>
<a href="<?php echo $itemqa_list; ?>" id="itemqa_list" class="btn01">더보기</a>
</div>
@ -158,6 +163,7 @@ echo itemqa_page(10, $page, $total_page, "./itemqa.php?it_id=$it_id&amp;page=",
$(function(){
$(".itemqa_form").click(function(){
window.open(this.href, "itemqa_form", "width=800,height=500,scrollbars=1");
return false;
});
$(".itemqa_delete").click(function(){
@ -175,9 +181,9 @@ $(function(){
});
});
$(".pg_page").click(function(){
//alert($(this).attr("href"));
$(top.document).find('#itemqa').load($(this).attr("href"));
$(".qa_page").click(function(){
$("#itemqa").load($(this).attr("href"));
return false;
});
});
</script>

View File

@ -1,5 +1,11 @@
<?php
include_once('./_common.php');
if (G4_IS_MOBILE) {
include_once(G4_MSHOP_PATH.'/itemqaform.php');
return;
}
include_once(G4_EDITOR_LIB);
// 상품문의의 내용에 쓸수 있는 최대 글자수 (한글은 영문3자)

176
shop/itemqalist.php Normal file
View File

@ -0,0 +1,176 @@
<?php
include_once('./_common.php');
if (G4_IS_MOBILE) {
include_once(G4_MSHOP_PATH.'/itemqalist.php');
return;
}
include_once(G4_LIB_PATH.'/thumb.lib.php');
$sfl = escape_trim($_REQUEST['sfl']);
$stx = escape_trim($_REQUEST['stx']);
$g4['title'] = '상품문의';
include_once('./_head.php');
$sql_common = " from `{$g4['shop_item_qa_table']}` a join `{$g4['shop_item_table']}` b on (a.it_id=b.it_id) ";
$sql_search = " where (1) ";
if(!$sfl)
$sfl = 'b.it_name';
if ($stx) {
$sql_search .= " and ( ";
switch ($sfl) {
case "a.it_id" :
$sql_search .= " ($sfl like '$stx%') ";
break;
case "a.iq_name" :
case "a.mb_id" :
$sql_search .= " ($sfl = '$stx') ";
break;
default :
$sql_search .= " ($sfl like '%$stx%') ";
break;
}
$sql_search .= " ) ";
}
if (!$sst) {
$sst = "a.iq_id";
$sod = "desc";
}
$sql_order = " order by $sst $sod ";
$sql = " select count(*) as cnt
$sql_common
$sql_search
$sql_order ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
?>
<!-- 전체 상품 문의 목록 시작 { -->
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">전체보기</a>
<form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<select name="sfl" required title="검색항목선택">
<option value="">선택</option>
<option value="b.it_name" <?php echo get_selected($sfl, "b.it_name", true); ?>>상품명</option>
<option value="a.it_id" <?php echo get_selected($sfl, "a.it_id"); ?>>상품코드</option>
<option value="a.iq_subject" <?php echo get_selected($sfl, "a.is_subject"); ?>>문의제목</option>
<option value="a.iq_question"<?php echo get_selected($sfl, "a.iq_question"); ?>>문의내용</option>
<option value="a.iq_name" <?php echo get_selected($sfl, "a.it_id"); ?>>작성자명</option>
<option value="a.mb_id" <?php echo get_selected($sfl, "a.mb_id"); ?>>작성자아이디</option>
</select>
<input type="text" name="stx" required title="검색어" value="<?php echo $stx; ?>">
<input type="submit" value="검색">
</form>
<div id="sps">
<!-- <p><?php echo $config['cf_title']; ?> 전체 상품문의 목록입니다.</p> -->
<?php
$sql = " select a.*, b.it_name
$sql_common
$sql_search
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$num = $total_count - ($page - 1) * $rows - $i;
$star = get_star($row['is_score']);
$small_image = $row['it_id'];
$it_href = G4_SHOP_URL.'/item.php?it_id='.$row['it_id'];
$iq_question = get_view_thumbnail($row['iq_question'], 500);
if ($row['iq_answer'])
{
$iq_answer = get_view_thumbnail($row['iq_answer'], 500);
$iq_stats = '답변완료';
$iq_style = 'sit_qaa_done';
$is_answer = true;
} else {
$iq_stats = '답변전';
$iq_style = 'sit_qaa_yet';
$iq_answer = '답변이 등록되지 않았습니다.';
$is_answer = false;
}
if ($i == 0) echo '<ol>';
?>
<li>
<div class="sps_img">
<a href="<?php echo $it_href; ?>">
<?php echo get_it_image($small_image, 70, 70); ?>
<span><?php echo $row['it_name']; ?></span>
</a>
</div>
<section class="sps_section">
<h2><?php echo $row['iq_subject']; ?></h2>
<dl class="sps_dl">
<dt>작성자</dt>
<dd><?php echo $row['iq_name']; ?></dd>
<dt>작성일</dt>
<dd><?php echo substr($row['iq_time'],0,10); ?></dd>
<dt>상태</dt>
<dd class="<?php echo $iq_style; ?>"><?php echo $iq_stats; ?></dd>
</dl>
<div id="sqa_con_<?php echo $i; ?>" style="display:none;">
<div class="sit_qa_qaq">
<strong>문의내용</strong><br>
<?php echo $iq_question; // 상품 문의 내용 ?>
</div>
<div class="sit_qa_qaa">
<strong>답변</strong><br>
<?php echo $iq_answer; ?>
</div>
</div>
<div class="sqa_con_btn"><button class="sqa_con_<?php echo $i; ?>">보기</button></div>
</section>
</li>
<?php }
if ($i > 0) echo '</ol>';
if ($i == 0) echo '<p id="sps_empty">자료가 없습니다.</p>';
?>
</div>
<?php echo get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page="); ?>
<script>
$(function(){
// 사용후기 더보기
$(".sqa_con_btn button").click(function(){
var sqa_con_no = $(this).attr("class");
$("#"+sqa_con_no).is(":hidden") ? $("#"+sqa_con_no).show() : $("#"+sqa_con_no).hide();
});
$(".sqa_con_btn button").toggle(function(){
$(this).text("닫기");
}, function(){
$(this).text("보기");
});
});
</script>
<!-- } 전체 상품 사용후기 목록 끝 -->
<?php
include_once('./_tail.php');
?>

View File

@ -1,5 +1,11 @@
<?php
include_once('./_common.php');
if (G4_IS_MOBILE) {
include_once(G4_MSHOP_PATH.'/itemuse.php');
return;
}
include_once(G4_LIB_PATH.'/thumbnail.lib.php');
//$it_id = $_REQUEST['it_id'];
@ -96,7 +102,7 @@ function itemuse_page($write_pages, $cur_page, $total_page, $url, $add="")
$str = '';
if ($cur_page > 1) {
$str .= '<a href="'.$url.'1'.$add.'" class="pg_page pg_start" onclick="return false;">처음</a>'.PHP_EOL;
$str .= '<a href="'.$url.'1'.$add.'" class="pg_page pg_start">처음</a>'.PHP_EOL;
}
$start_page = ( ( (int)( ($cur_page - 1 ) / $write_pages ) ) * $write_pages ) + 1;
@ -104,12 +110,12 @@ function itemuse_page($write_pages, $cur_page, $total_page, $url, $add="")
if ($end_page >= $total_page) $end_page = $total_page;
if ($start_page > 1) $str .= '<a href="'.$url.($start_page-1).$add.'" class="pg_page pg_prev" onclick="return false;">이전</a>'.PHP_EOL;
if ($start_page > 1) $str .= '<a href="'.$url.($start_page-1).$add.'" class="pg_page pg_prev">이전</a>'.PHP_EOL;
if ($total_page > 1) {
for ($k=$start_page;$k<=$end_page;$k++) {
if ($cur_page != $k)
$str .= '<a href="'.$url.$k.$add.'" class="pg_page" onclick="return false;">'.$k.'</a><span class="sound_only">페이지</span>'.PHP_EOL;
$str .= '<a href="'.$url.$k.$add.'" class="pg_page">'.$k.'</a><span class="sound_only">페이지</span>'.PHP_EOL;
else
$str .= '<span class="sound_only">열린</span><strong class="pg_current">'.$k.'</strong><span class="sound_only">페이지</span>'.PHP_EOL;
}
@ -118,7 +124,7 @@ function itemuse_page($write_pages, $cur_page, $total_page, $url, $add="")
if ($total_page > $end_page) $str .= '<a href="'.$url.($end_page+1).$add.'" class="pg_page pg_next">다음</a>'.PHP_EOL;
if ($cur_page < $total_page) {
$str .= '<a href="'.$url.$total_page.$add.'" class="pg_page pg_end" onclick="return false;">맨끝</a>'.PHP_EOL;
$str .= '<a href="'.$url.$total_page.$add.'" class="pg_page pg_end">맨끝</a>'.PHP_EOL;
}
if ($str)
@ -131,7 +137,7 @@ echo itemuse_page($config['cf_write_pages'], $page, $total_page, "./itemuse.php?
?>
<div id="sit_use_wbtn">
<a href="<?php echo $itemuse_form; ?>" class="btn02 itemuse_form" onclick="return false;">사용후기 쓰기<span class="sound_only"> 새 창</span></a>
<a href="<?php echo $itemuse_form; ?>" class="btn02 itemuse_form">사용후기 쓰기<span class="sound_only"> 새 창</span></a>
<a href="<?php echo $itemuse_list; ?>" class="btn01 itemuse_list">더보기</a>
</div>
@ -162,8 +168,8 @@ $(function(){
});
$(".pg_page").click(function(){
//alert($(this).attr("href"));
$(top.document).find('#itemuse').load($(this).attr("href"));
$("#itemuse").load($(this).attr("href"));
return false;
});
});
</script>

View File

@ -17,6 +17,9 @@ include_once('./_head.php');
$sql_common = " from `{$g4['shop_item_use_table']}` a join `{$g4['shop_item_table']}` b on (a.it_id=b.it_id) ";
$sql_search = " where a.is_confirm = '1' ";
if(!$sfl)
$sfl = 'b.it_name';
if ($stx) {
$sql_search .= " and ( ";
switch ($sfl) {
@ -40,11 +43,6 @@ if (!$sst) {
}
$sql_order = " order by $sst $sod ";
/*
$sql_common = " from {$g4['shop_item_use_table']} where is_confirm = '1' ";
$sql_order = " order by is_id desc ";
*/
$sql = " select count(*) as cnt
$sql_common
$sql_search
@ -64,12 +62,12 @@ $from_record = ($page - 1) * $rows; // 시작 열을 구함
<form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<select name="sfl" required title="검색항목선택">
<option value="">선택</option>
<option value="b.it_name" <?php echo get_selected($_GET['sfl'], "b.it_name", true); ?>>상품명</option>
<option value="a.it_id" <?php echo get_selected($_GET['sfl'], "a.it_id"); ?>>상품코드</option>
<option value="a.is_subject"<?php echo get_selected($_GET['sfl'], "a.is_subject"); ?>>후기제목</option>
<option value="a.is_content">후기제목</option>
<option value="a.is_name">작성자명</option>
<option value="a.mb_id">작성자아이디</option>
<option value="b.it_name" <?php echo get_selected($sfl, "b.it_name"); ?>>상품명</option>
<option value="a.it_id" <?php echo get_selected($sfl, "a.it_id"); ?>>상품코드</option>
<option value="a.is_subject"<?php echo get_selected($sfl, "a.is_subject"); ?>>후기제목</option>
<option value="a.is_content"<?php echo get_selected($sfl, "a.is_content"); ?>>후기내용</option>
<option value="a.is_name" <?php echo get_selected($sfl, "a.is_name"); ?>>작성자명</option>
<option value="a.mb_id" <?php echo get_selected($sfl, "a.mb_id"); ?>>작성자아이디</option>
</select>
<input type="text" name="stx" required title="검색어" value="<?php echo $stx; ?>">
<input type="submit" value="검색">
@ -92,7 +90,6 @@ $from_record = ($page - 1) * $rows; // 시작 열을 구함
$star = get_star($row['is_score']);
$is_content = get_view_thumbnail($row['is_content'], 500);
$is_time = substr($row['is_time'], 2, 14);
$small_image = $row['it_id'];
$row2 = sql_fetch(" select it_name from {$g4['shop_item_table']} where it_id = '{$row['it_id']}' ");