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

    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
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    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!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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
    1

    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
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    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!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    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!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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
    1

    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
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    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!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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
    1

    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
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    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!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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. v151 php arrays for inserting into one database field
    By delia in forum General Questions
    Replies: 8
    Last Post: 11 Sep 2013, 03:27 PM
  2. v139b Database inserting into upgrade
    By Philibel in forum Upgrading to 1.5.x
    Replies: 2
    Last Post: 23 Feb 2013, 10:37 PM
  3. Inserting a string into PHP
    By bhensarl in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 5 Nov 2010, 11:46 AM
  4. Occasional orders not going into the database
    By colonel_t in forum Managing Customers and Orders
    Replies: 21
    Last Post: 27 Apr 2008, 08:16 AM
  5. Orders not going into database -- SkipJack payment module
    By usr226197 in forum Managing Customers and Orders
    Replies: 2
    Last Post: 5 Sep 2006, 02:21 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR