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
Re: Featured/Special Products Active From date cant be today
Quote:
Originally Posted by
gothstone
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';
Re: Featured/Special Products Active From date cant be today
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
Re: Featured/Special Products Active From date cant be today
Quote:
Originally Posted by
lat9
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?
Re: Featured/Special Products Active From date cant be today
Quote:
Originally Posted by
mc12345678
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/
Re: Featured/Special Products Active From date cant be today
Quote:
Originally Posted by
lat9
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.
Re: Featured/Special Products Active From date cant be today
Quote:
Originally Posted by
mc12345678
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.