0

我是整个电子商务领域的新手,但我试图让 OpenCart 与 ShipStation 合作填写货运订单并处理它们的付款。但是,我在 ShipStation 扩展模块的 error_log 中收到此错误。

更新:应该发生的事情是当我在应用程序 ShipStation 上并单击商店中的更新时,它会向这个 export.php 脚本发送一个请求(这是给我的错误)。

2013-10-07 20:25:03 - PHP Notice:  Undefined offset: 1 in /home/begumbou/public_html/shipstation/controller/export.php on line 15
2013-10-07 20:25:03 - PHP Notice:  Undefined offset: 1 in /home/begumbou/public_html/shipstation/controller/export.php on line 15
2013-10-07 20:25:03 - PHP Notice:  Undefined offset: 2 in /home/begumbou/public_html/shipstation/controller/export.php on line 15
2013-10-07 20:25:03 - PHP Notice:  A non well formed numeric value encountered in /home/begumbou/public_html/shipstation/controller/export.php on line 15
2013-10-07 20:25:03 - PHP Notice:  A non well formed numeric value encountered in /home/begumbou/public_html/shipstation/controller/export.php on line 15
2013-10-07 20:25:03 - PHP Notice:  Undefined offset: 1 in /home/begumbou/public_html/shipstation/controller/export.php on line 22
2013-10-07 20:25:03 - PHP Notice:  Undefined offset: 1 in /home/begumbou/public_html/shipstation/controller/export.php on line 22
2013-10-07 20:25:03 - PHP Notice:  Undefined offset: 2 in /home/begumbou/public_html/shipstation/controller/export.php on line 22
2013-10-07 20:25:03 - PHP Notice:  A non well formed numeric value encountered in /home/begumbou/public_html/shipstation/controller/export.php on line 22
2013-10-07 20:25:03 - PHP Notice:  A non well formed numeric value encountered in /home/begumbou/public_html/shipstation/controller/export.php on line 22
2013-10-07 22:25:08 - PHP Notice:  Undefined offset: 1 in /home/begumbou/public_html/shipstation/controller/export.php on line 15
2013-10-07 22:25:08 - PHP Notice:  Undefined offset: 1 in /home/begumbou/public_html/shipstation/controller/export.php on line 15
2013-10-07 22:25:08 - PHP Notice:  Undefined offset: 2 in /home/begumbou/public_html/shipstation/controller/export.php on line 15
2013-10-07 22:25:08 - PHP Notice:  A non well formed numeric value encountered in /home/begumbou/public_html/shipstation/controller/export.php on line 15
2013-10-07 22:25:08 - PHP Notice:  A non well formed numeric value encountered in /home/begumbou/public_html/shipstation/controller/export.php on line 15
2013-10-07 22:25:08 - PHP Notice:  Undefined offset: 1 in /home/begumbou/public_html/shipstation/controller/export.php on line 22
2013-10-07 22:25:08 - PHP Notice:  Undefined offset: 1 in /home/begumbou/public_html/shipstation/controller/export.php on line 22
2013-10-07 22:25:08 - PHP Notice:  Undefined offset: 2 in /home/begumbou/public_html/shipstation/controller/export.php on line 22
2013-10-07 22:25:08 - PHP Notice:  A non well formed numeric value encountered in /home/begumbou/public_html/shipstation/controller/export.php on line 22
2013-10-07 22:25:08 - PHP Notice:  A non well formed numeric value encountered in /home/begumbou/public_html/shipstation/controller/export.php on line 22
2013-10-08 0:21:11 - PHP Notice:  Undefined offset: 1 in /home/begumbou/public_html/shipstation/controller/export.php on line 15
2013-10-08 0:21:11 - PHP Notice:  Undefined offset: 1 in /home/begumbou/public_html/shipstation/controller/export.php on line 15
2013-10-08 0:21:11 - PHP Notice:  Undefined offset: 2 in /home/begumbou/public_html/shipstation/controller/export.php on line 15
2013-10-08 0:21:11 - PHP Notice:  A non well formed numeric value encountered in /home/begumbou/public_html/shipstation/controller/export.php on line 15
2013-10-08 0:21:11 - PHP Notice:  A non well formed numeric value encountered in /home/begumbou/public_html/shipstation/controller/export.php on line 15
2013-10-08 0:21:11 - PHP Notice:  Undefined offset: 1 in /home/begumbou/public_html/shipstation/controller/export.php on line 22
2013-10-08 0:21:11 - PHP Notice:  Undefined offset: 1 in /home/begumbou/public_html/shipstation/controller/export.php on line 22
2013-10-08 0:21:11 - PHP Notice:  Undefined offset: 2 in /home/begumbou/public_html/shipstation/controller/export.php on line 22
2013-10-08 0:21:11 - PHP Notice:  A non well formed numeric value encountered in /home/begumbou/public_html/shipstation/controller/export.php on line 22
2013-10-08 0:21:11 - PHP Notice:  A non well formed numeric value encountered in /home/begumbou/public_html/shipstation/controller/export.php on line 22

第 15 行州

$data['startdate'] = date('Y-m-d H:i:s', mktime($starttime[0], $starttime[1], 0, $startdate[0], $startdate[1], $startdate[2]));

和第 22 行状态

$data['enddate'] = date('Y-m-d H:i:s', mktime($endtime[0], $endtime[1], 0, $enddate[0], $enddate[1], $enddate[2]));

这是所有代码放在一起

    if (isset($this->request->get['start_date'])) {
        $start_date_time = explode(' ', $this->request->get['start_date']);
        $startdate = explode('/', $start_date_time[0]);
        $starttime = explode(':', $start_date_time[1]);
        $data['startdate'] = date('Y-m-d H:i:s', mktime($starttime[0], $starttime[1], 0, $startdate[0], $startdate[1], $startdate[2]));
    }

    if (isset($this->request->get['end_date'])) {
        $end_date_time = explode(' ', $this->request->get['end_date']);
        $enddate = explode('/', $end_date_time[0]);
        $endtime = explode(':', $end_date_time[1]);
        $data['enddate'] = date('Y-m-d H:i:s', mktime($endtime[0], $endtime[1], 0, $enddate[0], $enddate[1], $enddate[2]));

更新错误日志

[08-Oct-2013 17:33:39 UTC] Array
(
    [0] => 01%3a08
)

[08-Oct-2013 17:33:39 UTC] Array
(
    [0] => 17%3a33
)

这是在 raw_error_logs 上,它与上面给出的数组匹配。

162.209.46.39 - - [08/Oct/2013:13:33:39 -0400] "GET /shipstation/index.php?action=export&start_date=10%2f08%2f2013+01%3a08&end_date=10%2f08%2f2013+17%3a33&page=1&SS-UserName=R4ND0ML3TT3RSANDNUB3RS1T00K0UT&SS-Password=R4ND0ML3TT3RSANDNUB3RS1T00K0UT HTTP/1.1" 302 448 "-" "ShipStation"
4

1 回答 1

1

使用您提供的 GET 链接GET /shipstation/index.php?action=export&start_date=10%2f08%2f2013+01%3a08&...,不应发生通知。

通知会在您预期的时间start_dateend_date格式不同的情况下出现。

替换您的代码:

if (isset($this->request->get['start_date'])) { ... }
if (isset($this->request->get['end_date'])) { ... }

和:

foreach (array('start_date', 'end_date') as $field) {
    if (!isset($this->request->get[$field])) continue;
    $date = $this->request->get[$field];
    try {
        $dt = new DateTime($date);
        $data[str_replace('_', '', $field)] = $dt->format('Y-m-d H:i:s');
    } catch (Exception $e) {
        exit("ERROR: Field '{$field}' has invalid datetime format = '{$date}' ({$e->getMessage()})");
    }
}

看看是否发生错误。

于 2013-10-12T09:45:14.430 回答