Jump to content

Edit History

Florian_29298

Florian_29298

Hello everyone !

I have a problem that I have been unable to solve for several weeks with time zone.

My server configuration :

  • Prestashop is configured with Paris time zone.
  • Debian server which hosts my PHP and MYSQL is configured with London time zone.
  • PHP and MYSQL are configured with the London time zone.

When a coupon is automatically generated, its validity start date at the present time of Paris.

However, this coupon is not highlighted (in checkout page) on Prestashop because since Prestashop 1.7.4, the highlighting function retrieves all coupons between the present time of the MYSQL server (with NOW() function) and the end of the day.

Highlighted function in Prestashop < 1.7.4 in /classes/CartRule.php:384 :

$sql_part2 = ' AND cr.date_from < "' . date('Y-m-d H:i:59') . '"
				AND cr.date_to > "' . date('Y-m-d H:i:59') . '"
				' . ($active ? 'AND cr.`active` = 1' : '') . '
				' . ($inStock ? 'AND cr.`quantity` > 0' : '');

Highlighted function in Prestashop > 1.7.4 :

$sql_part2 = ' AND NOW() BETWEEN cr.date_from AND cr.date_to
				' . ($active ? 'AND cr.`active` = 1' : '') . '
				' . ($inStock ? 'AND cr.`quantity` > 0' : '');

So there is obviously a time difference, but if my Prestashop was configured with the California time zone, the time difference would be even greater.

What should I do? Override the function? Configure my SQL server to be the same time zone as my Prestashop?

Thank you in advance !

Florian_29298

Florian_29298

Hello everyone !

I have a problem that I have been unable to solve for several weeks with time zone.

My server configuration :

Prestashop is configured with Paris time zone.

Debian server which hosts my PHP and MYSQL is configured with London time zone.

PHP and MYSQL are configured with the London time zone.

When a coupon is automatically generated, its validity start date at the present time of Paris.

However, this coupon is not highlighted (in checkout page) on Prestashop because since Prestashop 1.7.4, the highlighting function retrieves all coupons between the present time of the MYSQL server (with NOW() function) and the end of the day.

Highlighted function in Prestashop < 1.7.4 in /classes/CartRule.php:384 :

$sql_part2 = ' AND cr.date_from < "' . date('Y-m-d H:i:59') . '"
				AND cr.date_to > "' . date('Y-m-d H:i:59') . '"
				' . ($active ? 'AND cr.`active` = 1' : '') . '
				' . ($inStock ? 'AND cr.`quantity` > 0' : '');

Highlighted function in Prestashop > 1.7.4 :

$sql_part2 = ' AND NOW() BETWEEN cr.date_from AND cr.date_to
				' . ($active ? 'AND cr.`active` = 1' : '') . '
				' . ($inStock ? 'AND cr.`quantity` > 0' : '');

So there is obviously a time difference, but if my Prestashop was configured with the California time zone, the time difference would be even greater.

What should I do? Override the function? Configure my SQL server to be the same time zone as my Prestashop?

Thank you in advance !

Florian_29298

Florian_29298

I have a problem that I have been unable to solve for several weeks with time zone.

My server configuration :

Prestashop is configured with Paris time zone.

Debian server which hosts my PHP and MYSQL is configured with London time zone.

PHP and MYSQL are configured with the London time zone.

When a coupon is automatically generated, its validity start date at the present time of Paris.

However, this coupon is not highlighted (in checkout page) on Prestashop because since Prestashop 1.7.4, the highlighting function retrieves all coupons between the present time of the MYSQL server (with NOW() function) and the end of the day.

Highlighted function in Prestashop < 1.7.4 in /classes/CartRule.php:384 :

$sql_part2 = ' AND cr.date_from < "' . date('Y-m-d H:i:59') . '"
				AND cr.date_to > "' . date('Y-m-d H:i:59') . '"
				' . ($active ? 'AND cr.`active` = 1' : '') . '
				' . ($inStock ? 'AND cr.`quantity` > 0' : '');

Highlighted function in Prestashop > 1.7.4 :

$sql_part2 = ' AND NOW() BETWEEN cr.date_from AND cr.date_to
				' . ($active ? 'AND cr.`active` = 1' : '') . '
				' . ($inStock ? 'AND cr.`quantity` > 0' : '');

So there is obviously a time difference, but if my Prestashop was configured with the California time zone, the time difference would be even greater.

What should I do? Override the function? Configure my SQL server to be the same time zone as my Prestashop?

Thank you in advance !

×
×
  • Create New...