Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2012
    Location
    yogyakarta, indonesia
    Posts
    16
    Plugin Contributions
    2

    Default v157 DATE_FORMAT_DATE_PICKER error, if date format change and update product.

    v157 DATE_FORMAT_DATE_PICKER error, if date format change and update product.

    Can I change the 32-line code in admin / includes / languages ​​/ english.php or in my native language?

    define ('DATE_FORMAT_DATE_PICKER', 'yy-mm-dd'); // Use only 'dd', 'mm' and 'yy' here in any order

    I tried modifying the DATE_FORMAT_DATE_PICKER format to the 'dd-mm-yy' format, but when I updated the product,
    Admin dashboard cannot appear.

    (This page isn't workinglocalhost is currently unable to handle this request.
    HTTP ERROR 500

    And the LOG file says:

    [30-Jun-2020 01:46:28 Europe / Berlin] Request URI: /toko_zc157/blUrt-CXC-cRisp/index.php?cmd=product&cPath=4&pID=2&action=update_product, IP address: :: 1
    -> PHP Fatal error: Uncaught Error: Call to a member function format () on bool in D: \ xampp \ htdocs \ toko_zc157 \ blUrt-CXC-cRisp \ includes \ modules \ update_product.php: 22
    Stack trace:
    # 0 D: \ xampp \ htdocs \ toko_zc157 \ blUrt-CXC-cRisp \ product.php (33): require ()
    # 1 D: \ xampp \ htdocs \ toko_zc157 \ blUrt-CXC-cRisp \ index.php (11): require ('D: \\ xampp \\ htdocs ...')
    # 2 {play}
    thrown in D: \ xampp \ htdocs \ toko_zc157 \ blUrt-CXC-cRisp \ includes \ modules \ update_product.php on line 22.

    thank

  2. #2
    Join Date
    Jul 2012
    Posts
    16,778
    Plugin Contributions
    17

    Default Re: v157 DATE_FORMAT_DATE_PICKER error, if date format change and update product.

    Were you in the middle of editing the product when the language date define was changed? I modified just that text as described, logged into admin, navigated to a product, edited the available date to tomorrow, did an update and then a confirm... stored fine for the date entered...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Mar 2012
    Location
    yogyakarta, indonesia
    Posts
    16
    Plugin Contributions
    2

    Default Re: v157 DATE_FORMAT_DATE_PICKER error, if date format change and update product.

    Quote Originally Posted by mc12345678 View Post
    Were you in the middle of editing the product when the language date define was changed? I modified just that text as described, logged into admin, navigated to a product, edited the available date to tomorrow, did an update and then a confirm... stored fine for the date entered...

    Steps I get an error :;
    1. Fresh install of v157 with product samples.
    2. admin/includes/languages/english.php, line no. 32 change format date, from 'yy-mm-dd' to 'dd-mm-yy'.
    3. Catalog -> Categories/Products -> Hardware -> Graphics Cards
    4. Click the "Edit Product" button in any product
    5. Click the "Preview" button (without editing any thing / leave the Date Available field is empty)
    6. Click the "Update" button

    ERROR appears:

    This page isn't working
    localhost is currently unable to handle this request.
    HTTP ERROR 500

  4. #4
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,748
    Plugin Contributions
    11

    Default Re: v157 DATE_FORMAT_DATE_PICKER error, if date format change and update product.

    Quote Originally Posted by ihangat2000 View Post
    Steps I get an error :;
    1. Fresh install of v157 with product samples.
    2. admin/includes/languages/english.php, line no. 32 change format date, from 'yy-mm-dd' to 'dd-mm-yy'.
    3. Catalog -> Categories/Products -> Hardware -> Graphics Cards
    4. Click the "Edit Product" button in any product
    5. Click the "Preview" button (without editing any thing / leave the Date Available field is empty)
    6. Click the "Update" button

    ERROR appears:

    This page isn't working
    localhost is currently unable to handle this request.
    HTTP ERROR 500
    the problem is if the date is empty. i can confirm this bug.

    $dt comes up as FALSE if the $products_date_available is blank. resulting in the:

    [29-Jun-2020 22:21:51 America/Los_Angeles] PHP Fatal error: Uncaught Error: Call to a member function format() on bool in /var/www/base157/admin/includes/modules/update_product.php:22

    i would suggest line 19 in

    admin/includes/modules/update_product.php

    changed to:

    PHP Code:
    if (DATE_FORMAT_DATE_PICKER != 'yy-mm-dd' && !empty($products_date_available)) 
    best.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  5. #5
    Join Date
    Mar 2012
    Location
    yogyakarta, indonesia
    Posts
    16
    Plugin Contributions
    2

    Default Re: v157 DATE_FORMAT_DATE_PICKER error, if date format change and update product.

    Quote Originally Posted by carlwhat View Post
    the problem is if the date is empty. i can confirm this bug.

    $dt comes up as FALSE if the $products_date_available is blank. resulting in the:

    [29-Jun-2020 22:21:51 America/Los_Angeles] PHP Fatal error: Uncaught Error: Call to a member function format() on bool in /var/www/base157/admin/includes/modules/update_product.php:22

    i would suggest line 19 in

    admin/includes/modules/update_product.php

    changed to:

    PHP Code:
    if (DATE_FORMAT_DATE_PICKER != 'yy-mm-dd' && !empty($products_date_available)) 
    best.

    Thank you for your explanation

  6. #6
    Join Date
    Jul 2012
    Posts
    16,778
    Plugin Contributions
    17

    Default Re: v157 DATE_FORMAT_DATE_PICKER error, if date format change and update product.

    I would recommend localizing the "check" more to the specific line where this "boolean" (false) result was provided... though both tests provide some support.

    It is possible to provide information that doesn't fit the necessary/requested format and the sequence is not the default of 'yy-mm-dd'. This causes $dt to be set to false and therefore $dt->format... will cause the error previously seen.

    So, either a test of the existence of the method 'format' for the object, a test of emptiness of the $dt variable, or maybe a test of strict falseness against $dt... I would recommend the first one to further the code becoming more OOP. The second one is more along the lines of where things have been going, though a mixture of the two may be necessary.

    But, to prevent php operation from ending, I changed:
    Code:
        $dt = DateTime::createFromFormat($local_fmt, $products_date_available); 
        $products_date_available = $dt->format('Y-m-d');
    To:
    Code:
        $dt = DateTime::createFromFormat($local_fmt, $products_date_available); 
        $products_date_available = 'null';
        if (!empty($dt)) {
            $products_date_available = $dt->format('Y-m-d');
        }
    This way, the entered $products_date_available would be attempted to be converted, but if it fails causing $dt === false, then the captured value is a nothing value, though perhaps it should instead be whatever it was before through some sort of notification and return to edit...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Mar 2012
    Posts
    132
    Plugin Contributions
    0

    Default Re: v157 DATE_FORMAT_DATE_PICKER error, if date format change and update product.

    Hi,

    thank you again mc1234567! I can confirm this datetime "bug" is still haunting us with the 1.5.8 version too. Also found something else regarding /admin/includes/modules/update_product.php file but perhaps I will start a new thread because my solution to fix it was not very eloquent and the real problem lies elsewhere.

  8. #8
    Join Date
    Mar 2012
    Posts
    132
    Plugin Contributions
    0

    Default Re: v157 DATE_FORMAT_DATE_PICKER error, if date format change and update product.

    Quote Originally Posted by OopsIbrickedIT View Post
    Hi,

    thank you again mc1234567! I can confirm this datetime "bug" is still haunting us with the 1.5.8 version too. Also found something else regarding /admin/includes/modules/update_product.php file but perhaps I will start a new thread because my solution to fix it was not very eloquent and the real problem lies elsewhere.
    Actually it is not a probelm anymore, there was an missing file with helper classes which did not get ulpoaded. It contains all the necessesary functions to sort out date time conversions in 1.5.8. My bad.

  9. #9
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,320
    Plugin Contributions
    11

    Default Re: v157 DATE_FORMAT_DATE_PICKER error, if date format change and update product.

    Here's where you might want to share in case someone else experiences the problem.

 

 

Similar Threads

  1. Date Format Change
    By gprit in forum General Questions
    Replies: 2
    Last Post: 28 Mar 2011, 03:55 PM
  2. "This Product was added to our Catalog" -- change date format?
    By chris32882 in forum General Questions
    Replies: 7
    Last Post: 25 Oct 2008, 12:27 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