Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2009
    Posts
    51
    Plugin Contributions
    2

    Default 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?

  2. #2
    Join Date
    Jan 2004
    Posts
    60,443
    Blog Entries
    4
    Plugin Contributions
    51

    Default 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.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.



  3. #3
    Join Date
    Oct 2009
    Posts
    51
    Plugin Contributions
    2

    Default Re: creating a order using zencart order functions

    Quote Originally Posted by DrByte View Post
    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

  4. #4
    Join Date
    Jan 2004
    Posts
    60,443
    Blog Entries
    4
    Plugin Contributions
    51

    Default 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.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.



  5. #5
    Join Date
    Jan 2004
    Posts
    60,443
    Blog Entries
    4
    Plugin Contributions
    51

    Default Re: creating a order using zencart order functions

    Quote Originally Posted by AmazonPayments View Post
    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.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.



  6. #6
    Join Date
    Oct 2009
    Posts
    51
    Plugin Contributions
    2

    Default Re: creating a order using zencart order functions

    Quote Originally Posted by DrByte View Post
    "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

  7. #7
    Join Date
    Jan 2004
    Posts
    60,443
    Blog Entries
    4
    Plugin Contributions
    51

    Default 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.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.



  8. #8
    Join Date
    Oct 2009
    Posts
    51
    Plugin Contributions
    2

    Default Re: creating a order using zencart order functions

    Quote Originally Posted by DrByte View Post
    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.

  9. #9
    Join Date
    Jan 2004
    Posts
    60,443
    Blog Entries
    4
    Plugin Contributions
    51

    Default 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
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.



 

 

Similar Threads

  1. Date corrections in Checkout By Amazon module
    By AmazonPayments in forum Addon Payment Modules
    Replies: 1
    Last Post: 27 Aug 2010, 10:05 AM
  2. Database and date format
    By Unicorn in forum General Questions
    Replies: 5
    Last Post: 9 Jun 2010, 08:42 AM
  3. Problem inserting DOCUMENT-GENERAL product Type (DATABASE)
    By JLA in forum Upgrading from 1.3.x to 1.3.9
    Replies: 3
    Last Post: 13 May 2010, 11:05 PM
  4. Inserting a product directly in to the database
    By ryudice in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 4 May 2008, 10:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •