서버를 옮긴 후 부터 장바구니 담기와 바로구매가 되지 않고 있습니다.
안녕하세요.
기존 사용하던 서버에서 새로운 서버로 소스와 디비를 모두 이전하고 사이트를
다시 구동시키고 있습니다.
data폴더 퍼미션도 707로 변경하여 로그인까지 정상적으로 되는걸봐서는 session문제는 아닐듯 한데요;;;
바로구매나 장바구니담기를 하면 '장바구니가 비어 있습니다' 라는 경고창이
/shop/orderform.php?sw_direct=1 여기에서 출력이되고 빈 장바구니로 넘어갑니다.
cartupdate.php를 살펴보니
// 바로구매에 있던 장바구니 자료를 지운다.
if($i == 0 && $sw_direct)
sql_query(" delete from {$g5['g5_shop_cart_table']} where od_id = '$tmp_cart_id' and ct_direct = 1 ", false)
위 쿼리가 실행이 되어서 그런것 같은데 위 쿼리 실행 조건이 바로구매 조건이 아닌가요?
이전 서버에 남아있는 다른 영카트에서 바로구매을 해서 $i를 출력해봐도 새로 옮긴 서버에서와 똑같은
값인 0 이 출력되는데 왜 이전 서버에서는 문제가 없고 새로운 서버에서만 이런 문제가 생기는지 원인을 찾기가 너무 힘드네요;;;;;;
답변 4개 / 댓글 3개
ct_memo1, ct_memo2~~~이 컬럼이 어떤 용도인지는 모르겠으나
ChatGpt 답변처럼 GROUP BY에 사용하면 문제가 될 수 있겠네요
즉 it_id가 동일한데 ct_memo1~ct_memo7의 내용 중에서 다른 것이 있으면 그룹을 다르게 나누므로
합계금액, 상품수량 등이 중복계산 되어 출력 되겠습니다
ct_memo1~7 의 내용이 모두 없거나 모두 동일하면 문제 없습니다
저도 위와 같은 문제로 별짓을 다 해봤는데 안되더군요.
그래서 쇼핑몰 db을 개별로 백업하고, 개별로 다시 올리니 정상 작동합니다.
mysql(mariaDB) 버전이 바뀌거나 기본? 설정이 바뀌어서
나타나는 증상이네요.
점점 오라클을 따라가나 봅니다.
$tmp_cart_id 값은 정상적으로 생성되어 나오는지 확인해 보시고요
장바구니에 담겨지는 쿼리 부분을 디버깅해서 찍어 정상적으로 등록이 되는지도 체크해 보셔야 할듯 합니다.
답변에 대한 댓글 3개
이건 웹호스팅이라면 호스팅사에 문의하셔야 할듯 합니다.
[code]
SELECT a.ct_id,
a.it_id,
a.it_name,
a.ct_price,
a.ct_point,
a.ct_qty,
a.ct_status,
a.ct_send_cost,
a.it_sc_type,
a.ct_memo1,
a.ct_memo2,
a.ct_memo3,
a.ct_memo4,
a.ct_memo5,
a.ct_memo6,
a.ct_memo7,
a.ord_code,
b.ca_id,
b.ca_id2,
b.ca_id3,
b.it_1,
b.it_type1,
b.it_cust_price,
b.it_notax
FROM {$g5['g5_shop_cart_table']} a
LEFT JOIN {$g5['g5_shop_item_table']} b ON (a.it_id = b.it_id)
WHERE a.od_id = '$s_cart_id'
AND a.ct_select = '1'
GROUP BY a.ct_id, a.it_id, a.it_name, a.ct_price, a.ct_point, a.ct_qty, a.ct_status, a.ct_send_cost, a.it_sc_type, a.ct_memo1, a.ct_memo2, a.ct_memo3, a.ct_memo4, a.ct_memo5, a.ct_memo6, a.ct_memo7, a.ord_code, b.ca_id, b.ca_id2, b.ca_id3, b.it_1, b.it_type1, b.it_cust_price, b.it_notax
ORDER BY a.ct_id
[/code]
답변을 작성하려면 로그인이 필요합니다.
orderform.sub.php에 보면
[code]
// $s_cart_id 로 현재 장바구니 자료 쿼리
$sql = " select a.ct_id,
a.it_id,
a.it_name,
a.ct_price,
a.ct_point,
a.ct_qty,
a.ct_status,
a.ct_send_cost,
a.it_sc_type,
a.ct_memo1,
a.ct_memo2,
a.ct_memo3,
a.ct_memo4,
a.ct_memo5,
a.ct_memo6,
a.ct_memo7,
a.ord_code,
b.ca_id,
b.ca_id2,
b.ca_id3,
b.it_1,
b.it_type1,
b.it_cust_price,
b.it_notax
from {$g5['g5_shop_cart_table']} a left join {$g5['g5_shop_item_table']} b on ( a.it_id = b.it_id )
where a.od_id = '$s_cart_id'
and a.ct_select = '1' ";
$sql .= " group by a.it_id ";
$sql .= " order by a.ct_id ";
$result = sql_query($sql);
[/code]
이 쿼리를 출력해서 따로 날려보니까 아래와 같은 오류가 떴습니다.
SQL Error [1055] [42000]: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'parashopdb.a.ct_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
뭔지는 잘 모르겠지만 group by문제 같은데 이게 뭘까요;;;;;;;;;;;;;