网站开发 · 2025年4月26日

Zen Cart客户下单时间和订单更新时间与客户所在时区时间不一致

如果Zen Cart服务器所设置的时区和客户所在的时区不一致,就会导致PHP默认调用的系统时间错误,导致订单时间和客户的下单实际时间有差距。

此种情况特别合适 服务器或者VPS上放有多个站点,每个站点所面对的客户不一样。客户所在的时区不一样时。通过如下设置,将在客户注册下单时,提示的时间修改为何客户所在时区时间保持一致的情况。

涉及到要修改的文件列表:
./YOUR_ADMIN/includes/configure.php
./includes/configure.php

./YOUR_ADMIN/includes/functions/database.php
./YOUR_ADMIN/tracker.php
./YOUR_ADMIN/orders.php

./includes/functions/functions_general.php
./includes/modules/pages/login/header_php.php
./includes/modules/create_account.php

1,在前台与后台的配置文件中添加常量定义:

分别打开
./YOUR_ADMIN/includes/configure.php
./includes/configure.php

这两个文件

增加

define('TIME_ZONE_OFFSET', 7);

常量定义。

2,将相关文件中的   ./YOUR_ADMIN/includes/functions/database.php ./YOUR_ADMIN/tracker.php ./YOUR_ADMIN/orders.php   ./includes/functions/functions_general.php ./includes/modules/pages/login/header_php.php ./includes/modules/create_account.php 时间 now() ,修改为   1 date_add(now(), INTERVAL ” . TIME_ZONE_OFFSET . ” HOUR) 保存手工,完毕