diff --git a/adm/shop_admin/orderform.php b/adm/shop_admin/orderform.php index 1dc5e6e69..d99f693d7 100644 --- a/adm/shop_admin/orderform.php +++ b/adm/shop_admin/orderform.php @@ -10,16 +10,6 @@ auth_check($auth[$sub_menu], "w"); $g5['title'] = "주문 내역 수정"; include_once(G5_ADMIN_PATH.'/admin.head.php'); -//------------------------------------------------------------------------------ -// 설정 시간이 지난 주문서 없는 장바구니 자료 삭제 -//------------------------------------------------------------------------------ -$keep_term = $default['de_cart_keep_term']; -if (!$keep_term) $keep_term = 15; // 기본값 15일 -$beforetime = date('Y-m-d', ( G5_SERVER_TIME - (86400 * $keep_term) ) ); -$sql = " delete from {$g5['g5_shop_cart_table']} where ct_status = '쇼핑' and substring(ct_time, 1, 10) < '$beforetime' "; -sql_query($sql); -//------------------------------------------------------------------------------ - // 완료된 주문에 포인트를 적립한다. save_order_point("완료"); diff --git a/lib/shop.lib.php b/lib/shop.lib.php index f31a144e3..044776ce1 100644 --- a/lib/shop.lib.php +++ b/lib/shop.lib.php @@ -336,10 +336,6 @@ function get_cart_count($cart_id) global $g5, $default; $sql = " select count(ct_id) as cnt from {$g5['g5_shop_cart_table']} where od_id = '$cart_id' "; - if($default['de_cart_keep_term']) { - $ctime = date('Y-m-d', G5_SERVER_TIME - ($default['de_cart_keep_term'] * 86400)); - $sql .= " and substring(ct_time, 1, 10) >= '$ctime' "; - } $row = sql_fetch($sql); $cnt = (int)$row['cnt']; return $cnt; @@ -1342,11 +1338,6 @@ function set_cart_id($direct) where mb_id = '{$member['mb_id']}' and ct_direct = '0' and ct_status = '쇼핑' "; - if($default['de_cart_keep_term']) { - $ctime = date('Y-m-d', G5_SERVER_TIME - ($default['de_cart_keep_term'] * 86400)); - $sql .= " and substring(ct_time, 1, 10) >= '$ctime' "; - } - sql_query($sql); } } @@ -2142,6 +2133,19 @@ function get_itemuselist_thumbnail($it_id, $contents, $thumb_width, $thumb_heigh return $img; } +// 장바구니 상품삭제 +function cart_item_clean() +{ + global $g5, $default; + + $keep_term = $default['de_cart_keep_term']; + if(!$keep_term) + $keep_term = 15; // 기본값 15일 + $beforetime = G5_SERVER_TIME - (86400 * $keep_term); + + sql_query(" delete from {$g5['g5_shop_cart_table']} where ct_status = '쇼핑' and UNIX_TIMESTAMP(ct_time) < '$beforetime' "); +} + //============================================================================== // 쇼핑몰 라이브러리 모음 끝 //============================================================================== diff --git a/mobile/shop/orderform.php b/mobile/shop/orderform.php index e801a646d..77f4ed9ce 100644 --- a/mobile/shop/orderform.php +++ b/mobile/shop/orderform.php @@ -65,10 +65,6 @@ ob_start(); from {$g5['g5_shop_cart_table']} a left join {$g5['g5_shop_item_table']} b on ( a.it_id = b.it_id ) where a.od_id = '$s_cart_id' and a.ct_select = '1' "; - if($default['de_cart_keep_term']) { - $ctime = date('Y-m-d', G5_SERVER_TIME - ($default['de_cart_keep_term'] * 86400)); - $sql .= " and substring(a.ct_time, 1, 10) >= '$ctime' "; - } $sql .= " group by a.it_id "; $sql .= " order by a.ct_id "; $result = sql_query($sql); diff --git a/shop/cart.php b/shop/cart.php index ec799ea14..39395067f 100644 --- a/shop/cart.php +++ b/shop/cart.php @@ -1,6 +1,9 @@ = '$ctime' "; - } $sql .= " group by a.it_id "; $sql .= " order by a.ct_id "; $result = sql_query($sql); diff --git a/shop/cartupdate.php b/shop/cartupdate.php index 6ae9a87cf..c00c6f8a9 100644 --- a/shop/cartupdate.php +++ b/shop/cartupdate.php @@ -3,6 +3,9 @@ include_once('./_common.php'); // print_r2($_POST); exit; +// 보관기간이 지난 상품 삭제 +cart_item_clean(); + // cart id 설정 set_cart_id($sw_direct); diff --git a/shop/orderform.php b/shop/orderform.php index 6685a7ca8..968ab1b7c 100644 --- a/shop/orderform.php +++ b/shop/orderform.php @@ -96,10 +96,6 @@ require_once('./'.$default['de_pg_service'].'/orderform.1.php'); from {$g5['g5_shop_cart_table']} a left join {$g5['g5_shop_item_table']} b on ( a.it_id = b.it_id ) where a.od_id = '$s_cart_id' and a.ct_select = '1' "; - if($default['de_cart_keep_term']) { - $ctime = date('Y-m-d', G5_SERVER_TIME - ($default['de_cart_keep_term'] * 86400)); - $sql .= " and substring(a.ct_time, 1, 10) >= '$ctime' "; - } $sql .= " group by a.it_id "; $sql .= " order by a.ct_id "; $result = sql_query($sql);