diff --git a/extend/shop.extend2.php b/extend/shop.extend2.php index 4b3ff5664..30770d30e 100644 --- a/extend/shop.extend2.php +++ b/extend/shop.extend2.php @@ -254,4 +254,15 @@ if(!$result) { KEY `mb_id` (`mb_id`) )", false); } + +// 쿠폰관련필드 추가 +$sql = " select cp_amount from {$g4['shop_cart_table']} limit 1 "; +$result = sql_query($sql, false); +if(!$result) { + sql_query(" ALTER TABLE `{$g4['shop_cart_table']}` + ADD `cp_amount` INT(11) NOT NULL DEFAULT '0' AFTER `ct_point` ", false); + sql_query(" ALTER TABLE `{$g4['shop_order_table']}` + ADD `od_coupon` INT(11) NOT NULL DEFAULT '0' AFTER `od_dc_amount`, + ADD `od_send_coupon` INT(11) NOT NULL DEFAULT '0' AFTER `od_send_cost` ", false); +} ?> \ No newline at end of file diff --git a/install/shop.sql b/install/shop.sql index 99dca6aa8..5f27ffc1a 100644 --- a/install/shop.sql +++ b/install/shop.sql @@ -63,6 +63,7 @@ CREATE TABLE IF NOT EXISTS `shop_cart` ( `ct_history` text NOT NULL, `ct_price` int(11) NOT NULL DEFAULT '0', `ct_point` int(11) NOT NULL DEFAULT '0', + `cp_amount` int(11) NOT NULL DEFAULT '0', `ct_point_use` tinyint(4) NOT NULL DEFAULT '0', `ct_stock_use` tinyint(4) NOT NULL DEFAULT '0', `ct_option` varchar(255) NOT NULL DEFAULT '', @@ -588,6 +589,7 @@ CREATE TABLE IF NOT EXISTS `shop_order` ( `od_b_addr2` varchar(100) NOT NULL DEFAULT '', `od_memo` text NOT NULL, `od_send_cost` int(11) NOT NULL DEFAULT '0', + `od_send_coupon` int(11) NOT NULL DEFAULT '0', `od_temp_bank` int(11) NOT NULL DEFAULT '0', `od_temp_card` int(11) NOT NULL DEFAULT '0', `od_temp_hp` int(11) NOT NULL, @@ -602,6 +604,7 @@ CREATE TABLE IF NOT EXISTS `shop_order` ( `od_hp_time` datetime NOT NULL, `od_cancel_card` int(11) NOT NULL DEFAULT '0', `od_dc_amount` int(11) NOT NULL DEFAULT '0', + `od_coupon` int(11) NOT NULL DEFAULT '0', `od_refund_amount` int(11) NOT NULL DEFAULT '0', `od_shop_memo` text NOT NULL, `dl_id` int(11) NOT NULL DEFAULT '0', diff --git a/lib/shop.lib.php b/lib/shop.lib.php index fc343fa27..366f6e97e 100644 --- a/lib/shop.lib.php +++ b/lib/shop.lib.php @@ -1139,6 +1139,28 @@ function get_coupon_id() return $str; } + +// array_map() 대체 +function array_add_callback($func, $array) +{ + if(!$func) { + return; + } + + if(is_array($array)) { + foreach($array as $key => $value) { + if(is_array($value)) { + $array[$key] = array_add_callback($func, $value); + } else { + $array[$key] = call_user_func($func, $value); + } + } + } else { + $array = call_user_func($func, $array); + } + + return $array; +} //============================================================================== // 쇼핑몰 함수 모음 끝 //============================================================================== diff --git a/shop/cart.php b/shop/cart.php index 5f5408684..0308070d5 100644 --- a/shop/cart.php +++ b/shop/cart.php @@ -29,18 +29,269 @@ if (G4_IS_MOBILE) { $g4['title'] = '장바구니'; include_once('./_head.php'); +$s_uq_id = get_session('ss_uq_id'); ?> + +