diff --git a/adm/shop_admin/itemformupdate.php b/adm/shop_admin/itemformupdate.php index b4ae6a454..52f0e59cd 100644 --- a/adm/shop_admin/itemformupdate.php +++ b/adm/shop_admin/itemformupdate.php @@ -305,26 +305,25 @@ sql_query(" delete from {$g4['shop_item_option_table']} where io_type = '0' and $option_count = count($_POST['opt_id']); if($option_count) { - // 실재하는 1차 옵션항목 - $arr_opt1 = array(); - $opt2_cnt = $opt3_cnt = 0; + // 옵션명 + $opt1_cnt = $opt2_cnt = $opt3_cnt = 0; for($i=0; $i<$option_count; $i++) { $opt_val = explode(chr(30), $_POST['opt_id'][$i]); - if(!in_array($opt_val[0], $arr_opt1)) - $arr_opt1[] = $opt_val[0]; + if($opt_val[0]) + $opt1_cnt++; if($opt_val[1]) $opt2_cnt++; if($opt_val[2]) $opt3_cnt++; } - $it_option_subject = $opt1_subject; - if($opt2_subject && $opt2_cnt) - $it_option_subject .= ','.$opt2_subject; - if($opt3_subject && $opt3_cnt) - $it_option_subject .= ','.$opt3_subject; - - $it_option = implode(',', $arr_opt1); + if($opt1_subject && $opt1_cnt) { + $it_option_subject = $opt1_subject; + if($opt2_subject && $opt2_cnt) + $it_option_subject .= ','.$opt2_subject; + if($opt3_subject && $opt3_cnt) + $it_option_subject .= ','.$opt3_subject; + } } // 추가옵션 @@ -360,7 +359,6 @@ $sql_common = " ca_id = '$ca_id', it_maker = '$it_maker', it_origin = '$it_origin', it_option_subject = '$it_option_subject', - it_option = '$it_option', it_supply_subject = '$it_supply_subject', it_type1 = '$it_type1', it_type2 = '$it_type2', diff --git a/lib/shop.lib.php b/lib/shop.lib.php index 7403a2ce8..ac4cbd1cf 100644 --- a/lib/shop.lib.php +++ b/lib/shop.lib.php @@ -518,46 +518,67 @@ function get_item_options($it_id, $subject) $str = ''; $subj = explode(',', $subject); $subj_count = count($subj); - $options = array(); - // 옵션항목 배열에 저장 - for($i=0; $row=sql_fetch_array($result); $i++) { - $opt_id = explode(chr(30), $row['io_id']); + if($subj_count > 1) { + $options = array(); - for($k=0; $k<$subj_count; $k++) { - if(!is_array($options[$k])) - $options[$k] = array(); + // 옵션항목 배열에 저장 + for($i=0; $row=sql_fetch_array($result); $i++) { + $opt_id = explode(chr(30), $row['io_id']); - if($opt_id[$k] && !in_array($opt_id[$k], $options[$k])) - $options[$k][] = $opt_id[$k]; - } - } + for($k=0; $k<$subj_count; $k++) { + if(!is_array($options[$k])) + $options[$k] = array(); - // 옵션선택목록 만들기 - for($i=0; $i<$subj_count; $i++) { - $opt = $options[$i]; - $opt_count = count($opt); - $disabled = ''; - if($opt_count) { - $seq = $i + 1; - if($i > 0) - $disabled = ' disabled="disabled"'; - $str .= ''.PHP_EOL; - $str .= ''.PHP_EOL; - - $select = ''.PHP_EOL; - - $str .= ''.$select.''.PHP_EOL; - $str .= ''.PHP_EOL; } + + // 옵션선택목록 만들기 + for($i=0; $i<$subj_count; $i++) { + $opt = $options[$i]; + $opt_count = count($opt); + $disabled = ''; + if($opt_count) { + $seq = $i + 1; + if($i > 0) + $disabled = ' disabled="disabled"'; + $str .= ''.PHP_EOL; + $str .= ''.PHP_EOL; + + $select = ''.PHP_EOL; + + $str .= ''.$select.''.PHP_EOL; + $str .= ''.PHP_EOL; + } + } + } else { + $str .= ''.PHP_EOL; + $str .= ''.PHP_EOL; + + $select = ''.PHP_EOL; + + $str .= ''.$select.''.PHP_EOL; + $str .= ''.PHP_EOL; } return $str; @@ -593,8 +614,14 @@ function get_item_supply($it_id, $subject) if($opt_id[0] && !array_key_exists($opt_id[0], $options)) $options[$opt_id[0]] = array(); - if($opt_id[1] && !in_array($opt_id[1], $options[$opt_id[0]])) - $options[$opt_id[0]][] = $opt_id[1]; + if($opt_id[1]) { + if($row['io_price'] >= 0) + $price = '  + '.number_format($row['io_price']).'원'; + else + $price = '   '.number_format($row['io_price']).'원'; + + $options[$opt_id[0]][] = ''; + } } // 옵션항목 만들기 @@ -611,7 +638,7 @@ function get_item_supply($it_id, $subject) for($k=0; $k<$opt_count; $k++) { $opt_val = $opt[$k]; if($opt_val) { - $select .= ''.PHP_EOL; + $select .= $opt_val.PHP_EOL; } } $select .= ''.PHP_EOL; diff --git a/shop/item.php b/shop/item.php index 1ca2fc2e4..b5bb78df4 100644 --- a/shop/item.php +++ b/shop/item.php @@ -171,6 +171,7 @@ function pg_anchor($anc_id) { + + + +
+ + + + 수량 diff --git a/shop/itemoption.php b/shop/itemoption.php new file mode 100644 index 000000000..80068fd33 --- /dev/null +++ b/shop/itemoption.php @@ -0,0 +1,40 @@ +선택'; +$opt = array(); + +for($i=0; $row=sql_fetch_array($result); $i++) { + $val = explode(chr(30), $row['io_id']); + $key = $idx + 1; + + if(!$val[$key]) + continue; + + if(in_array($val[$key], $opt)) + continue; + + $opt[] = $val[$key]; + + if($key + 1 < $sel_count) { + $str .= PHP_EOL.''; + } else { + if($row['io_price'] >= 0) + $price = '  + '.number_format($row['io_price']).'원'; + else + $price = '   '.number_format($row['io_price']).'원'; + + $str .= PHP_EOL.'