From 28a464469444502a73f449483849b54252f53438 Mon Sep 17 00:00:00 2001 From: mattgoud Date: Tue, 2 Jun 2026 14:32:12 +0200 Subject: [PATCH] Fix SQL queries using NOW() with MySQL timezone instead of shop timezone Replace NOW() in raw SQL queries with PHP's date() so that the shop's configured timezone is always used instead of the MySQL server timezone (UTC). Fixes PrestaShop/PrestaShop#30828 Co-Authored-By: Claude Sonnet 4.6 --- statssearch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/statssearch.php b/statssearch.php index 2ab540e..32646e1 100644 --- a/statssearch.php +++ b/statssearch.php @@ -91,7 +91,7 @@ public function uninstall() public function hookActionSearch($params) { $sql = 'INSERT INTO `' . _DB_PREFIX_ . 'statssearch` (`id_shop`, `id_shop_group`, `keywords`, `results`, `date_add`) - VALUES (' . (int) $this->context->shop->id . ', ' . (int) $this->context->shop->id_shop_group . ', \'' . pSQL($params['expr']) . '\', ' . (int) $params['total'] . ', NOW())'; + VALUES (' . (int) $this->context->shop->id . ', ' . (int) $this->context->shop->id_shop_group . ', \'' . pSQL($params['expr']) . '\', ' . (int) $params['total'] . ', \'' . date('Y-m-d H:i:s') . '\')'; Db::getInstance()->execute($sql); }