상품보기 유형 변경 코드를 파일에 분리해서 저장

This commit is contained in:
chicpro
2013-08-08 14:25:58 +09:00
parent 21e5ac6108
commit 0da7ccb589
7 changed files with 71 additions and 62 deletions

View File

@ -97,20 +97,20 @@ if ($is_admin)
}
?>
<?php
$qstr1 .= 'ca_id='.$ca_id;
if($skin)
$qstr1 .= '&amp;skin='.$skin;
$qstr1 .='&amp;sort='.$sort.'&amp;sortodr='.$sortodr;
echo get_paging($config['cf_mobile_pages'], $page, $total_page, $_SERVER['PHP_SELF'].'?'.$qstr1.'&amp;page=');
?>
<?php
// 하단 HTML
echo '<div id="sct_thtml">'.stripslashes($ca['ca_mobile_tail_html']).'</div>';
?>
</div>
<?php
$qstr1 .= 'ca_id='.$ca_id;
if($skin)
$qstr1 .= '&amp;skin='.$skin;
$qstr1 .='&amp;sort='.$sort.'&amp;sortodr='.$sortodr;
echo get_paging($config['cf_mobile_pages'], $page, $total_page, $_SERVER['PHP_SELF'].'?'.$qstr1.'&amp;page=');
?>
<?php
include_once(G4_MSHOP_PATH.'/_tail.php');

View File

@ -39,6 +39,9 @@ if (file_exists($list_file))
{
include G4_SHOP_PATH.'/list.sort.php';
// 상품 보기 타입 변경 버튼
include G4_SHOP_PATH.'/list.sub.php';
// 총몇개 = 한줄에 몇개 * 몇줄
$items = $ev['ev_list_mod'] * $ev['ev_list_row'];
// 페이지가 없으면 첫 페이지 (1 페이지)
@ -72,6 +75,9 @@ if ($i==0)
?>
<?php
// 상품 보기 타입 변경 처리 스크립트
include G4_SHOP_PATH.'/list.sub2.php';
$qstr .= 'skin='.$skin.'&amp;ev_id='.$ev_id.'&amp;sort='.$sort.'&amp;sortodr='.$sortodr;
echo get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page=");
?>

View File

@ -75,6 +75,9 @@ if ($is_admin)
if (file_exists($list_file)) {
include G4_SHOP_PATH.'/list.sort.php';
// 상품 보기 타입 변경 버튼
include G4_SHOP_PATH.'/list.sub.php';
// 총몇개 = 한줄에 몇개 * 몇줄
$items = $ca['ca_list_mod'] * $ca['ca_list_row'];
// 페이지가 없으면 첫 페이지 (1 페이지)
@ -115,18 +118,16 @@ if ($is_admin)
}
?>
<script>
// 리스트 타입 쿠키가 있을 경우 바로 적용
if(itemlist_type = get_cookie("ck_itemlist_type")) {
if(itemlist_type == "gallery") {
$("ul.sct").removeClass("sct_13");
set_cookie("ck_itemlist_type", "gallery", 1, g4_cookie_domain);
} else {
$("ul.sct").addClass("sct_13");
set_cookie("ck_itemlist_type", "list", 1, g4_cookie_domain);
}
}
</script>
<?php
// 상품 보기 타입 변경 처리 스크립트
include G4_SHOP_PATH.'/list.sub2.php';
$qstr1 .= 'ca_id='.$ca_id;
if($skin)
$qstr1 .= '&amp;skin='.$skin;
$qstr1 .='&amp;sort='.$sort.'&amp;sortodr='.$sortodr;
echo get_paging($config['cf_write_pages'], $page, $total_page, $_SERVER['PHP_SELF'].'?'.$qstr1.'&amp;page=');
?>
<?php
// 하단 HTML
@ -138,14 +139,6 @@ if ($is_admin)
echo '<div id="sct_timg" class="sct_img"><img src="'.G4_DATA_URL.'/category/'.$ca_id.'_t" alt="">';
?>
</div>
<?php
$qstr1 .= 'ca_id='.$ca_id;
if($skin)
$qstr1 .= '&amp;skin='.$skin;
$qstr1 .='&amp;sort='.$sort.'&amp;sortodr='.$sortodr;
echo get_paging($config['cf_write_pages'], $page, $total_page, $_SERVER['PHP_SELF'].'?'.$qstr1.'&amp;page=');
?>
<!-- } 상품 목록 끝 -->
<?php

View File

@ -1,10 +1,14 @@
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$sct_sort_href = $_SERVER['PHP_SELF'].'?ca_id='.$ca_id;
$sct_sort_href = $_SERVER['PHP_SELF'].'?';
if($ca_id)
$sct_sort_href .= 'ca_id='.$ca_id;
else if($ev_id)
$sct_sort_href .= 'ev_id='.$ev_id;
if($skin)
$sct_sort_href .= '&amp;skin='.$skin;
$sct_sort_href .= '&amp;ev_id='.$ev_id.'&amp;sort=';
$sct_sort_href .= '&amp;sort=';
?>
<!-- 상품 정렬 선택 시작 { -->
@ -21,21 +25,5 @@ $sct_sort_href .= '&amp;ev_id='.$ev_id.'&amp;sort=';
<li><a href="<?php echo $sct_sort_href; ?>it_type4&amp;sortodr=desc" class="btn01">인기상품</a></li>
<li><a href="<?php echo $sct_sort_href; ?>it_type5&amp;sortodr=desc" class="btn01">할인상품</a></li>
</ul>
<button type="button" class="sct_lst_view sct_lst_list">리스트뷰</button>
<button type="button" class="sct_lst_view sct_lst_gallery">갤러리뷰</button>
</section>
<script>
$(function() {
$("button.sct_lst_view").on("click", function() {
if($(this).hasClass("sct_lst_gallery")) {
$("ul.sct").removeClass("sct_13");
set_cookie("ck_itemlist_type", "gallery", 1, g4_cookie_domain);
} else {
$("ul.sct").addClass("sct_13");
set_cookie("ck_itemlist_type", "list", 1, g4_cookie_domain);
}
});
});
</script>
<!-- } 상품 정렬 선택 끝 -->

View File

@ -1,19 +1,6 @@
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// 총몇개 = 한줄에 몇개 * 몇줄
$items = $list_mod * $list_row;
// <TD> 태그 폭
$td_width = (int)(100 / $list_mod);
$sql = "select COUNT(*) as cnt $sql_common ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
// 전체 페이지 계산
$total_page = ceil($total_count / $items);
// 페이지가 없으면 첫 페이지 (1 페이지)
if ($page == "") $page = 1;
// 시작 레코드 구함
$from_record = ($page - 1) * $items;
?>
<button type="button" class="sct_lst_view sct_lst_list">리스트뷰</button>
<button type="button" class="sct_lst_view sct_lst_gallery">갤러리뷰</button>

28
shop/list.sub2.php Normal file
View File

@ -0,0 +1,28 @@
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<script>
// 리스트 타입 쿠키가 있을 경우 바로 적용
if(itemlist_type = get_cookie("ck_itemlist_type")) {
if(itemlist_type == "gallery") {
$("ul.sct").removeClass("sct_13");
set_cookie("ck_itemlist_type", "gallery", 1, g4_cookie_domain);
} else {
$("ul.sct").addClass("sct_13");
set_cookie("ck_itemlist_type", "list", 1, g4_cookie_domain);
}
}
$(function() {
$("button.sct_lst_view").on("click", function() {
if($(this).hasClass("sct_lst_gallery")) {
$("ul.sct").removeClass("sct_13");
set_cookie("ck_itemlist_type", "gallery", 1, g4_cookie_domain);
} else {
$("ul.sct").addClass("sct_13");
set_cookie("ck_itemlist_type", "list", 1, g4_cookie_domain);
}
});
});
</script>

View File

@ -55,6 +55,13 @@ if (file_exists($list_file)) {
$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', false);
$list->set_view('it_name', 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 된 전체 상품수