diff --git a/install/shop.sql b/install/shop.sql
index f0eeaf103..004dd05fe 100644
--- a/install/shop.sql
+++ b/install/shop.sql
@@ -74,6 +74,7 @@ CREATE TABLE IF NOT EXISTS `shop_cart` (
`ct_ip` varchar(25) NOT NULL DEFAULT '',
`ct_send_cost` varchar(255) NOT NULL,
`ct_direct` tinyint(4) NOT NULL,
+ `ct_order` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`ct_id`),
KEY `uq_id` (`uq_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
diff --git a/lib/shop.lib.php b/lib/shop.lib.php
index 009804a76..116714e5c 100644
--- a/lib/shop.lib.php
+++ b/lib/shop.lib.php
@@ -683,14 +683,17 @@ function print_item_options($it_id, $uq_id)
{
global $g4;
- $sql = " select ct_option from {$g4['shop_cart_table']} where it_id = '$it_id' and uq_id = '$uq_id' order by io_type asc, ct_num asc, ct_id asc ";
+ $sql = " select ct_option, ct_qty
+ from {$g4['shop_cart_table']}
+ where it_id = '$it_id' and uq_id = '$uq_id'
+ order by io_type asc, ct_num asc, ct_id asc ";
$result = sql_query($sql);
$str = '';
for($i=0; $row=sql_fetch_array($result); $i++) {
if($i == 0)
$str .= '
'.PHP_EOL;
- $str .= '- '.$row['ct_option'].'
'.PHP_EOL;
+ $str .= '- '.$row['ct_option'].' '.$row['ct_qty'].'개
'.PHP_EOL;
}
if($i > 0)
diff --git a/shop/cartoption.php b/shop/cartoption.php
index d1fc9a836..a64d41ee7 100644
--- a/shop/cartoption.php
+++ b/shop/cartoption.php
@@ -33,6 +33,7 @@ if(!mysql_num_rows($result))
+
-
| 품명 |
옵션 |
상태 |
- 수량 |
@@ -44,7 +42,6 @@ $ft_a_st = 'display:block;padding:30px 0;background:#484848;color:#fff;text-alig
|
|
|
- |
diff --git a/shop/mail/orderupdate1.mail.php b/shop/mail/orderupdate1.mail.php
index d4b084a9f..23690fd7c 100644
--- a/shop/mail/orderupdate1.mail.php
+++ b/shop/mail/orderupdate1.mail.php
@@ -48,10 +48,6 @@ $ft_a_st = 'display:block;padding:30px 0;background:#484848;color:#fff;text-alig
판매가격 |
|
-
- | 수량 |
- 개 |
-
| 소계 |
|
diff --git a/shop/mail/orderupdate2.mail.php b/shop/mail/orderupdate2.mail.php
index 262ceebbf..ac2fd4a75 100644
--- a/shop/mail/orderupdate2.mail.php
+++ b/shop/mail/orderupdate2.mail.php
@@ -48,10 +48,6 @@ $ft_a_st = 'display:block;padding:30px 0;background:#484848;color:#fff;text-alig
판매가격 |
|
-
- | 수량 |
- 개 |
-
| 소계 |
|
diff --git a/shop/mail/orderupdate3.mail.php b/shop/mail/orderupdate3.mail.php
index 3688a91a3..086edd958 100644
--- a/shop/mail/orderupdate3.mail.php
+++ b/shop/mail/orderupdate3.mail.php
@@ -47,10 +47,6 @@ $ft_a_st = 'display:block;padding:30px 0;background:#484848;color:#fff;text-alig
판매가격 |
|
-
- | 수량 |
- 개 |
-
diff --git a/shop/orderformupdate.php b/shop/orderformupdate.php
index c3bb21e75..caa46d2d6 100644
--- a/shop/orderformupdate.php
+++ b/shop/orderformupdate.php
@@ -20,22 +20,26 @@ if (get_cart_count($tmp_uq_id) == 0)// 장바구니에 담기
$error = "";
// 장바구니 상품 재고 검사
-// 1.03.07 : and a.it_id = b.it_id : where 조건문에 이 부분 추가
-$sql = " select a.it_id,
- a.ct_qty,
- a.it_name
- from {$g4['shop_cart_table']} a,
- {$g4['shop_item_table']} b
- where a.uq_id = '$tmp_uq_id'
- and a.it_id = b.it_id ";
+$sql = " select it_id,
+ ct_qty,
+ it_name,
+ io_id,
+ io_type,
+ ct_option
+ from {$g4['shop_cart_table']}
+ where uq_id = '$tmp_uq_id' ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
// 상품에 대한 현재고수량
- $it_stock_qty = (int)get_it_stock_qty($row['it_id']);
+ if($row['io_id']) {
+ $it_stock_qty = (int)get_option_stock_qty($row['it_id'], $row['io_id'], $row['io_type']);
+ } else {
+ $it_stock_qty = (int)get_it_stock_qty($row['it_id']);
+ }
// 장바구니 수량이 재고수량보다 많다면 오류
if ($row['ct_qty'] > $it_stock_qty)
- $error .= "{$row['it_name']} 의 재고수량이 부족합니다. 현재고수량 : $it_stock_qty 개\\n\\n";
+ $error .= "{$row['ct_option']} 의 재고수량이 부족합니다. 현재고수량 : $it_stock_qty 개\\n\\n";
}
if ($error != "")
@@ -50,7 +54,8 @@ $i_temp_point = (int)$_POST['od_temp_point'];
// 주문금액이 상이함
-$sql = " select SUM(ct_price * ct_qty) as od_amount from {$g4['shop_cart_table']} where uq_id = '$tmp_uq_id' ";
+$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as od_amount
+ from {$g4['shop_cart_table']} where uq_id = '$tmp_uq_id' ";
$row = sql_fetch($sql);
if ((int)$row['od_amount'] !== $i_amount) {
die("Error.");
diff --git a/shop/ordermail1.inc.php b/shop/ordermail1.inc.php
index 05a011bc6..5ab60015a 100644
--- a/shop/ordermail1.inc.php
+++ b/shop/ordermail1.inc.php
@@ -10,35 +10,37 @@ $ttotal_point = 0;
// 메일보내기
//------------------------------------------------------------------------------
// Loop 배열 자료를 만들고
-$sql = " select b.it_sell_email,
- a.it_id,
+$sql = " select a.it_id,
a.it_name,
- b.it_origin,
- a.it_opt1,
- a.it_opt2,
- a.it_opt3,
- a.it_opt4,
- a.it_opt5,
- a.it_opt6,
a.ct_qty,
a.ct_price,
- a.ct_point
- from {$g4['shop_cart_table']} a, {$g4['shop_item_table']} b
+ a.ct_point,
+ b.it_sell_email,
+ b.it_origin
+ from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
where a.uq_id = '$tmp_uq_id'
- and a.it_id = b.it_id ";
+ and a.ct_num = '0' ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
+ // 합계금액 계산
+ $sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
+ SUM(ct_point * ct_qty) as point,
+ SUM(ct_qty) as qty
+ from {$g4['shop_cart_table']}
+ where it_id = '{$row['it_id']}'
+ and uq_id = '$tmp_uq_id' ";
+ $sum = sql_fetch($sql);
+
$list[$i]['g_dir'] = G4_URL;
$list[$i]['it_id'] = $row['it_id'];
$list[$i]['it_simg'] = get_it_image($row['it_id'], $default['de_simg_width'], $default['de_simg_height']);
$list[$i]['it_name'] = $row['it_name'];
$list[$i]['it_origin'] = $row['it_origin'];
- $list[$i]['it_opt'] = print_item_options($row['it_id'], $row['it_opt1'], $row['it_opt2'], $row['it_opt3'], $row['it_opt4'], $row['it_opt5'], $row['it_opt6']);
- $list[$i]['ct_qty'] = $row['ct_qty'];
+ $list[$i]['it_opt'] = print_item_options($row['it_id'], $tmp_uq_id);
$list[$i]['ct_price'] = $row['ct_price'];
- $list[$i]['stotal_amount'] = $row['ct_price'] * $row['ct_qty'];
- $list[$i]['stotal_point'] = $row['ct_point'] * $row['ct_qty'];
+ $list[$i]['stotal_amount'] = $sum['price'];
+ $list[$i]['stotal_point'] = $sum['point'];
$ttotal_amount += $list[$i]['stotal_amount'];
$ttotal_point += $list[$i]['stotal_point'];
diff --git a/shop/ordermail2.inc.php b/shop/ordermail2.inc.php
index b582a734a..9cdb9d310 100644
--- a/shop/ordermail2.inc.php
+++ b/shop/ordermail2.inc.php
@@ -36,17 +36,10 @@ mailer($config['cf_title'], $admin['mb_email'], $od_email, $subject, $content, 1
$sql = " select b.it_sell_email,
a.it_id,
- a.it_name,
- a.it_opt1,
- a.it_opt2,
- a.it_opt3,
- a.it_opt4,
- a.it_opt5,
- a.it_opt6,
- a.ct_qty
- from {$g4['shop_cart_table']} a, {$g4['shop_item_table']} b
+ a.it_name
+ from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
where a.uq_id = '$tmp_uq_id'
- and a.it_id = b.it_id
+ and a.ct_num = '0'
and b.it_sell_email <> '' ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
@@ -56,8 +49,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
$list['it_id'] = $row['it_id'];
$list['it_simg'] = get_it_image($row['it_id'], $default['de_simg_width'], $default['de_simg_height']);
$list['it_name'] = $row['it_name'];
- $list['it_opt'] = print_item_options($row['it_id'], $row['it_opt1'], $row['it_opt2'], $row['it_opt3'], $row['it_opt4'], $row['it_opt5'], $row['it_opt6']);
- $list['ct_qty'] = $row['ct_qty'];
+ $list['it_opt'] = print_item_options($row['it_id'], $tmp_uq_id);
$subject = $config['cf_title'].' - 주문 알림 메일 (주문자 '.$od_name.'님)';
ob_start();