#274 모바일 상품명 적용, it_mobile_name 을 상품테이블에 추가하세요.
This commit is contained in:
@ -1,50 +0,0 @@
|
||||
<?php
|
||||
$sub_menu = '400300';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check($auth[$sub_menu], "r");
|
||||
|
||||
$g4['title'] = '상품 복사';
|
||||
include_once(G4_PATH.'/head.sub.php');
|
||||
?>
|
||||
|
||||
<form name="fitemcopy">
|
||||
<div class="cbox">
|
||||
<h1>상품 복사</h1>
|
||||
|
||||
<table class="frm_tbl">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="new_it_id">상품코드</label></th>
|
||||
<td><input type="text" name="new_it_id" value="<?php echo time(); ?>" id="new_it_id" class="frm_input" maxlength="20"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="btn_confirm">
|
||||
<input type="button" value="복사하기" class="btn_submit" onclick="_copy('item_copy_update.php?it_id=<?php echo $it_id; ?>&ca_id=<?php echo $ca_id; ?>');">
|
||||
<button type="button" onclick="self.close();">창닫기</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
// <![CDATA[
|
||||
function _copy(link)
|
||||
{
|
||||
var new_it_id = document.getElementById('new_it_id').value;
|
||||
var t_it_id = new_it_id.replace(/[A-Za-z0-9\-_]/g, "");
|
||||
if(t_it_id.length > 0) {
|
||||
alert("상품코드는 영문자, 숫자, -, _ 만 사용할 수 있습니다.");
|
||||
return false;
|
||||
}
|
||||
opener.parent.location.href = encodeURI(link+'&new_it_id='+new_it_id);
|
||||
self.close();
|
||||
}
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G4_PATH.'/tail.sub.php');
|
||||
?>
|
||||
@ -1,164 +0,0 @@
|
||||
<?php
|
||||
$sub_menu = '400300';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check($auth[$sub_menu], "w");
|
||||
|
||||
if ($is_admin != "super")
|
||||
alert("최고관리자만 접근 가능합니다.");
|
||||
|
||||
if (!trim($it_id))
|
||||
alert("복사할 상품코드가 없습니다.");
|
||||
|
||||
$t_it_id = preg_replace("/[A-Za-z0-9\-_]/", "", $new_it_id);
|
||||
if($t_it_id)
|
||||
alert("상품코드는 영문자, 숫자, -, _ 만 사용할 수 있습니다.");
|
||||
|
||||
$row = sql_fetch(" select count(*) as cnt from {$g4['shop_item_table']} where it_id = '$new_it_id' ");
|
||||
if ($row['cnt'])
|
||||
alert('이미 존재하는 상품코드 입니다.');
|
||||
|
||||
$sql = " select * from {$g4['shop_item_table']} where it_id = '$it_id' limit 1 ";
|
||||
$cp = sql_fetch($sql);
|
||||
|
||||
|
||||
// 상품테이블의 필드가 추가되어도 수정하지 않도록 필드명을 추출하여 insert 퀴리를 생성한다. (상품코드만 새로운것으로 대체)
|
||||
$sql_common = "";
|
||||
$fields = mysql_list_fields(G4_MYSQL_DB, $g4['shop_item_table']);
|
||||
$columns = mysql_num_fields($fields);
|
||||
for ($i = 0; $i < $columns; $i++) {
|
||||
$fld = mysql_field_name($fields, $i);
|
||||
if ($fld != 'it_id') {
|
||||
$sql_common .= " , $fld = '".addslashes($cp[$fld])."' ";
|
||||
}
|
||||
}
|
||||
|
||||
$sql = " insert {$g4['shop_item_table']}
|
||||
set it_id = '$new_it_id'
|
||||
$sql_common ";
|
||||
sql_query($sql);
|
||||
|
||||
// 선택/추가 옵션 copy
|
||||
$opt_sql = " insert ignore into {$g4['shop_item_option_table']} ( io_id, io_type, it_id, io_price, io_stock_qty, io_noti_qty, io_use )
|
||||
select io_id, io_type, '$new_it_id', io_price, io_stock_qty, io_noti_qty, io_use
|
||||
from {$g4['shop_item_option_table']}
|
||||
where it_id = '$it_id'
|
||||
order by io_no asc ";
|
||||
sql_query($opt_sql);
|
||||
|
||||
// html 에디터로 첨부된 이미지 파일 복사
|
||||
if($cp['it_explan']) {
|
||||
$matchs = get_editor_image($cp['it_explan']);
|
||||
|
||||
// 파일의 경로를 얻어 복사
|
||||
for($i=0;$i<count($matchs[1]);$i++) {
|
||||
$p = parse_url($matchs[1][$i]);
|
||||
if(strpos($p['path'], "/data/") != 0)
|
||||
$src_path = preg_replace("/^\/.*\/data/", "/data", $p['path']);
|
||||
else
|
||||
$src_path = $p['path'];
|
||||
|
||||
$srcfile = G4_PATH.$src_path;
|
||||
$dstfile = preg_replace("/\.([^\.]+)$/", "_".$new_it_id.".\\1", $srcfile);
|
||||
|
||||
if(is_file($srcfile)) {
|
||||
copy($srcfile, $dstfile);
|
||||
|
||||
$newfile = preg_replace("/\.([^\.]+)$/", "_".$new_it_id.".\\1", $matchs[1][$i]);
|
||||
$cp['it_explan'] = str_replace($matchs[1][$i], $newfile, $cp['it_explan']);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = " update {$g4['shop_item_table']} set it_explan = '{$cp['it_explan']}' where it_id = '$new_it_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
if($cp['it_mobile_explan']) {
|
||||
$matchs = get_editor_image($cp['it_mobile_explan']);
|
||||
|
||||
// 파일의 경로를 얻어 복사
|
||||
for($i=0;$i<count($matchs[1]);$i++) {
|
||||
$p = parse_url($matchs[1][$i]);
|
||||
if(strpos($p['path'], "/data/") != 0)
|
||||
$src_path = preg_replace("/^\/.*\/data/", "/data", $p['path']);
|
||||
else
|
||||
$src_path = $p['path'];
|
||||
|
||||
$srcfile = G4_PATH.$src_path;
|
||||
$dstfile = preg_replace("/\.([^\.]+)$/", "_".$new_it_id.".\\1", $srcfile);
|
||||
|
||||
if(is_file($srcfile)) {
|
||||
copy($srcfile, $dstfile);
|
||||
|
||||
$newfile = preg_replace("/\.([^\.]+)$/", "_".$new_it_id.".\\1", $matchs[1][$i]);
|
||||
$cp['it_mobile_explan'] = str_replace($matchs[1][$i], $newfile, $cp['it_mobile_explan']);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = " update {$g4['shop_item_table']} set it_mobile_explan = '{$cp['it_mobile_explan']}' where it_id = '$new_it_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
// 상품이미지 복사
|
||||
function copy_directory($src_dir, $dest_dir)
|
||||
{
|
||||
if($src_dir == $dest_dir)
|
||||
return false;
|
||||
|
||||
if(!is_dir($src_dir))
|
||||
return false;
|
||||
|
||||
if(!is_dir($dest_dir)) {
|
||||
@mkdir($dest_dir, 0707);
|
||||
@chmod($dest_dir, 0707);
|
||||
}
|
||||
|
||||
$dir = opendir($src_dir);
|
||||
while (false !== ($filename = readdir($dir))) {
|
||||
if($filename == "." || $filename == "..")
|
||||
continue;
|
||||
|
||||
$files[] = $filename;
|
||||
}
|
||||
|
||||
for($i=0; $i<count($files); $i++) {
|
||||
$src_file = $src_dir.'/'.$files[$i];
|
||||
$dest_file = $dest_dir.'/'.$files[$i];
|
||||
if(is_file($src_file)) {
|
||||
copy($src_file, $dest_file);
|
||||
@chmod($dest_file, 0606);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 파일복사
|
||||
$dest_path = G4_DATA_PATH.'/item/'.$new_it_id;
|
||||
@mkdir($dest_path, 0707);
|
||||
@chmod($dest_path, 0707);
|
||||
$comma = '';
|
||||
$sql_img = '';
|
||||
|
||||
for($i=1; $i<=10; $i++) {
|
||||
$file = G4_DATA_PATH.'/item/'.$cp['it_img'.$i];
|
||||
$new_img = '';
|
||||
|
||||
if(is_file($file)) {
|
||||
$dstfile = $dest_path.'/'.basename($file);
|
||||
copy($file, $dstfile);
|
||||
@chmod($dstfile, 0606);
|
||||
$new_img = $new_it_id.'/'.basename($file);
|
||||
}
|
||||
|
||||
$sql_img .= $comma." it_img{$i} = '$new_img' ";
|
||||
$comma = ',';
|
||||
}
|
||||
|
||||
$sql = " update {$g4['shop_item_table']}
|
||||
set $sql_img
|
||||
where it_id = '$new_it_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
$qstr = "ca_id=$ca_id&sfl=$sfl&sca=$sca&page=$page&stx=".urlencode($stx)."&save_stx=".urlencode($save_stx);
|
||||
|
||||
goto_url("itemlist.php?$qstr");
|
||||
?>
|
||||
@ -212,6 +212,13 @@ $pg_anchor ='<ul class="anchor">
|
||||
<input type="text" name="it_name" value="<?php echo get_text(cut_str($it['it_name'], 250, "")); ?>" id="it_name" required class="frm_input required" size="95">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="it_mobile_name">모바일 상품명</label></th>
|
||||
<td colspan="2">
|
||||
<?php echo help("모바일에서 보여지는 상품명이 다른 경우에 입력합니다. 입력이 없으면 기본 상품명이 출력됩니다."); ?>
|
||||
<input type="text" name="it_mobile_name" value="<?php echo get_text(cut_str($it['it_mobile_name'], 250, "")); ?>" id="it_mobile_name" required class="frm_input">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="it_gallery">전시용 상품</label></th>
|
||||
<td>
|
||||
|
||||
@ -260,6 +260,7 @@ $sql_common = " ca_id = '$ca_id',
|
||||
ca_id2 = '$ca_id2',
|
||||
ca_id3 = '$ca_id3',
|
||||
it_name = '$it_name',
|
||||
it_mobile_name = '$it_mobile_name',
|
||||
it_gallery = '$it_gallery',
|
||||
it_maker = '$it_maker',
|
||||
it_origin = '$it_origin',
|
||||
|
||||
@ -199,7 +199,8 @@ if ($sfl || $stx) // 검색렬일 때만 처음 버튼을 보여줌
|
||||
<?php echo conv_selected_option($ca_list, $row['ca_id']); ?>
|
||||
</select>
|
||||
<?php echo $tmp_ca_list; ?><br>
|
||||
<input type="text" name="it_name[<?php echo $i; ?>]" value="<?php echo htmlspecialchars2(cut_str($row['it_name'],250, "")); ?>" required class="frm_input frm_sit_title required" size="30">
|
||||
<input type="text" name="it_name[<?php echo $i; ?>]" value="<?php echo htmlspecialchars2(cut_str($row['it_name'],250, "")); ?>" required class="frm_input frm_sit_title required" size="30"><br>
|
||||
<input type="text" name="it_mobile_name[<?php echo $i; ?>]" value="<?php echo htmlspecialchars2(cut_str($row['it_mobile_name'],250, "")); ?>" class="frm_input frm_sit_title" size="30">
|
||||
</td>
|
||||
<td headers="sit_amt"><input type="text" name="it_price[<?php echo $i; ?>]" value="<?php echo $row['it_price']; ?>" class="frm_input sit_amt" size="7"></td>
|
||||
<td headers="sit_camt"><input type="text" name="it_cust_price[<?php echo $i; ?>]" value="<?php echo $row['it_cust_price']; ?>" class="frm_input sit_camt" size="7"></td>
|
||||
@ -208,7 +209,7 @@ if ($sfl || $stx) // 검색렬일 때만 처음 버튼을 보여줌
|
||||
<td rowspan="2"><?php echo $row['it_hit']; ?></td>
|
||||
<td rowspan="2" class="td_mng">
|
||||
<a href="<?php echo $href; ?>"><span class="sound_only"><?php echo htmlspecialchars2(cut_str($row['it_name'],250, "")); ?> </span>보기</a>
|
||||
<a href="./item_copy.php?it_id=<?php echo $row['it_id']; ?>&ca_id=<?php echo $row['ca_id']; ?>" class="item_copy" target="_blank"><span class="sound_only"><?php echo htmlspecialchars2(cut_str($row['it_name'],250, "")); ?> </span>복사</a>
|
||||
<a href="./itemcopy.php?it_id=<?php echo $row['it_id']; ?>&ca_id=<?php echo $row['ca_id']; ?>" class="itemcopy" target="_blank"><span class="sound_only"><?php echo htmlspecialchars2(cut_str($row['it_name'],250, "")); ?> </span>복사</a>
|
||||
<a href="./itemform.php?w=u&it_id=<?php echo $row['it_id']; ?>&ca_id=<?php echo $row['ca_id']; ?>&<?php echo $qstr; ?>"><span class="sound_only"><?php echo htmlspecialchars2(cut_str($row['it_name'],250, "")); ?> </span>수정</a>
|
||||
<!-- <a href="./itemformupdate.php?w=d&it_id=<?php echo $row['it_id']; ?>&ca_id=<?php echo $row['ca_id']; ?>&<?php echo $qstr; ?>" onclick="return delete_confirm();"><span class="sound_only"><?php echo htmlspecialchars2(cut_str($row['it_name'],250, "")); ?> </span>삭제</a> -->
|
||||
</td>
|
||||
@ -258,7 +259,7 @@ function fitemlist_submit(f)
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$(".item_copy").click(function() {
|
||||
$(".itemcopy").click(function() {
|
||||
var href = $(this).attr("href");
|
||||
window.open(href, "copywin", "left=100, top=100, width=300, height=200, scrollbars=0");
|
||||
return false;
|
||||
|
||||
@ -20,6 +20,7 @@ if ($_POST['act_button'] == "선택수정") {
|
||||
$sql = "update {$g4['shop_item_table']}
|
||||
set ca_id = '{$_POST['ca_id'][$k]}',
|
||||
it_name = '{$_POST['it_name'][$k]}',
|
||||
it_mobile_name = '{$_POST['it_mobile_name'][$k]}',
|
||||
it_cust_price = '{$_POST['it_cust_price'][$k]}',
|
||||
it_price = '{$_POST['it_price'][$k]}',
|
||||
it_point = '{$_POST['it_point'][$k]}',
|
||||
|
||||
@ -398,6 +398,7 @@ CREATE TABLE IF NOT EXISTS `shop_item` (
|
||||
`ca_id2` varchar(255) NOT NULL DEFAULT '',
|
||||
`ca_id3` varchar(255) NOT NULL DEFAULT '',
|
||||
`it_name` varchar(255) NOT NULL DEFAULT '',
|
||||
`it_mobile_name` varchar(255) NOT NULL DEFAULT '',
|
||||
`it_gallery` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`it_maker` varchar(255) NOT NULL DEFAULT '',
|
||||
`it_origin` varchar(255) NOT NULL DEFAULT '',
|
||||
|
||||
@ -38,7 +38,11 @@ for ($i=1; $row=sql_fetch_array($result); $i++) {
|
||||
}
|
||||
|
||||
if ($this->view_it_name) {
|
||||
echo "<b>".stripslashes($row['it_name'])."</b>\n";
|
||||
$it_name = $row['it_name'];
|
||||
if ($this->is_mobile && $row['it_mobile_name']) {
|
||||
$it_name = $row['it_mobile_name'];
|
||||
}
|
||||
echo "<b>".stripslashes($it_name)."</b>\n";
|
||||
}
|
||||
|
||||
if ($this->view_it_cust_price) {
|
||||
|
||||
@ -10,17 +10,29 @@ $.fn.listType = function(type)
|
||||
if(count < 1)
|
||||
return;
|
||||
|
||||
// class 있다면 저장
|
||||
var cl = this.attr("class");
|
||||
if(cl && !this.data("class")) {
|
||||
this.data("class", cl);
|
||||
}
|
||||
|
||||
// 각 element의 inline 스타일 저장
|
||||
$el.each(function() {
|
||||
var st = $(this).attr("style");
|
||||
if(st) {
|
||||
if(st && !$(this).data("style")) {
|
||||
$(this).data("style", st);
|
||||
}
|
||||
});
|
||||
|
||||
// 버튼의 class on class 제거
|
||||
$("button.sct_lst_view span").removeClass("sct_lst_on").html("");
|
||||
|
||||
if(type == "gallery") {
|
||||
this.removeClass("sct_40");
|
||||
this.removeClass("sct sct_40");
|
||||
if(this.data("class")) {
|
||||
this.attr("class", this.data("class"));
|
||||
}
|
||||
|
||||
$el.each(function() {
|
||||
if($(this).data("style")) {
|
||||
$(this).attr("style", $(this).data("style"));
|
||||
@ -29,7 +41,11 @@ $.fn.listType = function(type)
|
||||
|
||||
$("button.sct_lst_gallery span").addClass("sct_lst_on").html("<b class=\"sound_only\"> 선택됨</b>");
|
||||
} else {
|
||||
this.addClass("sct_40");
|
||||
if(this.data("class")) {
|
||||
this.removeAttr("class");
|
||||
}
|
||||
this.addClass("sct sct_40");
|
||||
|
||||
$el.each(function() {
|
||||
if($(this).data("style")) {
|
||||
$(this).removeAttr("style");
|
||||
|
||||
Reference in New Issue
Block a user