diff --git a/js/shop.js b/js/shop.js
new file mode 100644
index 000000000..e54a22459
--- /dev/null
+++ b/js/shop.js
@@ -0,0 +1,5 @@
+// php chr() 대응
+function chr(code)
+{
+ return String.fromCharCode(code);
+}
\ No newline at end of file
diff --git a/lib/shop.lib.php b/lib/shop.lib.php
index 343a6f1a4..7403a2ce8 100644
--- a/lib/shop.lib.php
+++ b/lib/shop.lib.php
@@ -502,43 +502,123 @@ function session_check()
gotourl(G4_SHOP_URL);
}
-// 상품 옵션
-function get_item_options($subject, $option, $index)
+// 상품 선택옵션
+function get_item_options($it_id, $subject)
{
- $subject = trim($subject);
- $option = trim($option);
+ global $g4;
- if (!$subject || !$option) return '';
+ if(!$it_id || !$subject)
+ return '';
+
+ $sql = " select * from {$g4['shop_item_option_table']} where io_type = '0' and it_id = '$it_id' and io_use = '1' order by io_no asc ";
+ $result = sql_query($sql);
+ if(!mysql_num_rows($result))
+ return '';
$str = '';
+ $subj = explode(',', $subject);
+ $subj_count = count($subj);
+ $options = array();
- $arr = explode("\n", $option);
- // 옵션이 하나일 경우
- if (count($arr) == 1)
- {
- $str = '';
+ // 옵션항목 배열에 저장
+ for($i=0; $row=sql_fetch_array($result); $i++) {
+ $opt_id = explode(chr(30), $row['io_id']);
+
+ for($k=0; $k<$subj_count; $k++) {
+ if(!is_array($options[$k]))
+ $options[$k] = array();
+
+ if($opt_id[$k] && !in_array($opt_id[$k], $options[$k]))
+ $options[$k][] = $opt_id[$k];
+ }
}
- else
- {
- $str = ''.PHP_EOL.''.PHP_EOL;
}
return $str;
diff --git a/shop/item.php b/shop/item.php
index cac9d9147..1ca2fc2e4 100644
--- a/shop/item.php
+++ b/shop/item.php
@@ -273,22 +273,6 @@ else
- '.PHP_EOL;
- echo '
| '.PHP_EOL;
- echo ''.$str.' | '.PHP_EOL;
- echo ''.PHP_EOL;
- }
- }
- ?>
-
@@ -334,6 +318,14 @@ else
+
+
+
+
| 수량 |
|