date problems inserting amazonpayments orders into database
Hi all,
I am creating the order using the order classes available in zencart. when creating the order, i used to pass 'now()' for date_purchase field in $order->info so that purchase date is updated.
but it seems that it is not working or it is throwing a date 11/30/1999 00:00:00
what is the best way to pass the date? should i just pass the gmdate() string?
Re: creating a order using zencart order functions
now() is correct and uses the database server's date/time. If it's not storing correctly, then you've got something amuck with your database. If it's not displaying correctly, then you've likely got something amuck with your date formats.
You shouldn't have to duplicate a whole lot of code to create orders. Best to simply invoke the built-in orders class and use its methods to do the real work. Any other duplication of code that you do will just make more work for you to maintain and great headaches for the merchants using your code.
Re: creating a order using zencart order functions
Quote:
Originally Posted by
DrByte
now() is correct and uses the database server's date/time. If it's not storing correctly, then you've got something amuck with your database. If it's not displaying correctly, then you've likely got something amuck with your date formats.
You shouldn't have to duplicate a whole lot of code to create orders. Best to simply invoke the built-in orders class and use its methods to do the real work. Any other duplication of code that you do will just make more work for you to maintain and great headaches for the merchants using your code.
somehow that now() isnt working. i parsed the date from the order report from amazon which has some thing like
Code:
<OrderDate>2009-11-26T12:48:18.000Z</OrderDate>
but there will be a timezone issue. the above date is PDT.
In zencart, how can i find the timezone that the site uses for all orders and convert the time reported to the site's time zone so that all orders from Amazon are consistent with orders from other payment gateways.
- Bala
Re: creating a order using zencart order functions
"2009-11-26T12:48:18.000Z" is not in "YYYY-MM-DD HH:MM:SS" format which MySQL uses. If you're sending the date as 2009-11-26T12:48:18.000Z then I'm not surprised that it's converting it to something else.
Re: creating a order using zencart order functions
Quote:
Originally Posted by
AmazonPayments
In zencart, how can i find the timezone that the site uses for all orders and convert the time reported to the site's time zone so that all orders from Amazon are consistent with orders from other payment gateways.
Zen Cart v1.x does nothing special with timezones. It simply relies on the date/time of the server on which it is running.
Re: creating a order using zencart order functions
Quote:
Originally Posted by
DrByte
"2009-11-26T12:48:18.000Z" is not in "YYYY-MM-DD HH:MM:SS" format which MySQL uses. If you're sending the date as 2009-11-26T12:48:18.000Z then I'm not surprised that it's converting it to something else.
I parse the date and send it in a mysql supported format as you suggested. it works after sending it in that way.
my concern is the time. I send the date time as 2009-11-26 12:48:18 which is from the order report. That time is a PDT one. what if a merchant hosted his store in which PDT is default?
In that case, i have to convert them to the desired timezone where the store is located. any idea on how to do it?
- Bala
Re: creating a order using zencart order functions
Write something in one of the files you've got on the store's server, asking it what the time is. Calculate the difference from yours, and send the results accordingly.
Re: creating a order using zencart order functions
Quote:
Originally Posted by
DrByte
Write something in one of the files you've got on the store's server, asking it what the time is. Calculate the difference from yours, and send the results accordingly.
Thank you DrByte. i will try to fix it.
Re: creating a order using zencart order functions
Your posts containing fixes have been moved to their own thread: http://www.zen-cart.com/forum/showth...552#post927552