Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Featured/Specials, save dates when 'today' #6030

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions admin/featured.php
Expand Up @@ -42,7 +42,8 @@
$featured_date_available_raw = $dt->format('Y-m-d');
}
}
$featured_date_available = (date('Y-m-d') < $featured_date_available_raw) ? $featured_date_available_raw : '0001-01-01';
$featured_date_available = (date('Y-m-d') <= $featured_date_available_raw) ? $featured_date_available_raw : '0001-01-01';

$expires_date_raw = zen_db_prepare_input($_POST['expires_date']);
if (DATE_FORMAT_DATE_PICKER != 'yy-mm-dd' && !empty($expires_date_raw)) {
$local_fmt = zen_datepicker_format_fordate();
Expand All @@ -52,7 +53,7 @@
$expires_date_raw = $dt->format('Y-m-d');
}
}
$expires_date = (date('Y-m-d') < $expires_date_raw) ? $expires_date_raw : '0001-01-01';
$expires_date = (date('Y-m-d') <= $expires_date_raw) ? $expires_date_raw : '0001-01-01';

$db->Execute("INSERT INTO " . TABLE_FEATURED . " (products_id, featured_date_added, expires_date, status, featured_date_available)
VALUES (" . (int)$products_id . ", now(), '" . zen_db_input($expires_date) . "', 1, '" . zen_db_input($featured_date_available) . "')");
Expand All @@ -79,7 +80,8 @@
$featured_date_available_raw = $dt->format('Y-m-d');
}
}
$featured_date_available = (date('Y-m-d') < $featured_date_available_raw) ? $featured_date_available_raw : '0001-01-01';
$featured_date_available = (date('Y-m-d') <= $featured_date_available_raw) ? $featured_date_available_raw : '0001-01-01';

$expires_date_raw = zen_db_prepare_input($_POST['expires_date']);
if (DATE_FORMAT_DATE_PICKER != 'yy-mm-dd' && !empty($expires_date_raw)) {
$local_fmt = zen_datepicker_format_fordate();
Expand All @@ -89,7 +91,7 @@
$expires_date_raw = $dt->format('Y-m-d');
}
}
$expires_date = (date('Y-m-d') < $expires_date_raw) ? $expires_date_raw : '0001-01-01';
$expires_date = (date('Y-m-d') <= $expires_date_raw) ? $expires_date_raw : '0001-01-01';

$db->Execute("UPDATE " . TABLE_FEATURED . "
SET featured_last_modified = now(),
Expand Down
10 changes: 6 additions & 4 deletions admin/specials.php
Expand Up @@ -66,7 +66,8 @@
$specials_date_available_raw = $dt->format('Y-m-d');
}
}
$specials_date_available = (date('Y-m-d') < $specials_date_available_raw) ? $specials_date_available_raw : '0001-01-01';
$specials_date_available = (date('Y-m-d') <= $specials_date_available_raw) ? $specials_date_available_raw : '0001-01-01';

$expires_date_raw = zen_db_prepare_input($_POST['expires_date']);
if (DATE_FORMAT_DATE_PICKER != 'yy-mm-dd' && !empty($expires_date_raw)) {
$local_fmt = zen_datepicker_format_fordate();
Expand All @@ -76,7 +77,7 @@
$expires_date_raw = $dt->format('Y-m-d');
}
}
$expires_date = (date('Y-m-d') < $expires_date_raw) ? $expires_date_raw : '0001-01-01';
$expires_date = (date('Y-m-d') <= $expires_date_raw) ? $expires_date_raw : '0001-01-01';

$db->Execute("INSERT INTO " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status, specials_date_available)
VALUES (" . (int)$products_id . ", " . (float)$specials_price . ", now(), '" . zen_db_input($expires_date) . "', 1, '" . zen_db_input($specials_date_available) . "')");
Expand Down Expand Up @@ -119,7 +120,8 @@
$specials_date_available_raw = $dt->format('Y-m-d');
}
}
$specials_date_available = (date('Y-m-d') < $specials_date_available_raw) ? $specials_date_available_raw : '0001-01-01';
$specials_date_available = (date('Y-m-d') <= $specials_date_available_raw) ? $specials_date_available_raw : '0001-01-01';

$expires_date_raw = zen_db_prepare_input($_POST['expires_date']);
if (DATE_FORMAT_DATE_PICKER != 'yy-mm-dd' && !empty($expires_date_raw)) {
$local_fmt = zen_datepicker_format_fordate();
Expand All @@ -129,7 +131,7 @@
$expires_date_raw = $dt->format('Y-m-d');
}
}
$expires_date = (date('Y-m-d') < $expires_date_raw) ? $expires_date_raw : '0001-01-01';
$expires_date = (date('Y-m-d') <= $expires_date_raw) ? $expires_date_raw : '0001-01-01';

$db->Execute("UPDATE " . TABLE_SPECIALS . "
SET specials_new_products_price = '" . zen_db_input($specials_price) . "',
Expand Down