Florian_29298 Posted March 25, 2021 Share Posted March 25, 2021 (edited) 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 ! Edited March 25, 2021 by Florian_29298 (see edit history) Link to comment Share on other sites More sharing options...
joseantgv Posted March 26, 2021 Share Posted March 26, 2021 Setting the same time zone in both sides should fix this issue and, from my point of view, the best solution. Why would you want to keep a different time zone? Link to comment Share on other sites More sharing options...
Florian_29298 Posted March 26, 2021 Author Share Posted March 26, 2021 (edited) 8 minutes ago, joseantgv said: Setting the same time zone in both sides should fix this issue and, from my point of view, the best solution. Why would you want to keep a different time zone? Hello. Thank you for your answer 🙂 . If my MySQL server is in the same timezone of my Prestashop, the problem is solved. But, what if I have a second (or more) Prestashop, on the same MySQL server but in a different database, I will have this problem. Indeed, to my knowledge, it is only possible to define a timezone on a whole MySQL server and not only in a database. Edited March 26, 2021 by Florian_29298 (see edit history) Link to comment Share on other sites More sharing options...
Florian_29298 Posted March 26, 2021 Author Share Posted March 26, 2021 1 minute ago, Florian_29298 said: Hello. Thank you for your answer. If my MySQL server is in the same timezone of my Prestashop, the problem is solved. But, what if I have a second (or more) Prestashop, on the same MySQL server but in a different database, I will have this problem. Indeed, to my knowledge, it is only possible to define a timezone on a whole MySQL server and not only in a database. Another problem, if I can't change the timezone of my MySQL server because my host doesn't allow me to do? Link to comment Share on other sites More sharing options...
Zudriuz Posted February 4, 2023 Share Posted February 4, 2023 Hello, same problem, did you manage to find a solution? Link to comment Share on other sites More sharing options...
Mediacom87 Posted February 4, 2023 Share Posted February 4, 2023 Le 26/03/2021 à 5:06 PM, Florian_29298 a dit : Another problem, if I can't change the timezone of my MySQL server because my host doesn't allow me to do? Contact your host Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now