도

주문내역조회에서 paging 기능에 오류가 있습니다.

· 2014-05-21 (수) 11:37:57 · 1317 · 2
shop/orderinquiry.php 에서 include_once('./_head.php'); 부분으로 인해

orderinquiry.php의 page 계산부분 변수와 shop.head.php에서 사용되는 page 계산 변수가 동일하여 주문내역의 paging 기능이 오동작 합니다.

---------------------------------------------------------------------------------------------
include_once('./_common.php');

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

define("_ORDERINQUIRY_", true);

$od_pwd = sql_password($od_pwd);

// 회원인 경우
if ($is_member)
{
$sql_common = " from {$g5['g5_shop_order_table']} where mb_id = '{$member['mb_id']}' ";
}
else if ($od_id && $od_pwd) // 비회원인 경우 주문서번호와 비밀번호가 넘어왔다면
{
$sql_common = " from {$g5['g5_shop_order_table']} where od_id = '$od_id' and od_pwd = '$od_pwd' ";
}
else // 그렇지 않다면 로그인으로 가기
{
goto_url(G5_BBS_URL.'/login.php?url='.urlencode(G5_SHOP_URL.'/orderinquiry.php'));
}

// 테이블의 전체 레코드수만 얻음
$sql = " select count(*) as cnt " . $sql_common;
$row = sql_fetch($sql);
$total_count = $row['cnt'];

// 비회원 주문확인시 비회원의 모든 주문이 다 출력되는 오류 수정
// 조건에 맞는 주문서가 없다면
if ($total_count == 0)
{
if ($is_member) // 회원일 경우는 메인으로 이동
alert('주문이 존재하지 않습니다.', G5_SHOP_URL);
else // 비회원일 경우는 이전 페이지로 이동
alert('주문이 존재하지 않습니다.');
}

$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함


// 비회원 주문확인의 경우 바로 주문서 상세조회로 이동
if (!$is_member)
{
$sql = " select od_id, od_time, od_ip from {$g5['g5_shop_order_table']} where od_id = '$od_id' and od_pwd = '$od_pwd' ";
$row = sql_fetch($sql);
if ($row['od_id']) {
$uid = md5($row['od_id'].$row['od_time'].$row['od_ip']);
set_session('ss_orderview_uid', $uid);
goto_url(G5_SHOP_URL.'/orderinquiryview.php?od_id='.$row['od_id'].'&uid='.$uid);
}
}

$g5['title'] = '주문내역조회';
include_once('./_head.php'); <--- 이부분을 상단으로 끌어 올려야 될듯합니다.
-------------------------------------------------------------------------------------------------

** 제가 추천하는 수정

include_once('./_common.php');

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

define("_ORDERINQUIRY_", true);

include_once('./_head.php'); <--- 여기로..

$od_pwd = sql_password($od_pwd);

// 회원인 경우
if ($is_member)
{
$sql_common = " from {$g5['g5_shop_order_table']} where mb_id = '{$member['mb_id']}' ";
}
else if ($od_id && $od_pwd) // 비회원인 경우 주문서번호와 비밀번호가 넘어왔다면
{
$sql_common = " from {$g5['g5_shop_order_table']} where od_id = '$od_id' and od_pwd = '$od_pwd' ";
}
else // 그렇지 않다면 로그인으로 가기
{
goto_url(G5_BBS_URL.'/login.php?url='.urlencode(G5_SHOP_URL.'/orderinquiry.php'));
}

// 테이블의 전체 레코드수만 얻음
$sql = " select count(*) as cnt " . $sql_common;
$row = sql_fetch($sql);
$total_count = $row['cnt'];

// 비회원 주문확인시 비회원의 모든 주문이 다 출력되는 오류 수정
// 조건에 맞는 주문서가 없다면
if ($total_count == 0)
{
if ($is_member) // 회원일 경우는 메인으로 이동
alert('주문이 존재하지 않습니다.', G5_SHOP_URL);
else // 비회원일 경우는 이전 페이지로 이동
alert('주문이 존재하지 않습니다.');
}

$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함


// 비회원 주문확인의 경우 바로 주문서 상세조회로 이동
if (!$is_member)
{
$sql = " select od_id, od_time, od_ip from {$g5['g5_shop_order_table']} where od_id = '$od_id' and od_pwd = '$od_pwd' ";
$row = sql_fetch($sql);
if ($row['od_id']) {
$uid = md5($row['od_id'].$row['od_time'].$row['od_ip']);
set_session('ss_orderview_uid', $uid);
goto_url(G5_SHOP_URL.'/orderinquiryview.php?od_id='.$row['od_id'].'&uid='.$uid);
}
}

$g5['title'] = '주문내역조회';

//include_once('./_head.php');

|

댓글 2개

shop.head.php 에서는 $page 변수가 사용되지 않습니다.
기본 코드에서 수정하신 부분이 있으신 지 확인해 보시기 바랍니다.
2014-05-21 (수) 11:53:30
그렇네요. 방금 저도 확인했습니다.
누군가 수정 코멘트도 안달아놓고 shop.head.php를 수정 하였네요.ㅠㅠ
번거롭게해서 미안합니다.
글고 항상 감사합니다!!^^
댓글을 작성하시려면 로그인이 필요합니다.

버그신고

4,191건

  문의게시판을 이용해 주세요 :) https://sir.kr/co_qa  

+
분류 제목 글쓴이 날짜
14-05-28
14-05-28
14-05-27
14-05-26
14-05-26
14-05-23
14-05-23
14-05-22
14-05-22
14-05-21
14-05-21
14-05-21
14-05-21
14-05-20
14-05-20
14-05-20
14-05-19
14-05-16
14-05-13
14-05-13