Im new to the whole ecommerce scene, but im trying to get it where OpenCart will work with ShipStation to fill out shipment orders and handle the payments of them. However im getting this error in the error_log for the ShipStation extension module.
UPDATE: Whats supposed to happen is when im on the app ShipStation and click Update from stores, it sends a request to this export.php script (thats shooting me the error).
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
line 15 states
$data['startdate'] = date('Y-m-d H:i:s', mktime($starttime[0], $starttime[1], 0, $startdate[0], $startdate[1], $startdate[2]));
and line 22 states
$data['enddate'] = date('Y-m-d H:i:s', mktime($endtime[0], $endtime[1], 0, $enddate[0], $enddate[1], $enddate[2]));
Heres all the code put together
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]));
UPDATE ERROR_LOG
[08-Oct-2013 17:33:39 UTC] Array
(
[0] => 01%3a08
)
[08-Oct-2013 17:33:39 UTC] Array
(
[0] => 17%3a33
)
this was on the raw_error_logs, it matches the array given above.
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"
With GET link you have given GET /shipstation/index.php?action=export&start_date=10%2f08%2f2013+01%3a08&...
, notices should not happen.
Notices come when start_date
or end_date
are in different format than you expect.
Replace your code:
if (isset($this->request->get['start_date'])) { ... }
if (isset($this->request->get['end_date'])) { ... }
with:
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()})");
}
}
and see if error happens.