자동배송 완료 넘기기

자동배송 완료 넘기기

QA

자동배송 완료 넘기기

본문

https://sir.kr/yc5_tip/1247#c_1847 
글참고 하여 


//  자동 배송완료 만들기
    $beforedays = date("Y-m-d H:i:s", ( time() - (86400 * (int)$default['de_point_days']) ) ); // 86400초는 하루
    $sql22 = " select * from {$g5['g5_shop_cart_table']} where ct_status = '배송' and ct_time <= '$beforedays' ";
$result22 = sql_query($sql22);
    for ($i=0; $row22=sql_fetch_array($result22); $i++) {
/*
echo "update {$g5['g5_shop_cart_table']} set ct_status = '완료' where ct_id = '{$row22['ct_id']}' ";
echo "<br>";
echo "update {$g5['g5_shop_order_table']} set od_status = '완료' where  od_id = '{$row22['od_id']}' ";
echo "<br>";echo "<br>";
*/
sql_query("update {$g5['g5_shop_cart_table']} set ct_status = '완료' where ct_id = '{$row22['ct_id']}' ");  // 오더테이블
sql_query("update {$g5['g5_shop_order_table']} set od_status = '완료' where od_id = '{$row22['od_id']}' ");  // 카트테이블
}
 

 

적용하려고합니다. 
어느파일에 위 코드를 넣어야할까요 ?

 

그리고 혹시 배송일로부터 7일 을 적용하고싶으면.
ct_time 을 - > od_invoice_time 이렇게 수정하면되지않을까요 ?

이 질문에 댓글 쓰기 :

답변 2

cron에 넣는 것이 가장 좋을 듯합니다.

다음으로는

배송 상태를 확인하는 페이지 윗부분에 넣으면 되지 않을까요?

od_invoice_time이 맞을 것 같습니다.

영카트는 주문과 배송이 분리 되어 있지 않아
주문리스트에서 배송 업무를 보게 되어 있어 좀 불편한 점은 있죠.
언젠가는 배송과 주문이 분리가 되겠죠.


//  자동 배송완료 만들기
    $beforedays = date("Y-m-d H:i:s", ( time() - (86400 * (int)$default['de_point_days']) ) ); // 86400초는 하루
    $sql22 = " select * from {$g5['g5_shop_cart_table']} A inner join {$g5['g5_shop_order_table']} B using( od_id)
set A.ct_status = '완료', B.od_status = '완료' where A.ct_time < now() - interval 7 day and A.ct_status='배송' and ct_time <= '$beforedays' ";
$result22 = sql_query($sql22);
    for ($i=0; $row22=sql_fetch_array($result22); $i++) {
/*
echo "update {$g5['g5_shop_cart_table']} set ct_status = '완료' where ct_id = '{$row22['ct_id']}' ";
echo "<br>";
echo "update {$g5['g5_shop_order_table']} set od_status = '완료' where  od_id = '{$row22['od_id']}' ";
echo "<br>";echo "<br>";
*/
sql_query("update {$g5['g5_shop_cart_table']} set ct_status = '완료' where ct_id = '{$row22['ct_id']}' ");  // 오더테이블
sql_query("update {$g5['g5_shop_order_table']} set od_status = '완료' where od_id = '{$row22['od_id']}' ");  // 카트테이블
}


이렇게맞을까요 ?

sql_query("update  {$g5['g5_shop_order_table']} A inner join {$g5['g5_shop_cart_table']} B on A.od_id=B.od_id and B.ct_status='배송'
set B.ct_status = '완료', A.od_status = '완료'
where A.od_invoice_time< now() - interval 7 day ");

정확한 것은 한번 테스트해 보시기 바랍니다.

//  자동 배송완료 만들기
    $beforedays = date("Y-m-d H:i:s", ( time() - (86400 * (int)$default['de_point_days']) ) ); // 86400초는 하루
    $sql22 = " select * from {$g5['g5_shop_cart_table']} where ct_status = '배송' and ct_time <= '$beforedays' ";
$result22 = sql_query($sql22);
    for ($i=0; $row22=sql_fetch_array($result22); $i++) {

sql_query("update  {$g5['g5_shop_order_table']} A inner join {$g5['g5_shop_cart_table']} B on A.od_id=B.od_id and B.ct_status='배송'
set B.ct_status = '완료', A.od_status = '완료'
where A.od_invoice_time< now() - interval 7 day ");
}

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

회원로그인

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