상품리스트에서 상품유형별 출력

상품리스트에서 상품유형별 출력

QA

상품리스트에서 상품유형별 출력

본문

예를 들어서 추천상품 누르면 

추천상품부터 나오고 나머지 상품들이 나오잖아요

 

추천상품을 누르면 추천상품만 나오고

나머지 상품들은 안보이게 못할까요

이 질문에 댓글 쓰기 :

답변 2

shop/list   에 

 

$list = new item_list($skin_file, $ca['ca_list_mod'], $ca['ca_list_row'], $ca['ca_img_width'], $ca['ca_img_height']);

이부분 아래에 정렬하시려는 부분을 필터링 하시면되실듯 합니다

 if($sort=="it_type2"){
   $list->set_type(2);    
 }

listtype.php 파일은 


if ($type == 1)      $g5['title'] = '히트상품';
else if ($type == 2) $g5['title'] = '추천상품';
else if ($type == 3) $g5['title'] = '최신상품';
else if ($type == 4) $g5['title'] = '인기상품';
else if ($type == 5) $g5['title'] = '할인상품';

와 같이 되어 있어서 그 상품만 보이게 되어 있을텐데요.

 

이러<?php
include_once('./_common.php');

if(USE_G5_THEME && defined('G5_THEME_PATH')) {
    require_once(G5_SHOP_PATH.'/yc/listtype.php');
    return;
}

$type = preg_replace("/[\<\>\'\"\\\'\\\"\%\=\(\)\s]/", "", $_REQUEST['type']);

if(!$type) $type = 1;

if ($type == 1)      $g5['title'] = '히트상품';
else if ($type == 2) $g5['title'] = '추천상품';
else if ($type == 3) $g5['title'] = '최신상품';
else if ($type == 4) $g5['title'] = '인기상품';
else if ($type == 5) $g5['title'] = '할인상품';
else if ($type == 6) $g5['title'] = '서울';
else if ($type == 7) $g5['title'] = '경기';
else if ($type == 8) $g5['title'] = '인천';
else if ($type == 9) $g5['title'] = '강원';
else if ($type == 10) $g5['title'] = '충북';
else if ($type == 11) $g5['title'] = '충남';
else if ($type == 12) $g5['title'] = '대전';
else if ($type == 13) $g5['title'] = '세종';
else if ($type == 14) $g5['title'] = '전북';
else if ($type == 15) $g5['title'] = '전남';
else if ($type == 16) $g5['title'] = '광주';
else if ($type == 17) $g5['title'] = '경북';
else if ($type == 18) $g5['title'] = '대구';
else if ($type == 19) $g5['title'] = '경남';
else if ($type == 20) $g5['title'] = '울산';
else if ($type == 21) $g5['title'] = '부산';
else if ($type == 22) $g5['title'] = '제주';
else if ($type == 23) $g5['title'] = '전국';
else if ($type == 24) $g5['title'] = 'MASTER';
else if ($type == 25) $g5['title'] = 'PRO';
else if ($type == 26) $g5['title'] = 'SEMIPRO';
else
    alert('상품유형이 아닙니다.');

if($ca_id) {
$sql = " select * from {$g5['g5_shop_category_table']} where ca_id = '$ca_id' and ca_use = '1'  ";
$ca = sql_fetch($sql);
if (!$ca['ca_id'])
    alert('등록된 분류가 없습니다.');

}

// Page ID
$pid = 'itype'.$type;
$at = apms_page_thema($pid);
if(!$at['gr_id'] && $pid != 'itype') {
$pid = 'itype';
$at = apms_page_thema($pid);
}
include_once(G5_LIB_PATH.'/apms.thema.lib.php');

// 리스트 분류
$cate = array();
$cate = apms_item_category_array($ca_id);
$is_cate = (count($cate) > 0) ? true : false;

// Rows
$skin_row = array();
$skin_row = apms_rows('type_'.MOBILE_.'mods, type_'.MOBILE_.'rows, type_'.MOBILE_.'img_width, type_'.MOBILE_.'img_height, type_'.MOBILE_.'skin, type_'.MOBILE_.'set');
$skin_name = $skin_row['type_'.MOBILE_.'skin'];
$list_mods = $skin_row['type_'.MOBILE_.'mods'];
$list_rows = $skin_row['type_'.MOBILE_.'rows'];
$thumb_w = $skin_row['type_'.MOBILE_.'img_width'];
$thumb_h = $skin_row['type_'.MOBILE_.'img_height'];

// 스킨설정
$wset = array();
if($skin_row['type_'.MOBILE_.'set']) {
$wset = apms_unpack($skin_row['type_'.MOBILE_.'set']);
}

// 데모
if($is_demo) {
@include ($demo_setup_file);
}

$skin_path = G5_SKIN_PATH.'/apms/type/'.$skin_name;
$skin_url = G5_SKIN_URL.'/apms/type/'.$skin_name;

// 스킨 체크
list($skin_path, $skin_url) = apms_skin_thema('shop/type', $skin_path, $skin_url);

$list_skin_path = $skin_path;
$list_skin_url = $skin_url;

// 추가설정
$is_type_sub = false;
$sql_apms_where = $sql_apms_orderby = '';
@include_once($skin_path.'/type.head.skin.php');

$order_by = ($sort != "") ? $sort.' '.$sortodr.' ,'.$sql_apms_orderby.' it_order, pt_num desc, it_id desc' : $sql_apms_orderby.' it_order, pt_num desc, it_id desc'; // 상품 출력순서가 있다면
$where = "it_use = '1'";
$where .= " and it_type{$type} = '1'";
if(isset($ca_id) && $ca_id) {
$where .= " and (ca_id like '{$ca_id}%' or ca_id2 like '{$ca_id}%' or ca_id3 like '{$ca_id}%')";
$qstr .= '&amp;ca_id='.$ca_id;
}
$where .= $sql_apms_where;

// 정렬
$list_sort_href = $_SERVER['SCRIPT_NAME'].'?type='.$type.$qstr.'&amp;sort=';

if($sort) $qstr .= '&amp;sort='.$sort;
if($sortodr) $qstr .= '&amp;sortodr='.$sortodr;

// 상위분류
$ca_id_len = strlen($ca_id);
$up_href = '';
if ($ca_id_len > 2){
$len1 = $ca_id_len - 2;
$up_href = './listtype.php?type='.$type.$qstr.'&amp;ca_id='.substr($ca_id,0,$len1);
} else if($ca_id_len == 2) {
$up_href = './listtype.php?type='.$type.$qstr.'&amp;ca_id=';
}

// 상품 리스트
$list = array();

if(!$list_mods) $list_mods = 3;
if(!$list_rows) $list_rows = 5;

// 총몇개 = 한줄에 몇개 * 몇줄
$item_rows = $list_rows * $list_mods;

// 페이지가 없으면 첫 페이지 (1 페이지)
if ($page < 1) $page = 1;
// 시작 레코드 구함
$from_record = ($page - 1) * $item_rows;

// 전체 페이지 계산
$row2 = sql_fetch(" select count(*) as cnt from `{$g5['g5_shop_item_table']}` where $where ");
$total_count = $row2['cnt'];
$total_page  = ceil($total_count / $item_rows);

$num = $total_count - ($page - 1) * $item_rows;
$result = sql_query(" select * from `{$g5['g5_shop_item_table']}` where $where order by $order_by limit $from_record, $item_rows ");
for ($i=0; $row=sql_fetch_array($result); $i++) {
$list[$i] = $row;
$list[$i]['href'] = './item.php?it_id='.$row['it_id'].'&amp;type='.$type.$qstr;
$list[$i]['num'] = $num;
$num--;
}

// 페이징
$write_pages = G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'];
$list_page = $_SERVER['SCRIPT_NAME'].'?type='.$type.$qstr.'&amp;page=';

if($is_type_sub) {
include_once(G5_PATH.'/head.sub.php');
if(!USE_G5_THEME) @include_once(THEMA_PATH.'/head.sub.php');
} else {
include_once('./_head.php');
}

$lm = 'type'; // 리스트 모드
$ls = $skin_name; // 리스트

답변을 작성하시기 전에 로그인 해주세요.
전체 123,638 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT