자동배송 완료 넘기기
본문
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에 넣는 것이 가장 좋을 듯합니다.
다음으로는
배송 상태를 확인하는 페이지 윗부분에 넣으면 되지 않을까요?
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 ");
정확한 것은 한번 테스트해 보시기 바랍니다.
답변을 작성하시기 전에 로그인 해주세요.