네이버페이 적용

This commit is contained in:
chicpro
2016-07-25 10:35:42 +09:00
parent 1935e0d328
commit 6703c0862a
23 changed files with 1278 additions and 4 deletions

View File

@ -117,6 +117,17 @@ if(!isset($default['de_inicis_sign_key'])) {
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
ADD `de_inicis_sign_key` varchar(255) NOT NULL DEFAULT '' AFTER `de_inicis_admin_key` ", true);
}
// 네이버페이 필드추가
if(!isset($default['de_naverpay_mid'])) {
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
ADD `de_naverpay_mid` varchar(255) NOT NULL DEFAULT '' AFTER `de_kakaopay_cancelpwd`,
ADD `de_naverpay_cert_key` varchar(255) NOT NULL DEFAULT '' AFTER `de_naverpay_mid`,
ADD `de_naverpay_button_key` varchar(255) NOT NULL DEFAULT '' AFTER `de_naverpay_cert_key`,
ADD `de_naverpay_test` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_naverpay_button_key`,
ADD `de_naverpay_mb_id` varchar(255) NOT NULL DEFAULT '' AFTER `de_naverpay_test`,
ADD `de_naverpay_sendcost` varchar(255) NOT NULL DEFAULT '' AFTER `de_naverpay_mb_id`", true);
}
?>
<form name="fconfig" action="./configformupdate.php" onsubmit="return fconfig_check(this)" method="post" enctype="MULTIPART/FORM-DATA">
@ -708,7 +719,7 @@ if(!isset($default['de_inicis_sign_key'])) {
<tr>
<th scope="row">
<label for="de_kakaopay_mid">카카오페이 상점MID</label>
<a href="http://sir.kr/main/service/kakaopay.php" target="_blank" id="scf_lgreg" class="scf_pgreg">카카오페이 서비스신청하기</a>
<a href="http://sir.kr/main/service/kakaopay.php" target="_blank" class="scf_pgreg">카카오페이 서비스신청하기</a>
</th>
<td>
<?php echo help("카카오페이로 부터 발급 받으신 상점아이디(MID) 10자리 중 첫 KHSIR과 끝 m 을 제외한 영문4자리를 입력 합니다. 예) KHSIRtestm"); ?>
@ -743,6 +754,69 @@ if(!isset($default['de_inicis_sign_key'])) {
<input type="text" name="de_kakaopay_cancelpwd" value="<?php echo $default['de_kakaopay_cancelpwd']; ?>" id="de_kakaopay_cancelpwd" class="frm_input" size="20">
</td>
</tr>
<tr>
<th scope="row">
<label for="de_naverpay_mid">네이버페이 가맹점 아이디</label>
<a href="http://sir.kr/main/service/naverpay.php" target="_blank" class="scf_pgreg">네이버페이 서비스신청하기</a>
</th>
<td>
<?php echo help("네이버페이 가맹점 아이디를 입력합니다."); ?>
<input type="text" name="de_naverpay_mid" value="<?php echo $default['de_naverpay_mid']; ?>" id="de_naverpay_mid" class="frm_input" size="20" maxlength="50">
</td>
</tr>
<tr>
<th scope="row">
<label for="de_naverpay_cert_key">네이버페이 가맹점 인증키</label>
</th>
<td>
<?php echo help("네이버페이 가맹점 인증키를 입력합니다."); ?>
<input type="text" name="de_naverpay_cert_key" value="<?php echo $default['de_naverpay_cert_key']; ?>" id="de_naverpay_cert_key" class="frm_input" size="50" maxlength="100">
</td>
</tr>
<tr>
<th scope="row">
<label for="de_naverpay_button_key">네이버페이 버튼 인증키</label>
</th>
<td>
<?php echo help("네이버페이 버튼 인증키를 입력합니다."); ?>
<input type="text" name="de_naverpay_button_key" value="<?php echo $default['de_naverpay_button_key']; ?>" id="de_naverpay_button_key" class="frm_input" size="50" maxlength="100">
</td>
</tr>
<tr>
<th scope="row"><label for="de_naverpay_test">네이버페이 결제테스트</label></th>
<td>
<?php echo help("네이버페이 결제테스트 여부를 설정합니다. 검수 과정 중에는 <strong>예</strong>로 설정해야 하며 최종 승인 후 <strong>아니오</strong>로 설정합니다."); ?>
<select id="de_naverpay_test" name="de_naverpay_test">
<option value="1" <?php echo get_selected($default['de_naverpay_test'], 1); ?>>예</option>
<option value="0" <?php echo get_selected($default['de_naverpay_test'], 0); ?>>아니오</option>
</select>
</td>
</tr>
<tr>
<th scope="row">
<label for="de_naverpay_mb_id">네이버페이 결제테스트 아이디</label>
</th>
<td>
<?php echo help("네이버페이 결제테스트를 위한 테스트 회원 아이디를 입력합니다. 네이버페이 검수 과정에서 필요합니다."); ?>
<input type="text" name="de_naverpay_mb_id" value="<?php echo $default['de_naverpay_mb_id']; ?>" id="de_naverpay_mb_id" class="frm_input" size="20" maxlength="20">
</td>
</tr>
<tr>
<th scope="row">네이버페이 상품정보 XML URL</th>
<td>
<?php echo help("네이버페이에 상품정보를 XML 데이터로 제공하는 페이지입니다. 검수과정에서 아래의 URL 정보를 제공해야 합니다."); ?>
<?php echo G5_SHOP_URL; ?>/naverpay/naverpay_item.php
</td>
</tr>
<tr>
<th scope="row">
<label for="de_naverpay_sendcost">네이버페이 추가배송비 안내</label>
</th>
<td>
<?php echo help("네이버페이를 통한 결제 때 구매자에게 보여질 추가배송비 내용을 입력합니다.<br>예) 제주도 3,000원 추가, 제주도 외 도서·산간 지역 5,000원 추가"); ?>
<input type="text" name="de_naverpay_sendcost" value="<?php echo $default['de_naverpay_sendcost']; ?>" id="de_naverpay_sendcost" class="frm_input" size="70">
</td>
</tr>
<tr>
<th scope="row">에스크로 사용</th>
<td>

View File

@ -188,6 +188,12 @@ $sql = " update {$g5['g5_shop_default_table']}
de_kakaopay_enckey = '{$_POST['de_kakaopay_enckey']}',
de_kakaopay_hashkey = '{$_POST['de_kakaopay_hashkey']}',
de_kakaopay_cancelpwd = '{$_POST['de_kakaopay_cancelpwd']}',
de_naverpay_mid = '{$_POST['de_naverpay_mid']}',
de_naverpay_cert_key = '{$_POST['de_naverpay_cert_key']}',
de_naverpay_button_key = '{$_POST['de_naverpay_button_key']}',
de_naverpay_test = '{$_POST['de_naverpay_test']}',
de_naverpay_mb_id = '{$_POST['de_naverpay_mb_id']}',
de_naverpay_sendcost = '{$_POST['de_naverpay_sendcost']}',
de_member_reg_coupon_use = '{$_POST['de_member_reg_coupon_use']}',
de_member_reg_coupon_term = '{$_POST['de_member_reg_coupon_term']}',
de_member_reg_coupon_price = '{$_POST['de_member_reg_coupon_price']}',

View File

@ -109,6 +109,13 @@ if(!sql_query(" select it_shop_memo from {$g5['g5_shop_item_table']} limit 1 ",
ADD `it_shop_memo` text NOT NULL AFTER `it_use_avg` ", true);
}
// 지식쇼핑 PID 필드추가
// 상품메모 필드 추가
if(!sql_query(" select ec_mall_pid from {$g5['g5_shop_item_table']} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
ADD `ec_mall_pid` varchar(255) NOT NULL AFTER `it_shop_memo` ", true);
}
$pg_anchor ='<ul class="anchor">
<li><a href="#anc_sitfrm_cate">상품분류</a></li>
<li><a href="#anc_sitfrm_skin">스킨설정</a></li>
@ -435,6 +442,13 @@ if(!sql_query(" select it_skin from {$g5['g5_shop_item_table']} limit 1", false)
<label for="chk_all_it_nocoupon">전체적용</label>
</td>
</tr>
<tr>
<th scope="row"><label for="ec_mall_pid">네이버쇼핑 상품ID</label></th>
<td colspan="2">
<?php echo help("네이버쇼핑에 입점한 경우 네이버쇼핑 상품ID를 입력하시면 네이버페이와 연동됩니다."); ?>
<input type="text" name="ec_mall_pid" value="<?php echo get_text($it['ec_mall_pid']); ?>" id="ec_mall_pid" class="frm_input" size="20">
</td>
</tr>
<tr>
<th scope="row">상품설명</th>
<td colspan="2"> <?php echo editor_html('it_explan', get_text($it['it_explan'], 0)); ?></td>

View File

@ -316,6 +316,7 @@ $sql_common = " ca_id = '$ca_id',
it_info_gubun = '$it_info_gubun',
it_info_value = '$it_info_value',
it_shop_memo = '$it_shop_memo',
ec_mall_pid = '$ec_mall_pid',
it_img1 = '$it_img1',
it_img2 = '$it_img2',
it_img3 = '$it_img3',

View File

@ -578,3 +578,7 @@ html.no-overflowscrolling #sc_coupon_frm, html.no-overflowscrolling #od_coupon_f
#sod_frm_paysel ul {margin:0;padding:0;}
#sod_frm_paysel ul:after {display:block;visibility:hidden;clear:both;content:""}
#sod_frm_paysel li {float:left;padding:5px 2%;width:46%;height:21px;text-align:left;list-style:none}
/*네이버페이*/
.itemform-naverpay{margin-top:15px}
.cart-naverpay{margin-top:15px}

View File

@ -726,3 +726,7 @@ a.btn_admin:focus, a.btn_admin:hover {text-decoration:none}
#sod_frm_pay{padding:10px 0}
#sod_frm_pay h2{padding:10px 0 10px}
#display_pay_button .btn_submit{padding:8px 5px}
/*네이버페이*/
.naverpay-item{padding-top:15px;clear:both}
#sod_bsk_act .naverpay-cart{margin-top:15px;clear:both;position:static}

View File

@ -331,6 +331,12 @@ CREATE TABLE IF NOT EXISTS `g5_shop_default` (
`de_kakaopay_enckey` varchar(255) NOT NULL DEFAULT '',
`de_kakaopay_hashkey` varchar(255) NOT NULL DEFAULT '',
`de_kakaopay_cancelpwd` varchar(255) NOT NULL DEFAULT '',
`de_naverpay_mid` varchar(255) NOT NULL DEFAULT '',
`de_naverpay_cert_key` varchar(255) NOT NULL DEFAULT '',
`de_naverpay_button_key` varchar(255) NOT NULL DEFAULT '',
`de_naverpay_test` tinyint(4) NOT NULL DEFAULT '0',
`de_naverpay_mb_id` varchar(255) NOT NULL DEFAULT '',
`de_naverpay_sendcost` varchar(255) NOT NULL DEFAULT '',
`de_member_reg_coupon_use` tinyint(4) NOT NULL DEFAULT '0',
`de_member_reg_coupon_term` int(11) NOT NULL DEFAULT '0',
`de_member_reg_coupon_price` int(11) NOT NULL DEFAULT '0',
@ -444,6 +450,7 @@ CREATE TABLE IF NOT EXISTS `g5_shop_item` (
`it_use_cnt` int(11) NOT NULL DEFAULT '0',
`it_use_avg` DECIMAL(2,1) NOT NULL,
`it_shop_memo` text NOT NULL,
`ec_mall_pid` varchar(255) NOT NULL DEFAULT '',
`it_img1` varchar(255) NOT NULL DEFAULT '',
`it_img2` varchar(255) NOT NULL DEFAULT '',
`it_img3` varchar(255) NOT NULL DEFAULT '',

299
lib/naverpay.lib.php Normal file
View File

@ -0,0 +1,299 @@
<?php
if (!defined('_GNUBOARD_')) exit;
class naverpay_register
{
public $options;
public $keys;
public $send_cost;
public $total_price;
function __construct($options, $send_cost)
{
$this->options = $options;
$this->send_cost = $send_cost;
}
function get_sendcost()
{
global $g5;
$options = $this->options;
$send_cost = $this->send_cost;
$keys = $this->keys;
$data = array();
if($send_cost == 1)
return array('type' => 'ONDELIVERY', 'cost' => 0);
$cost = 0;
$cnt = 0;
foreach($keys as $it_id) {
$it = sql_fetch(" select * from {$g5['g5_shop_item_table']} where it_id = '$it_id' ");
if(!$it['it_id'])
continue;
if($it['it_sc_method'] == 1) { // 착불
$cnt++;
continue;
}
$qty = 0;
$price = 0;
$opts = $options[$it_id];
$uprice = get_price($it);
foreach($opts as $opt) {
if($opt['type'])
$price += ((int)$opt['price'] * (int)$opt['qty']);
else
$price += (((int)$uprice + (int)$opt['price']) * (int)$opt['qty']);
$qty += $opt['qty'];
}
if($it['it_sc_type'] > 1) {
if($it['it_sc_type'] == 2) { // 조건부무료
if($price >= $it['it_sc_minimum'])
$cost += 0;
else
$cost += $it['it_sc_price'];
} else if($it['it_sc_type'] == 3) { // 유료배송
$cost += $it['it_sc_price'];
} else { // 수량별 부과
if(!$it['it_sc_qty'])
$it['it_sc_qty'] = 1;
$q = ceil((int)$qty / (int)$it['it_sc_qty']);
$cost += (int)$it['it_sc_price'] * $q;
}
} else if($it['it_sc_type'] == 1) { // 무료배송
$cost += 0;
}
}
// 모두 착불상품이면
if(count($keys) == $cnt && $cnt > 0)
return array('type' => 'ONDELIVERY', 'cost' => 0);
if($cost > 0)
$data = array('type' => 'PAYED', 'cost' => $cost);
else
$data = array('type' => 'FREE', 'cost' => 0);
return $data;
}
function query()
{
global $g5, $default;
$keys = array();
$opts = array();
$item = '';
$query = '';
$total = 0;
$shipping = '';
$keys = array_unique(array_keys($this->options));
$this->keys = $keys;
foreach($keys as $it_id) {
$sql = " select * from {$g5['g5_shop_item_table']} where it_id = '$it_id' and it_use = '1' and it_soldout = '0' and it_tel_inq = '0' ";
$it = sql_fetch($sql);
if(!$it['it_id'])
continue;
$opts = $this->options[$it_id];
if(empty($opts) || !is_array($opts))
continue;
$it_name = $it['it_name'];
$uprice = get_price($it);
$tprice = 0;
foreach($opts as $opt) {
if($opt['type'])
$tprice = ((int)$opt['price'] * (int)$opt['qty']);
else
$tprice = (((int)$uprice + (int)$opt['price']) * (int)$opt['qty']);
$item .= '&ITEM_ID='.urlencode($it_id);
if($it['ec_mall_pid'])
$item .= '&EC_MALL_PID='.urlencode($it['ec_mall_pid']);
$item .= '&ITEM_NAME='.urlencode($it_name);
$item .= '&ITEM_COUNT='.$opt['qty'];
$item .= '&ITEM_OPTION='.urlencode($opt['option']);
$item .= '&ITEM_TPRICE='.$tprice;
$item .= '&ITEM_UPRICE='.$uprice;
$total += $tprice;
}
}
$sendcost = $this->get_sendcost();
if($sendcost['cost'] > 0)
$total += $sendcost['cost'];
$this->total_price = $total;
$shipping .= '&SHIPPING_TYPE='.$sendcost['type'];
$shipping .= '&SHIPPING_PRICE='.$sendcost['cost'];
if(defined('SHIPPING_ADDITIONAL_PRICE') && SHIPPING_ADDITIONAL_PRICE)
$shipping .= '&SHIPPING_ADDITIONAL_PRICE='.urlencode(SHIPPING_ADDITIONAL_PRICE);
if($item) {
$query .= 'SHOP_ID='.urlencode($default['de_naverpay_mid']);
$query .= '&CERTI_KEY='.urlencode($default['de_naverpay_cert_key']);
$query .= $shipping;
$query .= '&BACK_URL='.urlencode(NAVERPAY_BACK_URL);
$query .= '&NAVER_INFLOW_CODE='.urlencode($_COOKIE['NA_CO']);
$query .= $item;
$query .= '&TOTAL_PRICE='.$total;
}
return $query;
}
}
function get_naverpay_item_image_url($it_id)
{
global $g5;
$sql = " select it_id, it_img1, it_img2, it_img3, it_img4, it_img5, it_img6, it_img7, it_img8, it_img9, it_img10 from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";
$row = sql_fetch($sql);
if(!$row['it_id'])
return '';
$url = '';
for($i=1;$i<=10; $i++) {
$file = G5_DATA_PATH.'/item/'.$row['it_img'.$i];
if(is_file($file) && $row['it_img'.$i]) {
$size = @getimagesize($file);
if($size[2] < 1 || $size[2] > 3)
continue;
$url = str_replace(G5_PATH, G5_URL, $file);
$url = (preg_match('#^http:#', $url) ? '' : 'http:').$url;
break;
}
}
return $url;
}
function get_naverpay_item_stock($it_id)
{
global $g5;
$sql = " select it_id, it_stock_qty, it_use, it_soldout from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";
$it = sql_fetch($sql);
if(!$it['it_id'] || !$it['it_use'] || $it['it_soldout'])
return 0;
// 옵션체크
$sql = " select count(io_no) as cnt, sum(io_stock_qty) as qty from {$g5['g5_shop_item_option_table']} where it_id = '$it_id' and io_type = '0' and io_use = '1' ";
$row = sql_fetch($sql);
if($row['cnt'] > 0)
return $row['qty'];
else
return $it['it_stock_qty'];
}
function get_naverpay_item_option($it_id, $subject)
{
global $g5;
if(!$it_id || !$subject)
return '';
$sql = " select * from {$g5['g5_shop_item_option_table']} where io_type = '0' and it_id = '$it_id' and io_use = '1' order by io_no asc ";
$result = sql_query($sql);
if(!sql_num_rows($result))
return '';
$str = '';
$subj = explode(',', $subject);
$subj_count = count($subj);
$option = '';
if($subj_count > 1) {
$options = array();
// 옵션항목 배열에 저장
for($i=0; $row=sql_fetch_array($result); $i++) {
$osl_id = explode(chr(30), $row['io_id']);
for($k=0; $k<$subj_count; $k++) {
if(!is_array($options[$k]))
$options[$k] = array();
if($osl_id[$k] && !in_array($osl_id[$k], $options[$k]))
$options[$k][] = $osl_id[$k];
}
}
// 옵션선택목록 만들기
for($i=0; $i<$subj_count; $i++) {
$opt = $options[$i];
$osl_count = count($opt);
if($osl_count) {
$option .= '<option name="'.get_text($subj[$i]).'">'.PHP_EOL;
for($k=0; $k<$osl_count; $k++) {
$osl_val = $opt[$k];
if(strlen($osl_val)) {
$option .= '<select><![CDATA['.$osl_val.']]></select>'.PHP_EOL;
}
}
$option .= '</option>'.PHP_EOL;
}
}
} else {
$option .= '<option name="'.get_text($subj[0]).'">'.PHP_EOL;
for($i=0; $row=sql_fetch_array($result); $i++) {
$option .= '<select><![CDATA['.$row['io_id'].']]></select>'.PHP_EOL;
}
$option .= '</option>'.PHP_EOL;
}
return '<options>'.$option.'</options>';
}
function get_naverpay_return_info($mb_id)
{
global $default;
$data = '';
$address1 = trim($default['de_admin_company_addr']);
$address2 = ' ';
$data .= '<returnInfo>';
$data .= '<zipcode><![CDATA['.$default['de_admin_company_zip'].']]></zipcode>';
$data .= '<address1><![CDATA['.$address1.']]></address1>';
$data .= '<address2><![CDATA['.$address2.']]></address2>';
$data .= '<sellername><![CDATA['.$default['de_admin_company_name'].']]></sellername>';
$data .= '<contact1><![CDATA['.$default['de_admin_company_tel'].']]></contact1>';
$data .= '</returnInfo>';
return $data;
}
function return_error2json($str, $fld='error')
{
$data = array();
$data[$fld] = trim($str);
die(json_encode($data));
}
?>

View File

@ -176,6 +176,9 @@ $cart_count = sql_num_rows($result);
<button type="button" onclick="return form_check('buy');" class="btn_submit">주문하기</button>
<div><button type="button" onclick="return form_check('seldelete');" class="btn01">선택삭제</button>
<button type="button" onclick="return form_check('alldelete');" class="btn01">비우기</button></div>
<?php if ($naverpay_button_js) { ?>
<div class="naverpay-cart"><?php echo $naverpay_request_js.$naverpay_button_js; ?></div>
<?php } ?>
<?php } ?>
</div>
@ -227,6 +230,15 @@ $(function() {
});
function fsubmit_check(f) {
if($("input[name^=ct_chk]:checked").size() < 1) {
alert("구매하실 상품을 하나이상 선택해 주십시오.");
return false;
}
return true;
}
function form_check(act) {
var f = document.frmcartlist;
var cnt = f.records.value;

View File

@ -187,7 +187,7 @@ define('G5_SHOP_CSS_URL', str_replace(G5_PATH, G5_URL, $skin_dir));
$g5['title'] = $it['it_name'].' &gt; '.$it['ca_name'];
include_once(G5_MSHOP_PATH.'/_head.php');
include_once(G5_SHOP_PATH.'/settle_naverpay.inc.php');
// 상단 HTML
echo '<div id="sit_hhtml">'.conv_content($it['it_mobile_head_html'], 1).'</div>';

View File

@ -281,7 +281,9 @@ add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_CSS_URL.'/style.css">', 0
<a href="javascript:popup_stocksms('<?php echo $it['it_id']; ?>');" id="sit_btn_buy">재입고알림</a>
<?php } ?>
<a href="javascript:item_wish(document.fitem, '<?php echo $it['it_id']; ?>');" id="sit_btn_wish">WISH</a>
<?php if ($naverpay_button_js) { ?>
<div class="naverpay-item"><?php echo $naverpay_request_js.$naverpay_button_js; ?></div>
<?php } ?>
</div>
</section>
</div>
@ -433,6 +435,68 @@ function popup_stocksms(it_id)
popup_window(url, "itemstocksms", opt);
}
function fsubmit_check(f)
{
// 판매가격이 0 보다 작다면
if (document.getElementById("it_price").value < 0) {
alert("전화로 문의해 주시면 감사하겠습니다.");
return false;
}
if($(".sit_opt_list").size() < 1) {
alert("상품의 선택옵션을 선택해 주십시오.");
return false;
}
var val, io_type, result = true;
var sum_qty = 0;
var min_qty = parseInt(<?php echo $it['it_buy_min_qty']; ?>);
var max_qty = parseInt(<?php echo $it['it_buy_max_qty']; ?>);
var $el_type = $("input[name^=io_type]");
$("input[name^=ct_qty]").each(function(index) {
val = $(this).val();
if(val.length < 1) {
alert("수량을 입력해 주십시오.");
result = false;
return false;
}
if(val.replace(/[0-9]/g, "").length > 0) {
alert("수량은 숫자로 입력해 주십시오.");
result = false;
return false;
}
if(parseInt(val.replace(/[^0-9]/g, "")) < 1) {
alert("수량은 1이상 입력해 주십시오.");
result = false;
return false;
}
io_type = $el_type.eq(index).val();
if(io_type == "0")
sum_qty += parseInt(val);
});
if(!result) {
return false;
}
if(min_qty > 0 && sum_qty < min_qty) {
alert("선택옵션 개수 총합 "+number_format(String(min_qty))+"개 이상 주문해 주십시오.");
return false;
}
if(max_qty > 0 && sum_qty > max_qty) {
alert("선택옵션 개수 총합 "+number_format(String(max_qty))+"개 이하로 주문해 주십시오.");
return false;
}
return true;
}
// 바로구매, 장바구니 폼 전송
function fitem_submit(f)
{

View File

@ -1,5 +1,6 @@
<?php
include_once('./_common.php');
include_once(G5_SHOP_PATH.'/settle_naverpay.inc.php');
// 보관기간이 지난 상품 삭제
cart_item_clean();
@ -200,6 +201,9 @@ include_once('./_head.php');
<button type="button" onclick="return form_check('buy');" class="btn_submit">주문하기</button>
<button type="button" onclick="return form_check('seldelete');" class="btn01">선택삭제</button>
<button type="button" onclick="return form_check('alldelete');" class="btn01">비우기</button>
<?php if ($naverpay_button_js) { ?>
<div class="cart-naverpay"><?php echo $naverpay_request_js.$naverpay_button_js; ?></div>
<?php } ?>
<?php } ?>
</div>
@ -249,6 +253,15 @@ $(function() {
});
function fsubmit_check(f) {
if($("input[name^=ct_chk]:checked").size() < 1) {
alert("구매하실 상품을 하나이상 선택해 주십시오.");
return false;
}
return true;
}
function form_check(act) {
var f = document.frmcartlist;
var cnt = f.records.value;

View File

@ -233,6 +233,8 @@ function pg_anchor($anc_id) {
</ul>
<?php
}
include_once(G5_SHOP_PATH.'/settle_naverpay.inc.php');
?>
<?php if($is_orderable) { ?>

View File

@ -0,0 +1,4 @@
<?php
define('_SHOP_', true);
include_once('../../common.php');
?>

View File

@ -0,0 +1,80 @@
<?php
include_once('./_common.php');
include_once(G5_LIB_PATH.'/naverpay.lib.php');
$query = $_SERVER['QUERY_STRING'];
$vars = array();
foreach(explode('&', $query) as $pair) {
list($key, $value) = explode('=', $pair);
$key = urldecode($key);
$value = urldecode($value);
$vars[$key][] = $value;
}
$itemIds = $vars['ITEM_ID'];
if (count($itemIds) < 1) {
exit('ITEM_ID 는 필수입니다.');
}
header('Content-Type: application/xml;charset=utf-8');
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<response>
<?php
foreach($itemIds as $it_id) {
$sql = " select * from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";
$it = sql_fetch($sql);
if(!$it['it_id'])
continue;
$id = $it['it_id'];
$name = $it['it_name'];
$description = $it['it_basic'];
$price = get_price($it);
$image = get_naverpay_item_image_url($it_id);
$quantity = get_naverpay_item_stock($it_id);
$ca_name = '';
$ca_name2 = '';
$ca_name3 = '';
$returnInfo = get_naverpay_return_info($it['it_seller']);
$option = get_naverpay_item_option($it_id, $it['it_option_subject']);
if($it['ca_id']) {
$cat = sql_fetch(" select ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$it['ca_id']}' ");
$ca_name = $cat['ca_name'];
}
if($it['ca_id2']) {
$cat = sql_fetch(" select ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$it['ca_id2']}' ");
$ca_name2 = $cat['ca_name'];
}
if($it['ca_id3']) {
$cat = sql_fetch(" select ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$it['ca_id3']}' ");
$ca_name3 = $cat['ca_name'];
}
?>
<item id="<?php echo $id; ?>">
<?php if($it['ec_mall_pid']) { ?>
<name><![CDATA[<?php echo $it['ec_mall_pid']; ?>]]></name>
<?php } ?>
<name><![CDATA[<?php echo $name; ?>]]></name>
<url><?php echo G5_SHOP_URL.'/item.php?it_id='.$it_id; ?></url>
<description><![CDATA[<?php echo $description; ?>]]></description>
<image><?php echo $image; ?></image>
<thumb><?php echo $image; ?></thumb>
<price><?php echo $price; ?></price>
<quantity><?php echo $quantity; ?></quantity>
<category>
<first id="MJ01"><![CDATA[<?php echo $ca_name; ?>]]></first>
<second id="ML01"><![CDATA[<?php echo $ca_name2; ?>]]></second>
<third id="MN01"><![CDATA[<?php echo $ca_name3; ?>]]></third>
</category>
<?php echo $option; ?>
<?php echo $returnInfo; ?>
</item>
<?php
}
echo('</response>');
?>

View File

@ -0,0 +1,228 @@
<?php
include_once('./_common.php');
include_once(G5_SHOP_PATH.'/settle_naverpay.inc.php');
include_once(G5_LIB_PATH.'/naverpay.lib.php');
if($_POST['naverpay_form'] == 'cart.php') {
if(!count($_POST['ct_chk']))
return_error2json('구매하실 상품을 하나이상 선택해 주십시오.');
$s_cart_id = get_session('ss_cart_id');
$fldcnt = count($_POST['it_id']);
$items = array();
for($i=0; $i<$fldcnt; $i++) {
$ct_chk = $_POST['ct_chk'][$i];
if(!$ct_chk)
continue;
$it_id = $_POST['it_id'][$i];
// 장바구니 상품
$sql = " select ct_id, it_id, ct_option, io_id, io_type, ct_qty from {$g5['g5_shop_cart_table']} where od_id = '$s_cart_id' and it_id = '$it_id' and ct_status = '쇼핑' order by ct_id asc ";
$result = sql_query($sql);
for($k=0; $row=sql_fetch_array($result); $k++) {
$_POST['io_id'][$it_id][] = $row['io_id'];
$_POST['io_type'][$it_id][] = $row['io_type'];
$_POST['ct_qty'][$it_id][] = $row['ct_qty'];
$_POST['io_value'][$it_id][] = $row['ct_option'];
}
if($k > 0)
$items[] = $it_id;
}
$_POST['it_id'] = $items;
}
$count = count($_POST['it_id']);
if ($count < 1)
return_error2json('구매하실 상품을 선택하여 주십시오.');
$itm_ids = array();
$sel_options = array();
$sup_options = array();
if($_POST['naverpay_form'] == 'item.php')
$back_uri = '/item.php?it_id='.$_POST['it_id'][0];
else if($_POST['naverpay_form'] == 'cart.php')
$back_uri = '/cart.php';
else
$back_uri = '';
define('NAVERPAY_BACK_URL', G5_SHOP_URL.$back_uri);
for($i=0; $i<$count; $i++) {
$it_id = $_POST['it_id'][$i];
$opt_count = count($_POST['io_id'][$it_id]);
if($opt_count && $_POST['io_type'][$it_id][0] != 0)
return_error2json('상품의 선택옵션을 선택해 주십시오.');
for($k=0; $k<$opt_count; $k++) {
if ($_POST['ct_qty'][$it_id][$k] < 1)
return_error2json('수량은 1 이상 입력해 주십시오.');
}
// 상품정보
$sql = " select * from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";
$it = sql_fetch($sql);
if(!$it['it_id'])
return_error2json('상품정보가 존재하지 않습니다.');
if(!$it['it_use'] || $it['it_soldout'] || $it['it_tel_inq'])
return_error2json($it['it_name'].' 는(은) 구매할 수 없는 상품입니다.');
// 최소, 최대 수량 체크
if($it['it_buy_min_qty'] || $it['it_buy_max_qty']) {
$sum_qty = 0;
for($k=0; $k<$opt_count; $k++) {
if($_POST['io_type'][$it_id][$k] == 0)
$sum_qty += $_POST['ct_qty'][$it_id][$k];
}
if($it['it_buy_min_qty'] > 0 && $sum_qty < $it['it_buy_min_qty'])
return_error2json($it['it_name'].'의 선택옵션 개수 총합 '.number_format($it['it_buy_min_qty']).'개 이상 주문해 주십시오.');
if($it['it_buy_max_qty'] > 0 && $sum_qty > $it['it_buy_max_qty'])
return_error2json($it['it_name'].'의 선택옵션 개수 총합 '.number_format($it['it_buy_max_qty']).'개 이하로 주문해 주십시오.');
}
// 옵션정보를 얻어서 배열에 저장
$opt_list = array();
$sql = " select * from {$g5['g5_shop_item_option_table']} where it_id = '$it_id' order by io_no asc ";
$result = sql_query($sql);
$lst_count = 0;
for($k=0; $row=sql_fetch_array($result); $k++) {
$opt_list[$row['io_type']][$row['io_id']]['id'] = $row['io_id'];
$opt_list[$row['io_type']][$row['io_id']]['use'] = $row['io_use'];
$opt_list[$row['io_type']][$row['io_id']]['price'] = $row['io_price'];
$opt_list[$row['io_type']][$row['io_id']]['stock'] = $row['io_stock_qty'];
// 선택옵션 개수
if(!$row['io_type'])
$lst_count++;
}
//--------------------------------------------------------
// 재고 검사
//--------------------------------------------------------
for($k=0; $k<$opt_count; $k++) {
$io_id = $_POST['io_id'][$it_id][$k];
$io_type = $_POST['io_type'][$it_id][$k];
$io_value = $_POST['io_value'][$it_id][$k];
// 재고 구함
$ct_qty = $_POST['ct_qty'][$it_id][$k];
if(!$io_id)
$it_stock_qty = get_it_stock_qty($it_id);
else
$it_stock_qty = get_option_stock_qty($it_id, $io_id, $io_type);
if ($ct_qty > $it_stock_qty)
{
return_error2json($io_value." 의 재고수량이 부족합니다.\\n\\n현재 재고수량 : " . number_format($it_stock_qty) . "");
}
}
//--------------------------------------------------------
$itm_ids[] = $it_id;
for($k=0; $k<$opt_count; $k++) {
$io_id = $_POST['io_id'][$it_id][$k];
$io_type = $_POST['io_type'][$it_id][$k];
$io_value = $_POST['io_value'][$it_id][$k];
// 선택옵션정보가 존재하는데 선택된 옵션이 없으면 건너뜀
if($lst_count && $io_id == '')
continue;
// 구매할 수 없는 옵션은 건너뜀
if($io_id && !$opt_list[$io_type][$io_id]['use'])
continue;
$io_price = $opt_list[$io_type][$io_id]['price'];
$ct_qty = $_POST['ct_qty'][$it_id][$k];
$it_price = get_price($it);
// 구매가격이 음수인지 체크
if($io_type) {
if((int)$io_price <= 0)
return_error2json('구매금액이 음수 또는 0원인 상품은 구매할 수 없습니다.');
} else {
if((int)$it_price + (int)$io_price <= 0)
return_error2json('구매금액이 음수 또는 0원인 상품은 구매할 수 없습니다.');
}
// 배송비결제
if($it['it_sc_type'] == 1)
$ct_send_cost = 2; // 무료
else if($it['it_sc_type'] > 1 && $it['it_sc_method'] == 1)
$ct_send_cost = 1; // 착불
// 옵션정보배열에 저장
$options[$it_id][] = array(
'option' => $io_value,
'price' => $io_price,
'qty' => $ct_qty,
'send_cost' => $ct_send_cost,
'type' => $io_type,
'io_id' => $io_id
);
}
}
$order = new naverpay_register($options, $ct_send_cost);
$query = $order->query();
$totalPrice = $order->total_price;
//echo $query.'<br>'.PHP_EOL;
$nc_sock = @fsockopen($req_addr, $req_port, $errno, $errstr);
if ($nc_sock) {
fwrite($nc_sock, $buy_req_url."\r\n" );
fwrite($nc_sock, "Host: ".$req_host.":".$req_port."\r\n" );
fwrite($nc_sock, "Content-type: application/x-www-form-urlencoded; charset=utf-8\r\n");
fwrite($nc_sock, "Content-length: ".strlen($query)."\r\n");
fwrite($nc_sock, "Accept: */*\r\n");
fwrite($nc_sock, "\r\n");
fwrite($nc_sock, $query."\r\n");
fwrite($nc_sock, "\r\n");
// get header
while(!feof($nc_sock)) {
$header=fgets($nc_sock,4096);
if($header=="\r\n") {
break;
} else {
$headers .= $header;
}
}
// get body
while(!feof($nc_sock)) {
$bodys.=fgets($nc_sock,4096);
}
fclose($nc_sock);
$resultCode = substr($headers,9,3);
if ($resultCode == 200) {
// success
$orderId = $bodys;
} else {
// fail
return_error2json($bodys);
}
} else {
//echo "$errstr ($errno)<br>\n";
return_error2json($errstr ($errno));
exit(-1);
//에러처리
}
if($resultCode == 200)
die(json_encode(array('error'=>'', 'ORDER_ID'=>$orderId, 'SHOP_ID'=>$default['de_naverpay_mid'], 'TOTAL_PRICE'=>$totalPrice)));
?>

View File

@ -0,0 +1,112 @@
<?php
include_once('./_common.php');
include_once(G5_SHOP_PATH.'/settle_naverpay.inc.php');
include_once(G5_LIB_PATH.'/naverpay.lib.php');
$count = count($_POST['it_id']);
if ($count < 1)
alert_close('찜하실 상품을 선택하여 주십시오.');
$query = '';
$item = '';
for($i=0; $i<$count; $i++) {
$it_id = $_POST['it_id'][$i];
// 상품정보
$sql = " select * from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";
$it = sql_fetch($sql);
if(!$it['it_id'])
alert_close('상품정보가 존재하지 않습니다.');
$id = urlencode($it['it_id']);
$name = urlencode($it['it_name']);
$description = urlencode($it['it_basic']);
$price = get_price($it);
$image = urlencode(get_naverpay_item_image_url($it_id));
$item_url = urlencode($g5_shop_base_url.'/item.php?it_id='.$it_id);
$item .= '&ITEM_ID='.$id;
if($it['ec_mall_pid'])
$item .= '&EC_MALL_PID='.urlencode($it['ec_mall_pid']);
$item .= '&ITEM_NAME='.$name;
$item .= '&ITEM_DESC='.$description;
$item .= '&ITEM_UPRICE='.$price;
$item .= '&ITEM_IMAGE='.$image;
$item .= '&ITEM_THUMB='.$image;
$item .= '&ITEM_URL='.$item_url;
}
if($item) {
$query .= 'SHOP_ID='.urlencode($default['de_naverpay_mid']);
$query .= '&CERTI_KEY='.urlencode($default['de_naverpay_cert_key']);
$query .= $item;
}
$nc_sock = @fsockopen($req_addr, $req_port, $errno, $errstr);
if ($nc_sock) {
fwrite($nc_sock, $wish_req_url."\r\n" );
fwrite($nc_sock, "Host: ".$req_host.":".$req_port."\r\n" );
fwrite($nc_sock, "Content-type: application/x-www-form-urlencoded; charset=utf-8\r\n");
fwrite($nc_sock, "Content-length: ".strlen($query)."\r\n");
fwrite($nc_sock, "Accept: */*\r\n");
fwrite($nc_sock, "\r\n");
fwrite($nc_sock, $query."\r\n");
fwrite($nc_sock, "\r\n");
// get header
while(!feof($nc_sock)) {
$header=fgets($nc_sock,4096);
if($header=="\r\n") {
break;
} else {
$headers .= $header;
}
}
// get body
while(!feof($nc_sock)) {
$bodys.=fgets($nc_sock,4096);
}
fclose($nc_sock);
$resultCode = substr($headers,9,3);
if ($resultCode == 200) {
// success
$itemIds = trim($bodys);
$itemIdList = explode(',',$itemIds);
} else {
// fail
die($bodys);
}
} else {
echo "$errstr ($errno)<br>\n";
exit(-1);
//에러처리
}
$count = count($itemIdList);
if ($resultCode == 200) {
?>
<html>
<body>
<form name="frm" method="get" action="<?php echo $wishUrl; ?>">
<input type="hidden" name="SHOP_ID" value="<?php echo $default['de_naverpay_mid']; ?>">
<?php
for($i=0; $i<$count; $i++) {
?>
<input type="hidden" name="ITEM_ID" value="<?php echo $itemIdList[$i]; ?>">
<?php
}
?>
</form>
</body>
<script>
document.frm.target = "_top";
document.frm.submit();
</script>
</html>
<?php } ?>

View File

@ -0,0 +1,149 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
if(!$is_admin && !$default['de_card_test'] && $default['de_naverpay_test']) {
if($default['de_naverpay_mb_id'] && ($is_guest || $member['mb_id'] != $default['de_naverpay_mb_id']))
return;
}
if(!$default['de_naverpay_cert_key'] || !$default['de_naverpay_button_key'])
return;
if(basename($_SERVER['SCRIPT_NAME']) == 'item.php') {
if(!$is_orderable)
return;
}
$naverpay_button_js = '';
$is_mobile_order = is_mobile();
//$is_mobile_order = G5_IS_MOBILE;
$naverpay_button_enable = 'Y';
$naverpay_button_count = 2;
if(basename($_SERVER['SCRIPT_NAME']) == 'cart.php')
$naverpay_button_count = 1;
if($is_mobile_order) {
if($default['de_naverpay_test'])
$naverpay_button_js_url = 'https://test-pay.naver.com/customer/js/mobile/naverPayButton.js';
else
$naverpay_button_js_url = 'https://pay.naver.com/customer/js/mobile/naverPayButton.js';
$naverpay_button_js = '<script type="text/javascript" src="'.$naverpay_button_js_url.'" charset="UTF-8"></script>
<script type="text/javascript" >//<![CDATA[
naver.NaverPayButton.apply({
BUTTON_KEY: "'.$default['de_naverpay_button_key'].'", // 네이버페이에서 제공받은 버튼 인증 키 입력
TYPE: "MA", // 버튼 모음 종류 설정
COLOR: 1, // 버튼 모음의 색 설정
COUNT: '.$naverpay_button_count.', // 버튼 개수 설정. 구매하기 버튼만 있으면 1, 찜하기 버튼도 있으면 2를 입력.
ENABLE: "'.$naverpay_button_enable.'", // 품절 등의 이유로 버튼 모음을 비활성화할 때에는 "N" 입력
BUY_BUTTON_HANDLER : buy_nc, // 구매하기 버튼 이벤트 Handler 함수 등록, 품절인 경우 not_buy_nc 함수 사용
WISHLIST_BUTTON_HANDLER : wishlist_nc, // 찜하기 버튼 이벤트 Handler 함수 등록
"":""
});
//]]></script>'.PHP_EOL;
} else {
$naverpay_button_js = '<script type="text/javascript" src="https://pay.naver.com/customer/js/naverPayButton.js" charset="UTF-8"></script>
<script type="text/javascript" >//<![CDATA[
naver.NaverPayButton.apply({
BUTTON_KEY: "'.$default['de_naverpay_button_key'].'", // 페이에서 제공받은 버튼 인증 키 입력
TYPE: "A", // 버튼 모음 종류 설정
COLOR: 1, // 버튼 모음의 색 설정
COUNT: '.$naverpay_button_count.', // 버튼 개수 설정. 구매하기 버튼만 있으면 1, 찜하기 버튼도 있으면 2를 입력.
ENABLE: "'.$naverpay_button_enable.'", // 품절 등의 이유로 버튼 모음을 비활성화할 때에는 "N" 입력
BUY_BUTTON_HANDLER : buy_nc, // 구매하기 버튼 이벤트 Handler 함수 등록, 품절인 경우 not_buy_nc 함수 사용
WISHLIST_BUTTON_HANDLER : wishlist_nc, // 찜하기 버튼 이벤트 Handler 함수 등록
"":""
});
//]]></script>'.PHP_EOL;
}
$naverpay_button_js .= '<input type="hidden" name="naverpay_form" value="'.basename($_SERVER['SCRIPT_NAME']).'">'.PHP_EOL;
if($default['de_naverpay_test'] || $default['de_card_test']) {
$req_addr = 'ssl://test-pay.naver.com';
$buy_req_url = 'POST /customer/api/order.nhn HTTP/1.1';
$wish_req_url = 'POST /customer/api/wishlist.nhn HTTP/1.1';
$req_host = 'test-pay.naver.com';
$req_port = 443;
if($is_mobile_order) {
$orderUrl = 'https://test-m.pay.naver.com/mobile/customer/order.nhn';
$wishUrl = 'https://m.pay.naver.com/mobile/customer/wishList.nhn';
} else {
$orderUrl = 'https://test-pay.naver.com/customer/order.nhn';
$wishUrl = 'https://test-pay.naver.com/customer/wishlistPopup.nhn';
}
} else {
$req_addr = 'ssl://pay.naver.com';
$buy_req_url = 'POST /customer/api/order.nhn HTTP/1.1';
$wish_req_url = 'POST /customer/api/wishlist.nhn HTTP/1.1';
$req_host = 'pay.naver.com';
$req_port = 443;
if($is_mobile_order) {
$orderUrl = 'https://m.pay.naver.com/mobile/customer/order.nhn';
$wishUrl = 'https://m.pay.naver.com/mobile/customer/wishList.nhn';
} else {
$orderUrl = 'https://pay.naver.com/customer/order.nhn';
$wishUrl = 'https://pay.naver.com/customer/wishlistPopup.nhn';
}
}
define('SHIPPING_ADDITIONAL_PRICE', $default['de_naverpay_sendcost']);
$naverpay_request_js = '<script type="text/javascript" >//<![CDATA[
function buy_nc(url)
{
var f = $(this).closest("form").get(0);
var check = fsubmit_check(f);
if ( check ) {
//네이버페이로 주문 정보를 등록하는 가맹점 페이지로 이동.
//해당 페이지에서 주문 정보 등록 후 네이버페이 주문서 페이지로 이동.
//location.href=url;
//var win_buy_nc = window.open("_blank", "win_buy_nc", "scrollbars=yes,width=900,height=700,top=10,left=10");
//f.action = "'.G5_SHOP_URL.'/naverpay/naverpay_order.php";
//f.target = "win_buy_nc";
//f.submit();
//return false;
$.ajax({
url : "'.G5_SHOP_URL.'/naverpay/naverpay_order.php",
type : "POST",
data : $(f).serialize(),
async : false,
cache : false,
dataType : "json",
success : function(data) {
if(data.error) {
alert(data.error);
return false;
}
document.location.href = "'.$orderUrl.'?ORDER_ID="+data.ORDER_ID+"&SHOP_ID="+data.SHOP_ID+"&TOTAL_PRICE="+data.TOTAL_PRICE;
}
});
}
return false;
}
function wishlist_nc(url)
{
var f = $(this).closest("form").get(0);
// 네이버페이로 찜 정보를 등록하는 가맹점 페이지 팝업 창 생성.
// 해당 페이지에서 찜 정보 등록 후 네이버페이 찜 페이지로 이동.
'.($is_mobile_order ? '' : 'var win_wishlist_nc = window.open(url,"win_wishlist_nc","scrollbars=yes,width=400,height=267");'.PHP_EOL.'f.target = "win_wishlist_nc";').'
f.action = "'.G5_SHOP_URL.'/naverpay/naverpay_wish.php";
f.submit();
return false;
}
function not_buy_nc()
{
alert("죄송합니다. 네이버페이로 구매가 불가한 상품입니다.");
return false;
}
//]]></script>'.PHP_EOL;
?>

View File

@ -297,6 +297,9 @@ add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_CSS_URL.'/style.css">', 0
<?php } ?>
<a href="javascript:item_wish(document.fitem, '<?php echo $it['it_id']; ?>');" id="sit_btn_wish">위시리스트</a>
<a href="javascript:popup_item_recommend('<?php echo $it['it_id']; ?>');" id="sit_btn_rec">추천하기</a>
<?php if ($naverpay_button_js) { ?>
<div class="itemform-naverpay"><?php echo $naverpay_request_js.$naverpay_button_js; ?></div>
<?php } ?>
</div>
<script>
@ -376,6 +379,68 @@ $(function(){
});
});
function fsubmit_check(f)
{
// 판매가격이 0 보다 작다면
if (document.getElementById("it_price").value < 0) {
alert("전화로 문의해 주시면 감사하겠습니다.");
return false;
}
if($(".sit_opt_list").size() < 1) {
alert("상품의 선택옵션을 선택해 주십시오.");
return false;
}
var val, io_type, result = true;
var sum_qty = 0;
var min_qty = parseInt(<?php echo $it['it_buy_min_qty']; ?>);
var max_qty = parseInt(<?php echo $it['it_buy_max_qty']; ?>);
var $el_type = $("input[name^=io_type]");
$("input[name^=ct_qty]").each(function(index) {
val = $(this).val();
if(val.length < 1) {
alert("수량을 입력해 주십시오.");
result = false;
return false;
}
if(val.replace(/[0-9]/g, "").length > 0) {
alert("수량은 숫자로 입력해 주십시오.");
result = false;
return false;
}
if(parseInt(val.replace(/[^0-9]/g, "")) < 1) {
alert("수량은 1이상 입력해 주십시오.");
result = false;
return false;
}
io_type = $el_type.eq(index).val();
if(io_type == "0")
sum_qty += parseInt(val);
});
if(!result) {
return false;
}
if(min_qty > 0 && sum_qty < min_qty) {
alert("선택옵션 개수 총합 "+number_format(String(min_qty))+"개 이상 주문해 주십시오.");
return false;
}
if(max_qty > 0 && sum_qty > max_qty) {
alert("선택옵션 개수 총합 "+number_format(String(max_qty))+"개 이하로 주문해 주십시오.");
return false;
}
return true;
}
// 바로구매, 장바구니 폼 전송
function fitem_submit(f)

View File

@ -578,3 +578,7 @@ html.no-overflowscrolling #sc_coupon_frm, html.no-overflowscrolling #od_coupon_f
#sod_frm_paysel ul {margin:0;padding:0;}
#sod_frm_paysel ul:after {display:block;visibility:hidden;clear:both;content:""}
#sod_frm_paysel li {float:left;padding:5px 2%;width:46%;height:21px;text-align:left;list-style:none}
/*네이버페이*/
.itemform-naverpay{margin-top:15px}
.cart-naverpay{margin-top:15px}

View File

@ -725,3 +725,7 @@ a.btn_admin:focus, a.btn_admin:hover {text-decoration:none}
#sod_frm_pay{padding:10px 0}
#sod_frm_pay h2{padding:10px 0 10px}
#display_pay_button .btn_submit{padding:8px 5px}
/*네이버페이*/
.naverpay-item{padding-top:15px;clear:both}
#sod_bsk_act .naverpay-cart{margin-top:15px;clear:both;position:static}

View File

@ -281,7 +281,9 @@ add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_CSS_URL.'/style.css">', 0
<a href="javascript:popup_stocksms('<?php echo $it['it_id']; ?>');" id="sit_btn_buy">재입고알림</a>
<?php } ?>
<a href="javascript:item_wish(document.fitem, '<?php echo $it['it_id']; ?>');" id="sit_btn_wish">WISH</a>
<?php if ($naverpay_button_js) { ?>
<div class="naverpay-item"><?php echo $naverpay_request_js.$naverpay_button_js; ?></div>
<?php } ?>
</div>
</section>
</div>
@ -433,6 +435,68 @@ function popup_stocksms(it_id)
popup_window(url, "itemstocksms", opt);
}
function fsubmit_check(f)
{
// 판매가격이 0 보다 작다면
if (document.getElementById("it_price").value < 0) {
alert("전화로 문의해 주시면 감사하겠습니다.");
return false;
}
if($(".sit_opt_list").size() < 1) {
alert("상품의 선택옵션을 선택해 주십시오.");
return false;
}
var val, io_type, result = true;
var sum_qty = 0;
var min_qty = parseInt(<?php echo $it['it_buy_min_qty']; ?>);
var max_qty = parseInt(<?php echo $it['it_buy_max_qty']; ?>);
var $el_type = $("input[name^=io_type]");
$("input[name^=ct_qty]").each(function(index) {
val = $(this).val();
if(val.length < 1) {
alert("수량을 입력해 주십시오.");
result = false;
return false;
}
if(val.replace(/[0-9]/g, "").length > 0) {
alert("수량은 숫자로 입력해 주십시오.");
result = false;
return false;
}
if(parseInt(val.replace(/[^0-9]/g, "")) < 1) {
alert("수량은 1이상 입력해 주십시오.");
result = false;
return false;
}
io_type = $el_type.eq(index).val();
if(io_type == "0")
sum_qty += parseInt(val);
});
if(!result) {
return false;
}
if(min_qty > 0 && sum_qty < min_qty) {
alert("선택옵션 개수 총합 "+number_format(String(min_qty))+"개 이상 주문해 주십시오.");
return false;
}
if(max_qty > 0 && sum_qty > max_qty) {
alert("선택옵션 개수 총합 "+number_format(String(max_qty))+"개 이하로 주문해 주십시오.");
return false;
}
return true;
}
// 바로구매, 장바구니 폼 전송
function fitem_submit(f)
{

View File

@ -297,6 +297,9 @@ add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_CSS_URL.'/style.css">', 0
<?php } ?>
<a href="javascript:item_wish(document.fitem, '<?php echo $it['it_id']; ?>');" id="sit_btn_wish">위시리스트</a>
<a href="javascript:popup_item_recommend('<?php echo $it['it_id']; ?>');" id="sit_btn_rec">추천하기</a>
<?php if ($naverpay_button_js) { ?>
<div class="itemform-naverpay"><?php echo $naverpay_request_js.$naverpay_button_js; ?></div>
<?php } ?>
</div>
<script>
@ -376,6 +379,67 @@ $(function(){
});
});
function fsubmit_check(f)
{
// 판매가격이 0 보다 작다면
if (document.getElementById("it_price").value < 0) {
alert("전화로 문의해 주시면 감사하겠습니다.");
return false;
}
if($(".sit_opt_list").size() < 1) {
alert("상품의 선택옵션을 선택해 주십시오.");
return false;
}
var val, io_type, result = true;
var sum_qty = 0;
var min_qty = parseInt(<?php echo $it['it_buy_min_qty']; ?>);
var max_qty = parseInt(<?php echo $it['it_buy_max_qty']; ?>);
var $el_type = $("input[name^=io_type]");
$("input[name^=ct_qty]").each(function(index) {
val = $(this).val();
if(val.length < 1) {
alert("수량을 입력해 주십시오.");
result = false;
return false;
}
if(val.replace(/[0-9]/g, "").length > 0) {
alert("수량은 숫자로 입력해 주십시오.");
result = false;
return false;
}
if(parseInt(val.replace(/[^0-9]/g, "")) < 1) {
alert("수량은 1이상 입력해 주십시오.");
result = false;
return false;
}
io_type = $el_type.eq(index).val();
if(io_type == "0")
sum_qty += parseInt(val);
});
if(!result) {
return false;
}
if(min_qty > 0 && sum_qty < min_qty) {
alert("선택옵션 개수 총합 "+number_format(String(min_qty))+"개 이상 주문해 주십시오.");
return false;
}
if(max_qty > 0 && sum_qty > max_qty) {
alert("선택옵션 개수 총합 "+number_format(String(max_qty))+"개 이하로 주문해 주십시오.");
return false;
}
return true;
}
// 바로구매, 장바구니 폼 전송
function fitem_submit(f)