1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
<?php include_once('./_common.php');
$table = "{$g5['g5_shop_item_table']}"; $table2 = "{$g5['g5_shop_item_option_table']}"; $table3 = "{$g5['g5_shop_category_table']}";
$sql_common = " and a.it_id <> '{$it_id}' "; if($_REQUEST[wordkey]!=''){ $sql_common .= " and ".$_REQUEST[searchkey]." like '%".$_REQUEST[wordkey]."%' "; } else { $sql_common .= " and 1=2 "; }
$page = $_REQUEST[page]; if($page==''){ $page = 1; } $block = $_REQUEST[block]; if($block==''){ $block = 1; }
$sql = " select count(*) as cnt from $table a left join $table2 b on a.it_id = b.it_id and b.io_type='0' where 1=1 " . $sql_common; $row = sql_fetch($sql); $total_count = $row['cnt'];
$rows = 5; $list_num = 5; $total_page = ceil($total_count / $rows); // 전체 페이지 계산 if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지) $from_record = ($page - 1) * $rows; // 시작 열을 구함
//$sql = "select a.*, b.*, c.ca_name from $table a left join $table2 b on a.it_id = b.it_id left join $table3 c on a.ca_id = c.ca_id where 1=1 and b.io_type<>'1' $sql_common order by a.it_id desc, b.io_id limit $from_record, $list_num "; $sql = "select a.it_id,a.it_name, a.it_price, a.it_buyprice, a.it_stock_qty, b.io_id, b.io_price, b.io_buyprice, b.io_stock_qty, b.io_qty_weight from $table a left join $table2 b on a.it_id = b.it_id and b.io_type='0' where 1=1 $sql_common order by a.it_id desc, b.io_id limit $from_record, $list_num "; $result = sql_query($sql); $res = sql_query($sql); while($info=mysql_fetch_array($res)){ $m_array[] = $info; }
$paging = get_paging2($list_num, $page, $total_page, "?$qstr&page="); $paging = str_replace("<","<",$paging); $paging = str_replace(">",">",$paging);
echo "<?xml version='1.0' encoding='utf-8'?><output>"; for($i=0;$i<count($m_array);$i++){ $it_price = $m_array[$i][it_price]+($m_array[$i][io_price]*1); $it_buyprice = $m_array[$i][it_buyprice]+($m_array[$i][io_buyprice]*1); $it_img = urlencode(get_it_image($m_array[$i]['it_id'], 50, 50)); if($m_array[$i]['io_id']=='' || $m_array[$i]['it_id'] == null){ $it_qty = $m_array[$i]['it_stock_qty']; } else { $it_qty = $m_array[$i]['io_stock_qty']; } $m_array[$i]['io_id'] = str_replace(chr(30),"↕",$m_array[$i]['io_id']); // 추가상품의 경우 다중단가 처리하는 부분에서 기존의 익스플로드 문제로 일단 chr(30) 레코드 세퍼레이트를 ↕로 치환했음. echo "<member>"; echo " <it_id>".$m_array[$i][it_id]."</it_id>"; echo " <it_name>".$m_array[$i][it_name]."</it_name>"; echo " <ca_name>".$m_array[$i][ca_name]."</ca_name>"; echo " <it_price>".number_format($it_price)."</it_price>"; echo " <it_buyprice>".number_format($it_buyprice)."</it_buyprice>"; echo " <io_id>".$m_array[$i][io_id]."</io_id>"; echo " <it_qty>".$it_qty."</it_qty>"; echo " <io_qty_weight>".$m_array[$i][io_qty_weight]."</io_qty_weight>"; echo " <it_img>".$it_img."</it_img>";
echo "</member>"; } echo "<member_cnt>".count($m_array)."</member_cnt>"; echo "<sql>".$sql."</sql>"; echo "<page_div>".$paging."</page_div>"; echo "<field_name>".$field_name."</field_name>"; echo "</output>"; ?>
|