관련상품이미지 출력 코드 수정 및 관련상품 정렬순서 필드 추가
This commit is contained in:
@ -45,16 +45,13 @@ if(!$result) {
|
||||
ADD `it_img10` VARCHAR(255) NOT NULL DEFAULT '' AFTER `it_img9` ", false);
|
||||
}
|
||||
|
||||
// it_amount 를 it_price 로 변경
|
||||
/*
|
||||
$sql = " select it_price from {$g4['shop_item_table']} limit 1 ";
|
||||
// 관련상품 정렬을 위한 ir_no 필드 추가
|
||||
$sql = " select ir_no from {$g4['shop_item_relation_table']} limit 1 ";
|
||||
$result = sql_query($sql, false);
|
||||
if(!$result) {
|
||||
sql_query(" ALTER TABLE `{$g4['shop_item_table']}` CHANGE `it_amount` `it_price` INT(11) NOT NULL DEFAULT '0' ", false);
|
||||
sql_query(" ALTER TABLE `{$g4['shop_item_table']}` CHANGE `it_amount2` `it_price2` INT(11) NOT NULL DEFAULT '0' ", false);
|
||||
sql_query(" ALTER TABLE `{$g4['shop_item_table']}` CHANGE `it_amount3` `it_price3` INT(11) NOT NULL DEFAULT '0' ", false);
|
||||
sql_query(" ALTER TABLE `{$g4['shop_item_relation_table']}`
|
||||
ADD `ir_no` INT(11) NOT NULL DEFAULT '0' AFTER `it_id2` ", false);
|
||||
}
|
||||
*/
|
||||
|
||||
$html_title = "상품 ";
|
||||
|
||||
@ -582,20 +579,16 @@ $(function(){
|
||||
<script>
|
||||
|
||||
// 김선용 2006.10
|
||||
function relation_img(name, id)
|
||||
function relation_img(it_id, id)
|
||||
{
|
||||
var item_image_url = "";
|
||||
if(!name) return;
|
||||
temp = name.split("/");
|
||||
if(temp[1] == ''){
|
||||
temp[1] = "no_image.gif";
|
||||
item_image_url = "<?php echo G4_SHOP_URL; ?>/img";
|
||||
} else {
|
||||
item_image_url = "<?php echo G4_DATA_URL; ?>/item";
|
||||
}
|
||||
view_span = document.getElementById(id);
|
||||
item_price = number_format(String(temp[2]));
|
||||
view_span.innerHTML = "<a href=\"<?php echo G4_SHOP_URL; ?>/item.php?it_id="+temp[0]+"\" target=\"_blank\"><img src=\""+item_image_url+"/"+temp[1]+"\"width=\"100\" height=\"80\" border=\"1\" style=\"border-color:#333333;\" title=\"상품 새창으로 보기\"></a><br>"+item_price+" 원";
|
||||
if(!it_id) return;
|
||||
$.post(
|
||||
"<?php echo G4_ADMIN_URL; ?>/shop_admin/itemformrelationimage.php",
|
||||
{ it_id: it_id, width: "100", height: "80" },
|
||||
function(data) {
|
||||
$("#"+id).html(data);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function relation_add(fld)
|
||||
@ -680,20 +673,14 @@ $(function(){
|
||||
from {$g4['shop_item_relation_table']} a
|
||||
left join {$g4['shop_item_table']} b on (a.it_id2=b.it_id)
|
||||
where a.it_id = '$it_id'
|
||||
order by b.ca_id, b.it_name ";
|
||||
order by ir_no asc ";
|
||||
$result = sql_query($sql);
|
||||
while($row=sql_fetch_array($result))
|
||||
{
|
||||
$sql2 = " select ca_name from {$g4['shop_category_table']} where ca_id = '{$row['ca_id']}' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
|
||||
// 김선용 2006.10
|
||||
if(file_exists(G4_DATA_PATH."/item/{$row['it_id']}_s"))
|
||||
$it_image = "{$row['it_id']}_s";
|
||||
else
|
||||
$it_image = "";
|
||||
?>
|
||||
<option value="<?php echo $row['it_id']; ?>/<?php echo $it_image; ?>/<?php echo $row['it_price']; ?>"><?php echo $row2['ca_name']; ?> : <?php echo cut_str(get_text(strip_tags($row['it_name'])),30); ?></option>
|
||||
<option value="<?php echo $row['it_id']; ?>"><?php echo $row2['ca_name']; ?> : <?php echo cut_str(get_text(strip_tags($row['it_name'])),30); ?></option>
|
||||
<?php
|
||||
$str[] = $row['it_id'];
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ for($i=0;$row=sql_fetch_array($result);$i++) {
|
||||
else
|
||||
$it_image = "";
|
||||
|
||||
$options .= "<option value=\"".$row['it_id']."/".$it_image."/".$row['it_price']."\">$ca_name : $it_name</option>\n";
|
||||
$options .= "<option value=\"".$row['it_id']."\">$ca_name : $it_name</option>\n";
|
||||
}
|
||||
|
||||
echo $options;
|
||||
|
||||
23
adm/shop_admin/itemformrelationimage.php
Normal file
23
adm/shop_admin/itemformrelationimage.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
$sub_menu = '400300';
|
||||
include_once('./_common.php');
|
||||
|
||||
$it_id = $_POST['it_id'];
|
||||
$width = $_POST['width'];
|
||||
$height = $_POST['height'];
|
||||
|
||||
$sql = " select it_id, it_price from {$g4['shop_item_table']} where it_id = '$it_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if(!$row['it_id']) {
|
||||
echo '상품 정보가 존재하지 않습니다.';
|
||||
exit;
|
||||
}
|
||||
|
||||
$img = get_it_image($row['it_id'], $width, $height);
|
||||
|
||||
if(!$img)
|
||||
$img = '<img src="'.G4_SHOP_URL.'/img/no_image.gif" width="'.$width.'" height="'.$height.'" alt="">';
|
||||
|
||||
echo '<a href="'.G4_SHOP_URL.'/item.php?it_id='.$row['it_id'].'" target="_blank">'.$img.'</a><br>'.display_price($row['it_price']);
|
||||
?>
|
||||
@ -479,13 +479,15 @@ if ($w == "" || $w == "u")
|
||||
{
|
||||
$sql = " insert into {$g4['shop_item_relation_table']}
|
||||
set it_id = '$it_id',
|
||||
it_id2 = '$it_id2[$i]' ";
|
||||
it_id2 = '$it_id2[$i]',
|
||||
ir_no = '$i' ";
|
||||
sql_query($sql, false);
|
||||
|
||||
// 관련상품의 반대로도 등록
|
||||
$sql = " insert into {$g4['shop_item_relation_table']}
|
||||
set it_id = '$it_id2[$i]',
|
||||
it_id2 = '$it_id' ";
|
||||
it_id2 = '$it_id',
|
||||
ir_no = '$i' ";
|
||||
sql_query($sql, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -823,6 +823,7 @@ function display_relation_item($it_id, $width, $height, $rows=3)
|
||||
$sql = " select b.it_id, b.it_name, b.it_price, b.it_tel_inq, b.it_gallery
|
||||
from {$g4['shop_item_relation_table']} a left join {$g4['shop_item_table']} b on ( a.it_id2 = b.it_id )
|
||||
where a.it_id = '$it_id'
|
||||
order by ir_no asc
|
||||
limit 0, $rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user