Files
dnssash/theme/rd.laser/shop/test_shop.php
T
2026-06-11 18:47:38 +09:00

96 lines
4.2 KiB
PHP

<?php
include_once('./_common.php');
$g5['title'] = "쇼핑몰 기능 테스트";
include_once(G5_THEME_SHOP_PATH.'/shop.head.php');
// 1. 테스트용 상품 가져오기 (판매 가능한 상품 중 첫 번째)
$sql = " select * from {$g5['g5_shop_item_table']} where it_use = '1' order by it_id desc limit 1 ";
$it = sql_fetch($sql);
if (!$it['it_id']) {
echo '<div class="test-alert">등록된 판매 가능 상품이 없습니다.<br>관리자 페이지 > 쇼핑몰관리 > 상품관리에서 상품을 먼저 등록해주세요.</div>';
} else {
?>
<div id="test_shop_wrap">
<h2>쇼핑몰 기능 테스트</h2>
<div class="test-item-box">
<div class="item-image">
<?php echo get_it_image($it['it_id'], 300, 300, '', '', $it['it_name']); ?>
</div>
<div class="item-info">
<h3><?php echo stripslashes($it['it_name']); ?></h3>
<p class="item-price">가격: <strong><?php echo display_price(get_price($it), $it['it_tel_inq']); ?></strong></p>
<p class="item-desc"><?php echo cut_str(strip_tags($it['it_basic']), 100); ?></p>
<div class="item-actions">
<!-- 폼 전송 방식 (표준) -->
<form name="fitem_test" method="post" action="./cart_update.php" onsubmit="return fitem_test_submit(this);">
<input type="hidden" name="it_id[]" value="<?php echo $it['it_id']; ?>">
<input type="hidden" name="sw_direct" value="">
<input type="hidden" name="ca_id" value="<?php echo $it['ca_id']; ?>">
<div class="opt-qty">
<label>수량:</label>
<input type="text" name="ct_qty[<?php echo $it['it_id']; ?>]" value="1" size="3">
</div>
<div class="btn-group">
<button type="submit" onclick="document.pressed=this.value;" value="장바구니" class="btn-cart">장바구니 담기</button>
<button type="submit" onclick="document.pressed=this.value;" value="바로구매" class="btn-buy">결제정보확인 (바로구매)</button>
</div>
</form>
</div>
</div>
</div>
<div class="test-guide">
<h3>테스트 안내</h3>
<ul>
<li><strong>장바구니 담기:</strong> 상품을 장바구니에 담고 장바구니 페이지로 이동합니다.</li>
<li><strong>결제정보확인:</strong> 장바구니를 거치지 않고 바로 주문서 작성 페이지로 이동합니다.</li>
<li><strong>비회원 구매:</strong> 로그아웃 상태에서 테스트하면 비회원 주문이 가능합니다.</li>
</ul>
</div>
</div>
<script>
function fitem_test_submit(f) {
if (document.pressed == "장바구니") {
f.sw_direct.value = 0;
} else { // 바로구매
f.sw_direct.value = 1;
}
return true;
}
</script>
<style>
#test_shop_wrap { max-width: 800px; margin: 50px auto; padding: 20px; border: 1px solid #ddd; background: #fff; }
.test-alert { padding: 20px; background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; text-align: center; }
.test-item-box { display: flex; gap: 30px; margin-bottom: 30px; border-bottom: 1px solid #eee; padding-bottom: 30px; }
.item-image img { max-width: 100%; border: 1px solid #eee; }
.item-info h3 { margin: 0 0 10px; font-size: 24px; }
.item-price { font-size: 18px; color: #e02020; margin-bottom: 10px; }
.item-desc { color: #666; margin-bottom: 20px; }
.opt-qty { margin-bottom: 15px; }
.opt-qty input { padding: 5px; border: 1px solid #ddd; text-align: center; }
.btn-group button { padding: 10px 20px; border: none; cursor: pointer; font-weight: bold; border-radius: 4px; }
.btn-cart { background: #555; color: #fff; }
.btn-buy { background: #ff3061; color: #fff; }
.test-guide { background: #f9f9f9; padding: 20px; border-radius: 4px; }
.test-guide h3 { margin-top: 0; }
.test-guide ul { padding-left: 20px; margin-bottom: 0; }
.test-guide li { margin-bottom: 5px; }
</style>
<?php } ?>
<?php
include_once(G5_THEME_SHOP_PATH.'/shop.tail.php');
?>