-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathorderupgrade.php
46 lines (37 loc) · 1.94 KB
/
orderupgrade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
include_once('./_common.php');
if($is_admin != 'super')
alert('최고관리자로 로그인 후 실행해 주십시오.', G5_URL);
$g5['title'] = '장바구니 테이블 업그레이드';
include_once(G5_PATH.'/head.sub.php');
// 배송비정보 필드 cart 테이블에 추가
if(!sql_query(" select it_sc_type from {$g5['g5_shop_cart_table']} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['g5_shop_cart_table']}`
ADD `it_sc_type` tinyint(4) NOT NULL DEFAULT '0' AFTER `it_name`,
ADD `it_sc_method` tinyint(4) NOT NULL DEFAULT '0' AFTER `it_sc_type`,
ADD `it_sc_price` int(11) NOT NULL DEFAULT '0' AFTER `it_sc_method`,
ADD `it_sc_minimum` int(11) NOT NULL DEFAULT '0' AFTER `it_sc_price`,
ADD `it_sc_qty` int(11) NOT NULL DEFAULT '0' AFTER `it_sc_minimum` ", true);
// cart 테이블에 상품의 배송비관련 정보 기록
$sql = " select ct_id, it_id from {$g5['g5_shop_cart_table']} order by ct_id ";
$result = sql_query($sql);
for($i=0; $row=sql_fetch_array($result); $i++) {
$sql = " select it_id, it_sc_type, it_sc_method, it_sc_price, it_sc_minimum, it_sc_qty
from {$g5['g5_shop_item_table']}
where it_id = '{$row['it_id']}' ";
$it = sql_fetch($sql);
if(!$it['it_id'])
continue;
$sql = " update {$g5['g5_shop_cart_table']}
set it_sc_type = '{$it['it_sc_type']}',
it_sc_method = '{$it['it_sc_method']}',
it_sc_price = '{$it['it_sc_price']}',
it_sc_minimum = '{$it['it_sc_minimum']}',
it_sc_qty = '{$it['it_sc_qty']}'
where ct_id = '{$row['ct_id']}' ";
sql_query($sql);
}
echo '<p>장바구니 테이블 업그레이드 완료!</p>';
}
include_once(G5_PATH.'/tail.sub.php');
?>