상품 진열 순서 바꾸기
본문
<div style="float:left;">
<div style="float:left;"><?php include_once(G5_SHOP_SKIN_PATH.'/boxcategory.skin.php'); // 상품분류 ?></div>
<div id="hd_sch" style="float:left;">
<h3>쇼핑몰 검색</h3>
<form name="frmsearch1" onsubmit="return search_submit(this);">
<input type="hidden" name="ca_id" value="<?=$_GET[ca_id]?>">
<label for="sch_str" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input
type="text" name="q" value="<?php echo
stripslashes(get_text(get_search_string($_GET[q]))); ?>" id="sch_str"
required>
<input type="submit" value="검색" id="sch_submit">
</form>
<script>
function search_submit(f) {
if (f.q.value.length < 2) {
alert("검색어는 두글자 이상 입력하십시오.");
f.q.select();
f.q.focus();
return false;
}
return true;
}
</script>
</div>
</div>
<form name='forder_multi' id='forder_multi' method="post" action="<?php echo $cart_action_url; ?>">
<input type="hidden" name="sw_direct">
<input type="hidden" name="act">
<div class="tbl_head04 tbl_wrap">
<table width=100% cellpadding=0 cellspacing=0 border=0>
<colgroup width=30>
<colgroup width=125>
<colgroup width=101>
<colgroup width=60>
<colgroup width=50>
<colgroup width=85>
<colgroup width=48>
<colgroup width=62>
<colgroup width=60>
<colgroup width=35>
<colgroup width=68>
<tr>
<th scope="col"><input type="checkbox" name="it_chkall"
value="1" id="it_chkall" onclick="check_all(this.form)"></th>
<th scope="col">약재명</th>
<th scope="col">특성</th>
<th scope="col">원산지</th>
<th scope="col">중량</th>
<th scope="col">가격</th>
<th scope="col">변동예정</th>
<th scope="col">적립금</th>
<th scope="col">재고</th>
<th scope="col">수량</th>
<th scope="col"></th>
</tr>
</table>
</div>
<div class="tbl_head03 tbl_wrap">
<table width=100% cellpadding=0 cellspacing=0 border=1>
<colgroup width=30>
<colgroup width=125>
<colgroup width=101>
<colgroup width=60>
<colgroup width=50>
<colgroup width=90>
<colgroup width=50>
<colgroup width=60>
<colgroup width=60>
<colgroup width=35>
<colgroup width=50>
<?php
for ($i=0; $row=sql_fetch_array($result); $i++) {
//print_r2($row);
if ($this->list_mod >= 2) { // 1줄 이미지 : 2개 이상
if ($i%$this->list_mod == 0) $sct_last = ' sct_last'; // 줄 마지막
else if ($i%$this->list_mod == 1) $sct_last = ' sct_clear'; // 줄 첫번째
else $sct_last = '';
} else { // 1줄 이미지 : 1개
$sct_last = ' sct_clear';
}
$bg = 'bg'.($i%2);
$it_id = $row['it_id'];
$it_name = stripslashes($row['it_name']);
$it_model = $row['it_model'];
$it_brand = $row['it_brand'];
$it_origin = $row['it_origin'];
$it_stock_qty = $row['it_stock_qty'];
$it_cust_price = $row['it_cust_price'];
$it_chgsc = $row['it_chgsc'];
$it_point = $row['it_point'];
$it_price = get_price($row);
$ct_qty = "<input type='text' name='ct_qty[{$row['it_id']}][]'
value='1' id='ct_qty_{$i}' class='frm_input'
style='text-align:center;'size='3' onfocus='this.select();'>";
// 변동예정
$chgsc = "";
if( $it_chgsc == "증가")
$chgsc = "<font color=red>▲</font>";
else if( $it_chgsc == "감소")
$chgsc = "<font color=blue>▼</font>";
?>
<input type="hidden" name="it_id[]" value="<?=$it_id?>">
<input type='hidden' name="io_type[<?=$it_id?>]" value='0'>
<input type='hidden' name="io_id[<?=$it_id?>]" value=''>
<input type='hidden' name="it_point[<?=$it_id?>]" value='<?=$it_point?>'>
<tr class="<?php echo $bg; ?>">
<td align="center"><input type="checkbox"
name="chk_it_id[<?php echo $i ?>]" value="1" id="it_chk_<?php
echo $i ?>"></td>
<td align="center"><a
href="/shop/largeimage.php?it_id=<?=$it_id?>"
onclick="window.open(this.href, 'l', 'width=500, height=700, top=0,
left=0, scrollbars=no'); return false;"
onkeypress=""><?=$it_name?></a></td>
<td align="center"><?=$it_brand?></td>
<td align="center"><?=$it_origin?></td>
<td align="center"><?=$it_model?></td>
<td align="center"><?=number_format($it_price)?></td>
<td align="center"><?=$chgsc?></td>
<td align="center"><?=number_format($it_point)?></td>
<td align="center"><?=number_format($it_stock_qty)?></td>
<td align="center"><?=$ct_qty?></td>
<td align="center"><a
href='javascript:fn_list_cart(<?=$row['it_id']?>);' ><img
src="<?=G5_SHOP_SKIN_URL?>/img/cart.jpg"></a></td>
</tr>
<?
}
if ($i > 1) echo "</ul>\n";
//if($i == 1) echo "<p class=\"sct_noitem\">등록된 상품이 없습니다.</p>\n";
?>
</table>
</form>
</div>
<center>
<a href="#" onclick="return fn_check('direct');" class="btn_b02">바로구매</a>
<a href="#" onclick="return fn_check('multi');" class="btn_b01">장바구니</a>
</center>
<form name='forder_list' method="post">
<input type="hidden" name="it_id[]">
<input type="hidden" name="sw_direct">
<input type="hidden" name="url">
<div id='forder_list'></div>
</form>
<script>
// 바로주문
function fn_list_order(it_id)
{
var f = document.forder_list;
var qty = $("input[name^='ct_qty[" +it_id + "][]']").val(); // 상품의수량
f.target = "_self";
f.sw_direct.value = 1;
f.elements["it_id[]"].value = it_id;
$("#forder_list").append("<input type='hidden' name='io_type[" + it_id + "][]' value='0'>");
$("#forder_list").append("<input type='hidden' name='io_id[" + it_id + "][]' value=''>");
$("#forder_list").append("<input type='hidden' name='ct_qty[" + it_id + "][]' value='" + qty + "'>"); // 해당상품의 수량추가
f.action = "<?php echo G5_SHOP_URL; ?>/cartupdate2.php";
f.submit();
}
// 장바구니
function fn_list_cart(it_id)
{
var f = document.forder_list;
var qty = $("input[name^='ct_qty[" +it_id + "][]']").val(); // 상품의수량
f.target = "hiddenframe";
f.sw_direct.value = 0;
f.elements["it_id[]"].value = it_id;
$("#forder_list").append("<input type='hidden' name='io_type[" + it_id + "][]' value='0'>");
$("#forder_list").append("<input type='hidden' name='io_id[" + it_id + "][]' value=''>");
$("#forder_list").append("<input type='hidden' name='ct_qty[" + it_id + "][]' value='" + qty + "'>"); // 해당상품의 수량추가
f.action = "<?php echo G5_SHOP_URL; ?>/cartupdate2.php";
f.submit();
$("#forder_list *").remove();
alert("장바구니에 보관 되었습니다.");
fn_view_cart('view');
}
// 위시리스트
function fn_list_wish(it_id)
{
var f = document.forder_list;
f.target="_self"
f.elements["it_id[]"].value = it_id;
f.ca_id.value = itemlist_ca_id;
f.url.value = "<?php echo G5_SHOP_URL; ?>/wishupdate.php?it_id="+it_id;
f.target = "hiddenframe";
f.action = "<?php echo G5_SHOP_URL; ?>/wishupdate.php";
f.submit();
alert("위시리스트에 보관 되었습니다.");
}
// 초기 화면이 겔러리 일경우에만 설정 내용을 감춰준다.
//if(type == "gallery" || type == "")
//{
// $(".sct_id").hide();
// $(".sct_brand").hide();
// $(".sct_stock_qty").hide();
// $(".sct_qty").hide();
// $(".sct_btn").hide();
// $(".sct_arrow").hide();
//}
$(".sct_id").hide();
$(".sct_brand").hide();
$(".sct_stock_qty").hide();
$(".sct_qty").hide();
$(".sct_btn").hide();
$(".sct_arrow").hide();
$(".sct_basic").hide();
// 수량변경
$("#sit_sel_option li button").live("click", function() {
var mode = $(this).text();
var this_qty, max_qty = 9999, min_qty = 1;
var $el_qty = $(this).closest("li").find("input[name^=ct_qty]");
var stock = parseInt($(this).closest("li").find("input.io_stock").val());
switch(mode) {
case "▲":
this_qty = parseInt($el_qty.val().replace(/[^0-9]/, "")) + 1;
if(this_qty > stock) {
alert("재고수량 보다 많은 수량을 구매할 수 없습니다.");
this_qty = stock;
}
if(this_qty > max_qty) {
this_qty = max_qty;
alert("최대 구매수량은 "+number_format(String(max_qty))+" 입니다.");
}
$el_qty.val(this_qty);
//price_calculate();
break;
case "▼":
this_qty = parseInt($el_qty.val().replace(/[^0-9]/, "")) - 1;
if(this_qty < min_qty) {
this_qty = min_qty;
alert("최소 구매수량은 "+number_format(String(min_qty))+" 입니다.");
}
$el_qty.val(this_qty);
//price_calculate();
break;
default:
alert("올바른 방법으로 이용해 주십시오.");
break;
}
});
function check_all(f)
{
//var ct_chk = document.getElementsByName("chk_it_id[]");
var chk_it_id = $("input[name^=chk_it_id]");
var total_price = 0;
for (i=0; i<chk_it_id.length; i++)
{
f.elements["chk_it_id["+i+"]"].checked = f.it_chkall.checked;
}
}
function fn_check(act) {
var f = document.forder_multi;
//var cnt = f.records.value;
if (act == "direct")
{
if($("input[name^=chk_it_id]:checked").size() < 1) {
alert("상품을 하나이상 선택해 주십시오.");
return false;
}
f.sw_direct.value = 1;
f.act.value = "multi";
f.action = "<?php echo G5_SHOP_URL; ?>/cartupdate2.php";
f.submit();
}
else if (act == "multi")
{
if($("input[name^=chk_it_id]:checked").size() < 1) {
alert("상품을 하나이상 선택해 주십시오.");
return false;
}
f.sw_direct.value = 0;
f.act.value = act;
f.target = "hiddenframe";
f.action = "<?php echo G5_SHOP_URL; ?>/cartupdate2.php";
f.submit();
alert("장바구니에 보관 되었습니다.");
}
fn_view_cart('view');
return true;
}
</script>
<!-- 새창 대신 사용하는 iframe -->
<iframe width=0 height=0 name='hiddenframe' style='display:none;'></iframe>
<!-- <iframe width=1000 height=200 name='hiddenframe' frameborder=1></iframe> -->
<!-- } 상품진열 20 끝 -->
여기서 어떻게 해야 진열순서를 바꿀 수 있나요? 지금은 가나다 역순인거 같아요
!-->
답변을 작성하시기 전에 로그인 해주세요.