테스트 사이트 - 개발 중인 베타 버전입니다

(초보) 상품 순서를 코드 순이나 등록순으로 변경하고 싶습니다. 채택완료

hyosiklee 7년 전 조회 1,487

상품 순서를 코드 순이나 등록순으로 변경하고 싶습니다.

검색해보니 order by 를 수정하면될거 같은데.. 소스를 다 뒤져도 모르겠네요.

어디를 수정해야할지 조언 부탁드립니다.

 

http://ytm2018.cafe24.com/shop/list.php?ca_id=10

 

 

* list.php

 

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

if (G5_IS_MOBILE) {
    include_once(G5_MSHOP_PATH.'/list.php');
    return;
}

$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('등록된 분류가 없습니다.');

// 테마미리보기 스킨 등의 변수 재설정
if(defined('_THEME_PREVIEW_') && _THEME_PREVIEW_ === true) {
    $ca['ca_skin']       = (isset($tconfig['ca_skin']) && $tconfig['ca_skin']) ? $tconfig['ca_skin'] : $ca['ca_skin'];
    $ca['ca_img_width']  = (isset($tconfig['ca_img_width']) && $tconfig['ca_img_width']) ? $tconfig['ca_img_width'] : $ca['ca_img_width'];
    $ca['ca_img_height'] = (isset($tconfig['ca_img_height']) && $tconfig['ca_img_height']) ? $tconfig['ca_img_height'] : $ca['ca_img_height'];
    $ca['ca_list_mod']   = (isset($tconfig['ca_list_mod']) && $tconfig['ca_list_mod']) ? $tconfig['ca_list_mod'] : $ca['ca_list_mod'];
    $ca['ca_list_row']   = (isset($tconfig['ca_list_row']) && $tconfig['ca_list_row']) ? $tconfig['ca_list_row'] : $ca['ca_list_row'];
}

// 본인인증, 성인인증체크
if(!$is_admin) {
    $msg = shop_member_cert_check($ca_id, 'list');
    if($msg)
        alert($msg, G5_SHOP_URL);
}

$g5['title'] = $ca['ca_name'].' 상품리스트';

if ($ca['ca_include_head'])
    @include_once($ca['ca_include_head']);
else
    include_once(G5_SHOP_PATH.'/_head.php');

// 스킨경로
$skin_dir = G5_SHOP_SKIN_PATH;

if($ca['ca_skin_dir']) {
    if(preg_match('#^theme/(.+)$#', $ca['ca_skin_dir'], $match))
        $skin_dir = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/shop/'.$match[1];
    else
        $skin_dir = G5_PATH.'/'.G5_SKIN_DIR.'/shop/'.$ca['ca_skin_dir'];

    if(is_dir($skin_dir)) {
        $skin_file = $skin_dir.'/'.$ca['ca_skin'];

        if(!is_file($skin_file))
            $skin_dir = G5_SHOP_SKIN_PATH;
    } else {
        $skin_dir = G5_SHOP_SKIN_PATH;
    }
}

define('G5_SHOP_CSS_URL', str_replace(G5_PATH, G5_URL, $skin_dir));

if ($is_admin)
    //echo '<div class="sct_admin"><a href="'.G5_ADMIN_URL.'/shop_admin/categoryform.php?w=u&amp;ca_id='.$ca_id.'" class="btn_admin">분류 관리</a></div>';
?>
<style type="text/css">
    #content{width: auto!important;}
</style>

<script>
var itemlist_ca_id = "<?php echo $ca_id; ?>";
window.onload = function(){
    var mySwiper = new Swiper('.product-top-banner-row', {
        speed: 400, loop : true, auto : true,
        pagination : { el : ".list-slide-pagination",  clickable: true }
    });
}

</script>
<script src="<?php echo G5_JS_URL; ?>/shop.list.js"></script>

<div class="product-list-content">
    <div class="product-top-banner-row-box">
        <div class="product-top-banner-row">
            <?=conv_content($ca['ca_head_html'], 1);?>            
        </div>
        <div class="list-slide-pagination swiper-pagination"></div>
    </div>
    <?php
        $sql = "SELECT * FROM g5_shop_category WHERE ca_id LIKE '$ca[ca_id]%' AND ca_id != $ca[ca_id]";
        $result = sql_query($sql);
        for($i=1; $row = sql_fetch_array($result); $i++){
    ?>
    <div class="product-list">
        <div class="product-header">
            <strong class="ca-name"><?=$row["ca_name"];?></strong>
            <span class="short-desc"><?=\Jin\getEngName(trim($row["ca_name"]));?></span>
        </div>
        <?php
            $skin_file = $skin_dir.'/'.$ca['ca_skin'];
            if (file_exists($skin_file)) {
 
                // 총몇개 = 한줄에 몇개 * 몇줄
                $items = $ca['ca_list_mod'] * $ca['ca_list_row'];
                // 페이지가 없으면 첫 페이지 (1 페이지)
                if ($page < 1) $page = 1;
                // 시작 레코드 구함
                $from_record = ($page - 1) * $items;
                $list = new item_list($skin_file, $ca['ca_list_mod'], $ca['ca_list_row'], $ca['ca_img_width'], $ca['ca_img_height']);
                $list->set_category($row[ca_id], 2);
                $list->set_is_page(true);
                $list->set_order_by($order_by);
                $list->set_from_record($from_record);
                $list->set_view('it_img', true);
                $list->set_view('it_id', false);
                $list->set_view('it_name', true);
                $list->set_view('it_basic', true);
                $list->set_view('it_cust_price', true);
                $list->set_view('it_price', true);
                $list->set_view('it_icon', true);
                $list->set_view('sns', true);
                echo $list->run();
            }
            else{
                echo '<div class="sct_nofile">'.str_replace(G5_PATH.'/', '', $skin_file).' 파일을 찾을 수 없습니다.<br>관리자에게 알려주시면 감사하겠습니다.</div>';
            }
            ?>
       </div>
    <?php } ?>            
</div>

<?php
if ($ca['ca_include_tail'])
    @include_once($ca['ca_include_tail']);
else
    include_once(G5_SHOP_PATH.'/_tail.php');

echo "\n<!-- {$ca['ca_skin']} -->\n";
?>
 

 

* list.10.skin.php

 

<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_CSS_URL.'/style.css">', 0);
?>

<div class="product-wrap">
<?php for ($i=1; $row=sql_fetch_array($result); $i++) { ?>
    <div class="product-col">
        <a href="<?=$this->href.$row[it_id];?>">
            <dl class="product">
                <dt style="background-image:url('/data/item/<?=$row[it_img1];?>')"><?=$row[it_name];?></dt>
                <dd>
                    <div class="dd-wrapper">
                        <strong class="product-name"><?=$row[it_name];?></strong>
                        <strong class="product-name_en"><?=$row[it_model];?></strong>
                        <span class="product-text"><?=$row[it_basic];?></span>
               
                    </div>
                </dd>
            </dl>
        </a>
    </div>
<? } ?>
</div>

 

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

채택된 답변
+20 포인트
7년 전
로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

h
hyosiklee
7년 전
감사합니다. 리스트 앞쪽에 추가하니까 되네요

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인