Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    463
    Plugin Contributions
    0

    Default Why is zen_date_raw-function localized?

    The zen_date_raw-function is localized in every language file. In e.g. customers.php in admin however, the code runs as follows:
    Code:
    if (checkdate(substr(zen_date_raw($customers_dob), 4, 2), substr(zen_date_raw($customers_dob), 6, 2), substr(zen_date_raw($customers_dob), 0, 4))) {
    thereby breaking the localization!

  2. #2
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    463
    Plugin Contributions
    0

    Default Re: Why is zen_date_raw-function localized?

    DrByte any comment?

  3. #3
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    463
    Plugin Contributions
    0

    Default Re: Why is zen_date_raw-function localized?

    It's a fairly basic question!?

  4. #4
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Why is zen_date_raw-function localized?

    checkdate requires a specific format. The code you quoted is extracting specific digits to match that format.

    If you want to customize it to suit your specific needs, you will need to edit the numbers 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.

  5. #5
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    463
    Plugin Contributions
    0

    Default Re: Why is zen_date_raw-function localized?

    Ok, but as the zen_date_raw-function is localized, the actual format varies depending on language! I understand that this is not an issue in the US, but you pride yourself - and rightfully so - with a versatile and useful product. Unfortunately countries near me Finland and Sweden have different zen_date_raw-functions!

  6. #6
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Why is zen_date_raw-function localized?

    zen_date_raw-function is localized, the actual format varies depending on language
    What do you have set for date in your language.php file - as I think that this will cure your issue but maybe not
    Code:
      define('DATE_FORMAT_SHORT', '%m/%d/%Y');  // this is used for strftime()
      define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
      define('DATE_FORMAT', 'm/d/Y'); // this is used for date()

  7. #7
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    463
    Plugin Contributions
    0

    Default Re: Why is zen_date_raw-function localized?

    Dear Sirs, you seem to have forgotten what localization means!?

    I have two languages with different date formats:
    Code:
    define('DATE_FORMAT', 'd.m.Y'); // Finland
    and
    Code:
    define('DATE_FORMAT', 'Y-m-d'); // Sweden
    The checkdate-function should be able to handle both - of course - if ZenCart is truly localized; i.e. checkdate should use the format given in the language file!

  8. #8
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Why is zen_date_raw-function localized?

    You're asking for a confession that there's a limitation. So here it is: there is a limitation.

    To work around the limitations you're welcome to write the code you require to avoid the limitation, and share your fixes with the community.
    .
    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.

  9. #9
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    463
    Plugin Contributions
    0

    Default Re: Why is zen_date_raw-function localized?

    Not a confession, just the info if it's done already or if e.g. I need to do it! So let's see what I can come up with...

  10. #10
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    463
    Plugin Contributions
    0

    Default Re: Why is zen_date_raw-function localized?

    The only function I can find is zen_checkdate() - is there some kind of naming strategy?

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v155 How to call a php file localized in modules fold
    By su35 in forum General Questions
    Replies: 2
    Last Post: 26 Jul 2016, 09:05 PM
  2. v151 Why doesn't the Search function work on my store?
    By rubyyin in forum General Questions
    Replies: 20
    Last Post: 9 Apr 2014, 10:14 PM
  3. Help please! Zen_date_raw undefined function
    By johnnytv in forum General Questions
    Replies: 2
    Last Post: 26 Aug 2007, 07:49 PM

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