Page 1 of 3 123 LastLast
Results 1 to 10 of 28
  1. #1
    Join Date
    May 2014
    Location
    UK
    Posts
    317
    Plugin Contributions
    0

    Default products_date_available no longer NULL

    Hi all

    When I checked the Products Expected in Admin I found around 2,700 books being listed when in fact there are only 5.

    I've made the changes in the FAQ to change the display of US date format to UK date format in both the catalog english.php and the admin english.php and I have reset the products_date_available column to NULL for all records:

    I then trialled adding a new record with no date expected date. In the MySQl database the products_date_available displays as:

    0000:00:00 00:00:00

    which from what I have read means that whatever date is being handled does not conform to the correct date format for the database and therefore is not set to NULL. The new record shows as a product in the Products Expected list even though it's not.

    After I enter a record with an expected date (using the calendar selection - eg. 23 Mar 2016) when I edit the record that date shows in the Admin edit field as 2016-23-03 - so still in US format,

    I am struggling to find where the column is populated with the zeroes instead of a NULL value.

    Can anyone point me to where I should be looking please?

    From the count in the database the first 8,000-odd records had a NULL value (v1.5.0) with the remainder being zeros (from v1.5.3 onwards).


    Thanks

  2. #2
    Join Date
    May 2014
    Location
    UK
    Posts
    317
    Plugin Contributions
    0

    Default Re: products_date_available no longer NULL

    Ok scrap the bit about the date displaying wrong in Admin after entering an Expected date - that is now working.

    What I have found though is that if after setting the whole column to NULL you then amend an existing record it saves the zeroes back to products_date_available instead of leaving it has NULL ... this therefore forces that book to be listed in the Admin Products Expected listing.

    I'm guessing therefore that something has changed somewhere in the update_product.php on the later versions of Zen-Cart becuase under v1.5.0 it left it as NULL.

    Just cannot figure out where that change is taking place though :/

  3. #3
    Join Date
    May 2014
    Location
    UK
    Posts
    317
    Plugin Contributions
    0

    Default Re: products_date_available no longer NULL

    The edited Book now shows 0000-00-00 in the Exoected date field when editing the record and under the Products Expected Listing it shows a date of 30/11/2036

  4. #4
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: products_date_available no longer NULL

    So the default install has that field marked as NULL, so it would seem that something about the other changes performed is causing your issue... As to the date way out in the future like that, that's what happens in PHP wth a date of 0000-00-00...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    May 2014
    Location
    UK
    Posts
    317
    Plugin Contributions
    0

    Default Re: products_date_available no longer NULL

    Quote Originally Posted by mc12345678 View Post
    So the default install has that field marked as NULL, so it would seem that something about the other changes performed is causing your issue... As to the date way out in the future like that, that's what happens in PHP wth a date of 0000-00-00...

    From the time I started using v1.5.3 and then copied the database over and updated it to v1.5.4 I hadn't picked up that all new records were populating that field with all zeroes.. I have reset all the the records to NULL using an SQL query. So when I then edit any record and save it back to the database it changes NULL to the zeroes again.

    I've looked through quite a few of what I think are the relevant PHP files in Admin but cannot see anywhere where it could be doing that...

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

    Default Re: products_date_available no longer NULL

    Quote Originally Posted by DigiBooks View Post
    From the time I started using v1.5.3 and then copied the database over and updated it to v1.5.4 I hadn't picked up that all new records were populating that field with all zeroes.. I have reset all the the records to NULL using an SQL query. So when I then edit any record and save it back to the database it changes NULL to the zeroes again.

    I've looked through quite a few of what I think are the relevant PHP files in Admin but cannot see anywhere where it could be doing that...
    Already mentioned update_info (for the product type of your merch, there's also collect_info which preps the data for display... How do all of these product type files differ from a vanilla install? What product type is in question? Have you tried this operation using a different product type to see how it behaves? (Sort of like using a different template when troubleshooting display issues...)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    May 2014
    Location
    UK
    Posts
    317
    Plugin Contributions
    0

    Default Re: products_date_available no longer NULL

    I have come across this line in admin/includes/unctions/general.php:

    return preg_replace('/2037$/', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037)));

    which comes with the standard installation but I'm not sure why it's there or what it means!

  8. #8
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: products_date_available no longer NULL

    Quote Originally Posted by DigiBooks View Post
    I have come across this line in admin/includes/unctions/general.php:

    return preg_replace('/2037$/', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037)));

    which comes with the standard installation but I'm not sure why it's there or what it means!
    Allows a date beyond the php cutoff... There were some in the last year that needed to be able to address dates greater than 21 years away. That will take the year 2037 out of the "string" and substitute the applicable date if you understand it correctly...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #9
    Join Date
    May 2014
    Location
    UK
    Posts
    317
    Plugin Contributions
    0

    Default Re: products_date_available no longer NULL

    Quote Originally Posted by mc12345678 View Post
    Already mentioned update_info (for the product type of your merch, there's also collect_info which preps the data for display... How do all of these product type files differ from a vanilla install? What product type is in question? Have you tried this operation using a different product type to see how it behaves? (Sort of like using a different template when troubleshooting display issues...)
    Ok Products General is the norm - that's putting the zeroes in - Documents General is putting NULL into the database

  10. #10
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: products_date_available no longer NULL

    Quote Originally Posted by DigiBooks View Post
    Ok Products General is the norm - that's putting the zeroes in - Documents General is putting NULL into the database
    So, something is different about the files for the product than product_document... And more than likely that difference may be seen by comparing your files against a vanilla set... There's not many files to compare in that sub-folder...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 7
    Last Post: 4 May 2016, 01:59 AM
  2. Get products_date_available
    By mprough in forum General Questions
    Replies: 4
    Last Post: 10 Sep 2014, 01:40 PM
  3. Replies: 3
    Last Post: 24 Sep 2012, 07:08 PM
  4. Replies: 11
    Last Post: 15 Jan 2010, 04:44 PM
  5. Adding products_date_available field in product_listing.php
    By Camel in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 29 Nov 2006, 08:41 AM

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