diff --git a/adm/admin.menu400.shop_1of2.php b/adm/admin.menu400.shop_1of2.php
index 620df3357..418cd4ec2 100644
--- a/adm/admin.menu400.shop_1of2.php
+++ b/adm/admin.menu400.shop_1of2.php
@@ -14,6 +14,7 @@ $menu['menu400'] = array (
array('400620', '상품재고관리', G4_ADMIN_URL.'/shop_admin/itemstocklist.php', 'scf_item_stock'),
array('400610', '상품유형관리', G4_ADMIN_URL.'/shop_admin/itemtypelist.php', 'scf_item_type'),
array('400500', '상품옵션재고관리', G4_ADMIN_URL.'/shop_admin/optionstocklist.php', 'scf_item_option'),
+ array('400490', '마일리지관리', G4_ADMIN_URL.'/shop_admin/mileagelist.php', 'scf_mileage'),
array('400500', '배송일괄처리', G4_ADMIN_URL.'/shop_admin/deliverylist.php', 'scf_deli', 1),
array('400740', '배송업체관리', G4_ADMIN_URL.'/shop_admin/deliverycodelist.php', 'scf_deli_co', 1),
array('400630', '이벤트관리', G4_ADMIN_URL.'/shop_admin/itemevent.php', 'scf_event'),
diff --git a/adm/shop_admin/itemform.php b/adm/shop_admin/itemform.php
index 159189b45..3de5bccae 100644
--- a/adm/shop_admin/itemform.php
+++ b/adm/shop_admin/itemform.php
@@ -775,11 +775,37 @@ $(function(){
+
|
-
- 점
+
+
|
@@ -1314,30 +1340,11 @@ function fitemformcheck(f)
}
}
- // 옵션값 검사
- for (var i=1; i<=6; i++) {
- var opt = document.getElementsByName("it_opt"+i)[0];
- var arr = opt.value.split("\n");
- for (var k=0; k 99) {
+ alert("포인트 비율을 0과 99 사이의 값으로 입력해 주십시오.");
+ return false;
}
}
diff --git a/adm/shop_admin/itemformupdate.php b/adm/shop_admin/itemformupdate.php
index dc70af301..b65d34cea 100644
--- a/adm/shop_admin/itemformupdate.php
+++ b/adm/shop_admin/itemformupdate.php
@@ -351,6 +351,10 @@ for($i=0; $i 99)
+ alert("포인트 비율을 0과 99 사이의 값으로 입력해 주십시오.");
+
$sql_common = " ca_id = '$ca_id',
ca_id2 = '$ca_id2',
ca_id3 = '$ca_id3',
@@ -374,6 +378,7 @@ $sql_common = " ca_id = '$ca_id',
it_cust_price = '$it_cust_price',
it_price = '$it_price',
it_point = '$it_point',
+ it_point_type = '$it_point_type',
it_sell_email = '$it_sell_email',
it_use = '$it_use',
it_stock_qty = '$it_stock_qty',
diff --git a/adm/shop_admin/mileagelist.php b/adm/shop_admin/mileagelist.php
new file mode 100644
index 000000000..a01d91204
--- /dev/null
+++ b/adm/shop_admin/mileagelist.php
@@ -0,0 +1,206 @@
+전체목록';
+
+$mb = array();
+if ($sfl == 'mb_id' && $stx)
+ $mb = get_member(isset($stx));
+
+$g4['title'] = '마일리지관리';
+include_once (G4_ADMIN_PATH.'/admin.head.php');
+
+$colspan = 8;
+?>
+
+
+
+
+
+
+
+
+
+
+ 개별회원 마일리지 증감 설정
+
+
+
+
+
+
diff --git a/adm/shop_admin/mileagelist_delete.php b/adm/shop_admin/mileagelist_delete.php
new file mode 100644
index 000000000..2e24b5df2
--- /dev/null
+++ b/adm/shop_admin/mileagelist_delete.php
@@ -0,0 +1,32 @@
+
diff --git a/adm/shop_admin/mileageupdate.php b/adm/shop_admin/mileageupdate.php
new file mode 100644
index 000000000..f7808576b
--- /dev/null
+++ b/adm/shop_admin/mileageupdate.php
@@ -0,0 +1,24 @@
+ $mb['mb_mileage']))
+ alert('포인트를 깎는 경우 현재 마일리지보다 작으면 안됩니다.', './mileagelist.php?'.$qstr);
+
+insert_mileage($mb_id, $ml_point, $ml_content, '', '');
+
+goto_url('./mileagelist.php?'.$qstr);
+?>
diff --git a/adm/shop_admin/orderform.php b/adm/shop_admin/orderform.php
index f816c85b2..cecacbd33 100644
--- a/adm/shop_admin/orderform.php
+++ b/adm/shop_admin/orderform.php
@@ -48,9 +48,16 @@ if (!isset($order_not_point)) {
// 회원이면서 포인트가 0보다 크다면
if ($tmp_row['mb_id'] && $row['ct_point'] > 0)
{
+ /** 주문완료 포인트를 게시판 포인트와 연동하려면 주석제거
$po_point = $row['ct_point'] * $row['ct_qty'];
$po_content = "$cart_title3 {$tmp_row['od_id']} ({$row['ct_id']}) $cart_title4";
insert_point($tmp_row['mb_id'], $po_point, $po_content, "@delivery", $tmp_row['mb_id'], "{$tmp_row['od_id']},{$row['uq_id']},{$row['ct_id']}");
+ */
+
+ // 주문완료 쇼핑몰 포인트로 적립
+ $ml_point = $row['ct_point'] * $row['ct_qty'];
+ $ml_content = "$cart_title3 {$tmp_row['od_id']} ({$row['ct_id']}) $cart_title4";
+ insert_mileage($tmp_row['mb_id'], $ml_point, $ml_content, $tmp_row['od_id'], $row['ct_id']);
}
sql_query("update {$g4['shop_cart_table']} set ct_point_use = '1' where ct_id = '{$row['ct_id']}' ");
diff --git a/extend/shop.extend2.php b/extend/shop.extend2.php
index 71f3edacd..42b40de3a 100644
--- a/extend/shop.extend2.php
+++ b/extend/shop.extend2.php
@@ -199,4 +199,25 @@ if(!$result) {
ADD `de_cart_keep_term` INT(11) NOT NULL DEFAULT '0' AFTER `de_code_dup_use`,
ADD `de_guest_cart_use` TINYINT(4) NOT NULL DEFAULT '0' AFTER `de_cart_keep_term` ", false);
}
+
+// 마일리지관련 필드 추가
+$sql = " select it_point_type from {$g4['shop_item_table']} limit 1 ";
+$result = sql_query($sql, false);
+if(!$result) {
+ sql_query(" CREATE TABLE IF NOT EXISTS `{$g4['shop_mileage_table']}` (
+ `ml_id` INT(11) NOT NULL AUTO_INCREMENT,
+ `mb_id` VARCHAR(255) NOT NULL DEFAULT '',
+ `od_id` BIGINT(20) unsigned NOT NULL,
+ `ct_id` INT(11) NOT NULL DEFAULT '0',
+ `ml_content` VARCHAR(255) NOT NULL DEFAULT '',
+ `ml_point` INT(11) NOT NULL DEFAULT '0',
+ `ml_datetime` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (`ml_id`),
+ KEY `mb_id` (`mb_id`)
+ ) ", false);
+ sql_query(" ALTER TABLE `{$g4['member_table']}`
+ ADD `mb_mileage` INT(11) NOT NULL DEFAULT '0' AFTER `mb_point` ", false);
+ sql_query(" ALTER TABLE `{$g4['shop_item_table']}`
+ ADD `it_point_type` TINYINT(4) NOT NULL DEFAULT '0' AFTER `it_point` ", false);
+}
?>
\ No newline at end of file
diff --git a/install/install_db.php b/install/install_db.php
index 16dbaac96..11d323eb4 100644
--- a/install/install_db.php
+++ b/install/install_db.php
@@ -487,6 +487,7 @@ if($shop_install) {
fwrite($f, "\$g4['shop_onlinecalc_table'] = SHOP_TABLE_PREFIX.'onlinecalc'; // 온라인견적 테이블\n");
fwrite($f, "\$g4['shop_order_table'] = SHOP_TABLE_PREFIX.'order'; // 주문서 테이블\n");
fwrite($f, "\$g4['shop_wish_table'] = SHOP_TABLE_PREFIX.'wish'; // 보관함(위시리스트) 테이블\n");
+ fwrite($f, "\$g4['shop_mileage_table'] = SHOP_TABLE_PREFIX.'mileage'; // 마일리지 테이블\n");
fwrite($f, "?>");
}
diff --git a/install/shop.sql b/install/shop.sql
index 0f7a2b021..30d2c873d 100644
--- a/install/shop.sql
+++ b/install/shop.sql
@@ -384,6 +384,7 @@ CREATE TABLE IF NOT EXISTS `shop_item` (
`it_cust_price` int(11) NOT NULL DEFAULT '0',
`it_price` int(11) NOT NULL DEFAULT '0',
`it_point` int(11) NOT NULL DEFAULT '0',
+ `it_point_type` tinyint(4) NOT NULL DEFAULT '0',
`it_sell_email` varchar(255) NOT NULL DEFAULT '',
`it_use` tinyint(4) NOT NULL DEFAULT '0',
`it_stock_qty` int(11) NOT NULL DEFAULT '0',
@@ -600,6 +601,23 @@ CREATE TABLE IF NOT EXISTS `shop_order` (
-- --------------------------------------------------------
+--
+-- Table structure for table `shop_mileage`
+--
+
+DROP TABLE IF EXISTS `shop_mileage`;
+CREATE TABLE IF NOT EXISTS `shop_mileage` (
+ `ml_id` INT(11) NOT NULL AUTO_INCREMENT,
+ `mb_id` VARCHAR(255) NOT NULL DEFAULT '',
+ `od_id` BIGINT(20) unsigned NOT NULL,
+ `ct_id` INT(11) NOT NULL DEFAULT '0',
+ `ml_content` VARCHAR(255) NOT NULL DEFAULT '',
+ `ml_point` INT(11) NOT NULL DEFAULT '0',
+ `ml_datetime` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (`ml_id`),
+ KEY `mb_id` (`mb_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
--
-- Table structure for table `shop_wish`
--
diff --git a/lib/shop.lib.php b/lib/shop.lib.php
index 9f5c1ddf0..6c5f58779 100644
--- a/lib/shop.lib.php
+++ b/lib/shop.lib.php
@@ -1070,6 +1070,52 @@ function delete_item_thumbnail($dir, $file)
}
}
}
+
+// 마일리지 부여
+function insert_mileage($mb_id, $point, $content='', $od_id, $ct_id)
+{
+ global $g4;
+
+ // 포인트가 없다면 업데이트 할 필요 없음
+ if ($point == 0) { return 0; }
+
+ // 회원아이디가 없다면 업데이트 할 필요 없음
+ if ($mb_id == '') { return 0; }
+ $mb = sql_fetch(" select mb_id from {$g4['member_table']} where mb_id = '$mb_id' ");
+ if (!$mb['mb_id']) { return 0; }
+
+ // 이미 등록된 내역이라면 건너뜀
+ if($od_id && $ct_id) {
+ $sql = " select count(*) as cnt from {$g4['shop_mileage_table']}
+ where mb_id = '$mb_id'
+ and od_id = '$od_id'
+ and ct_id = '$ct_id' ";
+ $row = sql_fetch($sql);
+ if ($row['cnt'])
+ return -1;
+ }
+
+ // 마일리지 건별 생성
+ $sql = " insert into {$g4['shop_mileage_table']}
+ set mb_id = '$mb_id',
+ od_id = '$od_id',
+ ct_id = '$ct_id',
+ ml_content = '".addslashes($content)."',
+ ml_point = '$point',
+ ml_datetime = '".G4_TIME_YMDHIS."' ";
+ sql_query($sql);
+
+ // 포인트 내역의 합을 구하고
+ $sql = " select sum(ml_point) as sum_mileage from {$g4['shop_mileage_table']} where mb_id = '$mb_id' ";
+ $row = sql_fetch($sql);
+ $sum_mileage = $row['sum_mileage'];
+
+ // 포인트 UPDATE
+ $sql = " update {$g4['member_table']} set mb_mileage = '$sum_mileage' where mb_id = '$mb_id' ";
+ sql_query($sql);
+
+ return 1;
+}
//==============================================================================
// 쇼핑몰 함수 모음 끝
//==============================================================================
diff --git a/shop/cartupdate.php b/shop/cartupdate.php
index 5a23f427d..e54e18c12 100644
--- a/shop/cartupdate.php
+++ b/shop/cartupdate.php
@@ -267,7 +267,11 @@ else // 장바구니에 담기
if ((int)$_POST['total_price'] !== (int)$total_price)
die("Error..");
- $point = $it['it_point'];
+ if($it['it_point_type']) {
+ $point = floor(($it['it_price'] * ($it['it_point'] / 100) / 10)) * 10;
+ } else {
+ $point = $it['it_point'];
+ }
// 포인트가 다름
if ((int)$point !== (int)$_POST['it_point'] && $config['cf_use_point'])
die("Error...");
diff --git a/shop/item.php b/shop/item.php
index 05fc471ad..0bcc0597b 100644
--- a/shop/item.php
+++ b/shop/item.php
@@ -319,7 +319,7 @@ else
| 판매가격 |
- 원
+ 원
|
@@ -337,8 +337,16 @@ else
| 포인트 |
- 점
-
+ 점
+
|
|