Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2005
    Posts
    309
    Plugin Contributions
    0

    Default Featured/Special Products Active From date cant be today

    https://dev.pezcollectors.com/blank
    ZC1.5.8
    Only display logs plugin
    PHP 8.1.24
    MariaDB 10.6.15

    When adding a new special or featured product, or editing an existing one, the active from aka featured_date_available does not take UNLESS it's a future date. If you select today or in the past, it uses the default of 0001-01-01
    2 + 2 = 5 for extremely large values of 2

    Pez Collectors Store

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,499
    Plugin Contributions
    88

    Default Re: Featured/Special Products Active From date cant be today

    Quote Originally Posted by gothstone View Post
    https://dev.pezcollectors.com/blank
    ZC1.5.8
    Only display logs plugin
    PHP 8.1.24
    MariaDB 10.6.15

    When adding a new special or featured product, or editing an existing one, the active from aka featured_date_available does not take UNLESS it's a future date. If you select today or in the past, it uses the default of 0001-01-01
    That's expected behavior for dates in the past, but a featured/special product starting "today" should be accepted and recorded.

    For the /admin/featured.php, find the statements (2 each) that currently read
    Code:
          $featured_date_available = (date('Y-m-d') < $featured_date_available_raw) ? $featured_date_available_raw : '0001-01-01';
    
          $expires_date = (date('Y-m-d') < $expires_date_raw) ? $expires_date_raw : '0001-01-01';
    and change to
    Code:
          $featured_date_available = (date('Y-m-d') <= $featured_date_available_raw) ? $featured_date_available_raw : '0001-01-01';
    
          $expires_date = (date('Y-m-d') <= $expires_date_raw) ? $expires_date_raw : '0001-01-01';
    Similarly, for the /admin/specials.php, find the statements (2 each) that currently read
    Code:
          $specials_date_available = (date('Y-m-d') < $specials_date_available_raw) ? $specials_date_available_raw : '0001-01-01';
    
          $expires_date = (date('Y-m-d') < $expires_date_raw) ? $expires_date_raw : '0001-01-01';
    and change to
    Code:
          $specials_date_available = (date('Y-m-d') <= $specials_date_available_raw) ? $specials_date_available_raw : '0001-01-01';
    
          $expires_date = (date('Y-m-d') <= $expires_date_raw) ? $expires_date_raw : '0001-01-01';

  3. #3
    Join Date
    Jun 2005
    Posts
    309
    Plugin Contributions
    0

    Default Re: Featured/Special Products Active From date cant be today

    Thank you lat9!
    2 + 2 = 5 for extremely large values of 2

    Pez Collectors Store

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,499
    Plugin Contributions
    88

    Default Re: Featured/Special Products Active From date cant be today

    You're very welcome. See this GitHub PR for resolution: https://github.com/zencart/zencart/pull/6030

  5. #5
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: Featured/Special Products Active From date cant be today

    Quote Originally Posted by lat9 View Post
    That's expected behavior for dates in the past, but a featured/special product starting "today" should be accepted and recorded.

    For the /admin/featured.php, find the statements (2 each) that currently read
    Code:
          $featured_date_available = (date('Y-m-d') < $featured_date_available_raw) ? $featured_date_available_raw : '0001-01-01';
    
          $expires_date = (date('Y-m-d') < $expires_date_raw) ? $expires_date_raw : '0001-01-01';
    and change to
    Code:
          $featured_date_available = (date('Y-m-d') <= $featured_date_available_raw) ? $featured_date_available_raw : '0001-01-01';
    
          $expires_date = (date('Y-m-d') <= $expires_date_raw) ? $expires_date_raw : '0001-01-01';
    Similarly, for the /admin/specials.php, find the statements (2 each) that currently read
    Code:
          $specials_date_available = (date('Y-m-d') < $specials_date_available_raw) ? $specials_date_available_raw : '0001-01-01';
    
          $expires_date = (date('Y-m-d') < $expires_date_raw) ? $expires_date_raw : '0001-01-01';
    and change to
    Code:
          $specials_date_available = (date('Y-m-d') <= $specials_date_available_raw) ? $specials_date_available_raw : '0001-01-01';
    
          $expires_date = (date('Y-m-d') <= $expires_date_raw) ? $expires_date_raw : '0001-01-01';
    So what about a product itself becoming available today? It too has suffered the same issue as you yourself have previously found out and reported on github.

    Technically, today has already passed from a date only record, so what extra benefit is there in making this change?
    Why not allow entry of any date, whether current, future or past? Would it not then get "accepted and recorded" as previously stated?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,499
    Plugin Contributions
    88

    Default Re: Featured/Special Products Active From date cant be today

    Quote Originally Posted by mc12345678 View Post
    So what about a product itself becoming available today? It too has suffered the same issue as you yourself have previously found out and reported on github.

    Technically, today has already passed from a date only record, so what extra benefit is there in making this change?
    Why not allow entry of any date, whether current, future or past? Would it not then get "accepted and recorded" as previously stated?
    See the Zen Cart documentation on the features:

    https://docs.zen-cart.com/user/produ...art_end_dates/
    https://docs.zen-cart.com/user/products/product_edit/
    https://docs.zen-cart.com/user/produ...ming_products/

  7. #7
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: Featured/Special Products Active From date cant be today

    I forgot how much had been changed about this coding and processing of dates. For example, if in update or creation of either of these, the end date is in the past (supposed to remain off) then the item gets stored to remain on indefinitely.... yup, that checks with all of those instructions, sure.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,499
    Plugin Contributions
    88

    Default Re: Featured/Special Products Active From date cant be today

    Quote Originally Posted by mc12345678 View Post
    I forgot how much had been changed about this coding and processing of dates. For example, if in update or creation of either of these, the end date is in the past (supposed to remain off) then the item gets stored to remain on indefinitely.... yup, that checks with all of those instructions, sure.
    Thanks for the bug report; the sarcasm was not necessary.

 

 

Similar Threads

  1. Using date picker in featured and special pages
    By edadk in forum Bug Reports
    Replies: 2
    Last Post: 8 Sep 2019, 05:38 AM
  2. control order of special products and featured products
    By dmitriy2012 in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 17 Aug 2012, 11:14 AM
  3. delete "Date Added: time and hour" from featured products page
    By matteoraggi in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 10 Dec 2007, 04:07 AM
  4. Why Can't I See The Expiry Date On Special or Featured Product?
    By Robert T in forum Setting Up Specials and SaleMaker
    Replies: 4
    Last Post: 13 Mar 2007, 10:24 PM
  5. Question about Special Products and Featured Products Display
    By kaleidoscopecards in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 17 Feb 2007, 06:19 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