Date corrections in Checkout By Amazon module
There is a bug when calling the order table update in the code amazonorder.php.
buggy line
PHP Code:
$sql_order_date_update = "UPDATE ".TABLE_ORDERS." set date_purchased = '".$data->getOrderDate()."' where orders_id = '$insert_id'";
Fixed line
PHP Code:
$sql_order_date_update = "UPDATE ".TABLE_ORDERS." set date_purchased = ".$data->getOrderDate()." where orders_id = '$insert_id'";
the issue is, getOrderDate returns 'now()'. the buggy line is again wrapped with single quote and hence the date is random.
In SQL query, when using now() mysql function, they should *not* be wrapped with quote. Now i got it working :)
Re: creating a order using zencart order functions
one more addition to the fix on a different file
File: checkout_by_amazon\modules\order\MFAXMLParser.php
Method : getOrderDate();
change the line 212
PHP Code:
return $yyyyMMdd . ' ' . $hhmmss;
to
PHP Code:
return "'".$yyyyMMdd . ' ' . $hhmmss."'";
Note: Make sure you test it on your sandbox server before updating it in production code.