주문폼 접근 때 재고 체크하도록 수정

This commit is contained in:
chicpro
2014-11-05 17:40:45 +09:00
parent 5e558626da
commit de2b734362
9 changed files with 235 additions and 44 deletions

View File

@ -2138,12 +2138,38 @@ 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' ");
// ct_select_time이 기준시간 이상 경과된 경우 변경
if(defined('G5_CART_STOCK_LIMIT'))
$cart_stock_limit = G5_CART_STOCK_LIMIT;
else
$cart_stock_limit = 3;
$stocktime = 0;
if($cart_stock_limit > 0) {
if($cart_stock_limit > $keep_term * 24)
$cart_stock_limit = $keep_term * 24;
$stocktime = G5_SERVER_TIME - (3600 * $cart_stock_limit);
$sql = " update {$g5['g5_shop_cart_table']}
set ct_select = '0'
where ct_select = '1'
and ct_status = '쇼핑'
and UNIX_TIMESTAMP(ct_select_time) < '$stocktime' ";
sql_query($sql);
}
// 설정 시간이상 경과된 상품 삭제
$statustime = G5_SERVER_TIME - (86400 * $keep_term);
$sql = " delete from {$g5['g5_shop_cart_table']}
where ct_status = '쇼핑'
and UNIX_TIMESTAMP(ct_time) < '$statustime' ";
sql_query($sql);
}
//==============================================================================