보관기간 지난 장바구니 상품 삭제 코드 변경

This commit is contained in:
chicpro
2014-10-31 13:23:22 +09:00
parent c38349b2e4
commit 75490c8767
6 changed files with 19 additions and 31 deletions

View File

@ -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("완료");

View File

@ -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' ");
}
//==============================================================================
// 쇼핑몰 라이브러리 모음 끝
//==============================================================================

View File

@ -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);

View File

@ -1,6 +1,9 @@
<?php
include_once('./_common.php');
// 보관기간이 지난 상품 삭제
cart_item_clean();
// cart id 설정
set_cart_id($sw_direct);
@ -63,10 +66,6 @@ include_once('./_head.php');
b.ca_id3
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' ";
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);

View File

@ -3,6 +3,9 @@ include_once('./_common.php');
// print_r2($_POST); exit;
// 보관기간이 지난 상품 삭제
cart_item_clean();
// cart id 설정
set_cart_id($sw_direct);

View File

@ -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);