it_1 값이 A 인 상품만 호출 shop.lib 수정 문의드려요
본문
https://sir.kr/qa/133230 게시물을 참고하여 shop.lib을 수정하였습니다.
상품의 it_1 이 A인 상품만 호출하려고 합니다.
아래처럼 function run 함수에서 $where[] = " it_1 = 'A' "; 를 추가 하였는데
작동을 안해서 글을 남겨요ㅜ 도움 부탁 드립니다.
function run() {
global $g5, $config, $member, $default;
$where[] = " it_1 = 'A' "; //it_1 값이 A인 상품만 호출
$list = array();
if ($this->query) {
$sql = $this->query;
$result = sql_query($sql);
$this->total_count = @sql_num_rows($result);
} else {
$where = array();
if ($this->use) {
$where[] = " it_use = '1' ";
}
if ($this->type) {
$where[] = " it_type{$this->type} = '1' ";
}
if ($this->ca_id || $this->ca_id2 || $this->ca_id3) {
$where_ca_id = array();
if ($this->ca_id) {
$where_ca_id[] = " ca_id like '{$this->ca_id}%' ";
}
if ($this->ca_id2) {
$where_ca_id[] = " ca_id2 like '{$this->ca_id2}%' ";
}
if ($this->ca_id3) {
$where_ca_id[] = " ca_id3 like '{$this->ca_id3}%' ";
}
$where[] = " ( " . implode(" or ", $where_ca_id) . " ) ";
}
if ($this->order_by) {
$sql_order = " order by {$this->order_by} ";
}
if ($this->event) {
$sql_select = " select {$this->fields} ";
$sql_common = " from `{$g5['g5_shop_event_item_table']}` a left join `{$g5['g5_shop_item_table']}` b on (a.it_id = b.it_id) ";
$where[] = " a.ev_id = '{$this->event}' ";
} else {
$sql_select = " select {$this->fields} ";
$sql_common = " from `{$g5['g5_shop_item_table']}` ";
}
$sql_where = " where " . implode(" and ", $where);
$sql_limit = " limit " . $this->from_record . " , " . ($this->list_mod * $this->list_row);
$sql = $sql_select . $sql_common . $sql_where . $sql_order . $sql_limit;
$result = sql_query($sql);
if ($this->is_page) {
$sql2 = " select count(*) as cnt " . $sql_common . $sql_where;
$row2 = sql_fetch($sql2);
$this->total_count = $row2['cnt'];
}
}
if( isset($result) && $result ){
while ($row=sql_fetch_array($result)) {
if( isset($row['it_seo_title']) && ! $row['it_seo_title'] ){
shop_seo_title_update($row['it_id']);
}
$row['it_basic'] = conv_content($row['it_basic'], 1);
$list[] = $row;
}
if(function_exists('sql_data_seek')){
sql_data_seek($result, 0);
}
}
$file = $this->list_skin;
if ($this->list_skin == "") {
return $this->count."번 item_list() 의 스킨파일이 지정되지 않았습니다.";
} else if (!file_exists($file)) {
return $file." 파일을 찾을 수 없습니다.";
} else {
ob_start();
$list_mod = $this->list_mod;
include($file);
$content = ob_get_contents();
ob_end_clean();
return $content;
}
}