메인화면에서 더보기 클릭시 페이지 이동이 아닌 상품이 더보여줬으면 좋겠는데....

메인화면에서 더보기 클릭시 페이지 이동이 아닌 상품이 더보여줬으면 좋겠는데....

QA

메인화면에서 더보기 클릭시 페이지 이동이 아닌 상품이 더보여줬으면 좋겠는데....

답변 1

본문

ajax를 이용해서 할려고 코드를 짰는데 잘안되네요..

버튼부분

<div class="li_more">
    <? $qstr1 .= 'type=9';
            $qstr1 .='&sort='.$sort.'&sortodr='.$sortodr;
    $ajax_url = G5_SHOP_URL.'/ajax.list2.php?'.$qstr1; ?>
        <div class="li_more_btn">
            <button type="button" id="btn_more_item" data-url="<?php echo $ajax_url; ?>" data-page="<?php echo $page; ?>">더보기 +</button>
        </div>

</div>

 

 

ajax 부분

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

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

$type = preg_replace("/[\<\>\'\"\\\'\\\"\%\=\(\)\s]/", "", $_REQUEST['type']);
if ($type == 1)      $g5['title'] = $deit_type[1];
else if ($type == 2) $g5['title'] = $deit_type[2];
else if ($type == 3) $g5['title'] = $deit_type[3];
else if ($type == 4) $g5['title'] = $deit_type[4];
else if ($type == 5) $g5['title'] = $deit_type[5];
else if ($type == 6) $g5['title'] = $deit_type[6];
else if ($type == 7) $g5['title'] = $deit_type[7];
else if ($type == 8) $g5['title'] = $deit_type[8];
else if ($type == 9) $g5['title'] = $deit_type[9];
else if ($type == 10) $g5['title'] = $deit_type[10];
else
    alert('상품유형이 아닙니다.');

include_once('./_head.php');

// 한페이지에 출력하는 이미지수 = $list_mod * $list_row
$list_mod   = 3;    // 한줄에 이미지 몇개씩 출력?
$list_row   = 5;    // 한 페이지에 몇라인씩 출력?

$img_width  = 230;  // 출력이미지 폭
$img_height = 230;  // 출력이미지 높이
?>

<?php
// 상품 출력순서가 있다면
$order_by = ' it_order, it_id desc ';
if ($sort != '')
    $order_by = $sort.' '.$sortodr.' , it_order, it_id desc';
else
    $order_by = 'it_order, it_id desc';

if (!$skin)
    $skin = 'list.10.skin.php';

define('G5_SHOP_CSS_URL', G5_SHOP_SKIN_URL);

// 리스트 유형별로 출력
$list_file = G5_SHOP_SKIN_PATH.'/'.$skin;
if (file_exists($list_file)) {
    // 총몇개 = 한줄에 몇개 * 몇줄
    $items = $list_mod * $list_row;
    // 페이지가 없으면 첫 페이지 (1 페이지)
    if ($page < 1) $page = 1;
    // 시작 레코드 구함
    $from_record = ($page - 1) * $items;

    $list = new item_list();
    $list->set_type($type);
    $list->set_list_skin($list_file);
    $list->set_list_mod($list_mod);
    $list->set_list_row($list_row);
    $list->set_img_size($img_width, $img_height);
    $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_cust_price', false);
    $list->set_view('it_price', true);
    $list->set_view('it_icon', true);
    $list->set_view('sns', true);
    echo $list->run();

    // where 된 전체 상품수
    $total_count = $list->total_count;
    // 전체 페이지 계산
    $total_page  = ceil($total_count / $items);
}
else
{
    echo '<div align="center">'.$skin.' 파일을 찾을 수 없습니다.<br>관리자에게 알려주시면 감사하겠습니다.</div>';
}
?>

<?php
$qstr .= '&type='.$type.'&sort='.$sort;
echo get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page=");
?>

<?php
include_once('./_tail.php');
?>

 

 

이 질문에 댓글 쓰기 :

답변 1

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 0
© SIRSOFT
현재 페이지 제일 처음으로