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

Fix for #443, catalog pricerules start and end date not respected (co… #444

Merged
merged 2 commits into from
Mar 9, 2018

Conversation

seansan
Copy link
Contributor

@seansan seansan commented Feb 1, 2018

…rrect)

Fix for #443, catalog pricerules start and end date not respected (correct)

Please validate my logic.

  1. Fromtime and totime are now measured in GMT
  2. And compared to GMT time (now) in $timestamp

This way (if and) when the CRON runs the rules at that specific time are checked and activated (or disabled) - as this cron job runs per default at 2 AM as I understand. This would mean that all rules enabled and disable are in effect turned ON and OFF at 2AM during the night the rule is activated (1st day) and de-activated after the end date 2 hours after midnight.

Reference 1: https://magento.stackexchange.com/questions/61045/catalog-price-rule-from-today-does-not-apply
Reference 2: (under catalog rules) http://jokiruiz.com/magento/magento-timezones-timestamps/

Test data:

  • for a rule with start date 10 dec 2017 and end date 30 jan 2018
  • we see the following comparison on Thu 1 feb 2018 @ 14:28 GMT

TIMESTAMP: Thu, 01 Feb 2018 14:28:03 GMT
START; Sat, 09 Dec 2017 23:00:00 GMT
END: Tue, 30 Jan 2018 22:59:59 GMT

So rule in this case is turned OFF

Please confirm

…cted (correct)

Fix for OpenMage#443, catalog pricerules start and end date not respected (correct)

Please validate my logic. 

1. Fromtime and totime are now measured in GMT
2. And compared to GMT time (now) in $timestamp

This way (if and) when the CRON runs the rules at that specific time are checked and activated (or disabled) - as this cron job runs per default at 2 AM as I understand. This would mean that all rules enabled and disable are in effect turned ON and OFF at 2AM during the night the rule is activated (1st day) and de-activated after the end date 2 hours after midnight. 

Reference 1: https://magento.stackexchange.com/questions/61045/catalog-price-rule-from-today-does-not-apply
Reference 2: (under catalog rules) http://jokiruiz.com/magento/magento-timezones-timestamps/

Test data:
- for a rule with start date 10 dec 2017 and end date 30 jan 2018
- we see the following comparison on Thu 1 feb 2018 @ 14:28 GMT

TIMESTAMP: Thu, 01 Feb 2018 14:28:03 GMT
START; Sat, 09 Dec 2017 23:00:00 GMT
END: Tue, 30 Jan 2018 22:59:59 GMT

So rule in this case is turned OFF

Please confirm
@seansan
Copy link
Contributor Author

seansan commented Feb 8, 2018

+1 can someone review our logic? and/or test? Appreciate it ...

@tomekjordan
Copy link

tomekjordan commented Feb 21, 2018

Tested. 100% works. Start date,end date for catalog rules know works properly (tested on GMT+1).
The only problem is:
when special price end date (set for product directly) is ending the particular day, and catalog rule is still active - i see normal price on product pages - while everything is correct (valid promotional price from catalog rule in the cart/checkout).

It can be due to cacheing or indexing, dont know - but special price end date can sometimes block catalog rule showing correctly on frontend. Maybe magento flush caches with different priority and special price end date trigger it, while catalog rules are not yet active during 00:00 day date changes?
Full product SAVE action - make it correct at frontend then.

Copy link
Member

@colinmollenhour colinmollenhour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't tested but makes sense, rule start/end dates must be adjusted by timezone offset since the cron job applying rules runs at midnight.

However, couldn't the second chunk be simply $timestamp = time(); ?

@seansan
Copy link
Contributor Author

seansan commented Feb 22, 2018 via email

@colinmollenhour colinmollenhour merged commit 0a9a5e8 into OpenMage:1.9.3.x Mar 9, 2018
edannenberg pushed a commit to edannenberg/magento-lts that referenced this pull request Mar 20, 2018
…art/end date

1. Fromtime and totime are now measured in GMT
2. And compared to GMT time (now) in $timestamp

This way (if and) when the CRON runs the rules at that specific time are checked and
activated (or disabled) - as this cron job runs per default at 2 AM as I understand.
This would mean that all rules enabled and disable are in effect turned ON and OFF
at 2AM during the night the rule is activated (1st day) and de-activated after the
end date 2 hours after midnight.

Reference 1: https://magento.stackexchange.com/questions/61045/catalog-price-rule-from-today-does-not-apply
Reference 2: (under catalog rules) http://jokiruiz.com/magento/magento-timezones-timestamps/

Test data:
- for a rule with start date 10 dec 2017 and end date 30 jan 2018
- we see the following comparison on Thu 1 feb 2018 @ 14:28 GMT

TIMESTAMP: Thu, 01 Feb 2018 14:28:03 GMT
START; Sat, 09 Dec 2017 23:00:00 GMT
END: Tue, 30 Jan 2018 22:59:59 GMT

So rule in this case is turned OFF

* @colinmollenhour Use simply 'time()' to get Unix timestamp.
edannenberg pushed a commit to edannenberg/magento-lts that referenced this pull request Jul 17, 2018
…art/end date

1. Fromtime and totime are now measured in GMT
2. And compared to GMT time (now) in $timestamp

This way (if and) when the CRON runs the rules at that specific time are checked and
activated (or disabled) - as this cron job runs per default at 2 AM as I understand.
This would mean that all rules enabled and disable are in effect turned ON and OFF
at 2AM during the night the rule is activated (1st day) and de-activated after the
end date 2 hours after midnight.

Reference 1: https://magento.stackexchange.com/questions/61045/catalog-price-rule-from-today-does-not-apply
Reference 2: (under catalog rules) http://jokiruiz.com/magento/magento-timezones-timestamps/

Test data:
- for a rule with start date 10 dec 2017 and end date 30 jan 2018
- we see the following comparison on Thu 1 feb 2018 @ 14:28 GMT

TIMESTAMP: Thu, 01 Feb 2018 14:28:03 GMT
START; Sat, 09 Dec 2017 23:00:00 GMT
END: Tue, 30 Jan 2018 22:59:59 GMT

So rule in this case is turned OFF

* @colinmollenhour Use simply 'time()' to get Unix timestamp.
edannenberg pushed a commit to edannenberg/magento-lts that referenced this pull request Sep 19, 2018
…art/end date

1. Fromtime and totime are now measured in GMT
2. And compared to GMT time (now) in $timestamp

This way (if and) when the CRON runs the rules at that specific time are checked and
activated (or disabled) - as this cron job runs per default at 2 AM as I understand.
This would mean that all rules enabled and disable are in effect turned ON and OFF
at 2AM during the night the rule is activated (1st day) and de-activated after the
end date 2 hours after midnight.

Reference 1: https://magento.stackexchange.com/questions/61045/catalog-price-rule-from-today-does-not-apply
Reference 2: (under catalog rules) http://jokiruiz.com/magento/magento-timezones-timestamps/

Test data:
- for a rule with start date 10 dec 2017 and end date 30 jan 2018
- we see the following comparison on Thu 1 feb 2018 @ 14:28 GMT

TIMESTAMP: Thu, 01 Feb 2018 14:28:03 GMT
START; Sat, 09 Dec 2017 23:00:00 GMT
END: Tue, 30 Jan 2018 22:59:59 GMT

So rule in this case is turned OFF

* @colinmollenhour Use simply 'time()' to get Unix timestamp.
edannenberg pushed a commit to edannenberg/magento-lts that referenced this pull request Feb 14, 2019
…art/end date

1. Fromtime and totime are now measured in GMT
2. And compared to GMT time (now) in $timestamp

This way (if and) when the CRON runs the rules at that specific time are checked and
activated (or disabled) - as this cron job runs per default at 2 AM as I understand.
This would mean that all rules enabled and disable are in effect turned ON and OFF
at 2AM during the night the rule is activated (1st day) and de-activated after the
end date 2 hours after midnight.

Reference 1: https://magento.stackexchange.com/questions/61045/catalog-price-rule-from-today-does-not-apply
Reference 2: (under catalog rules) http://jokiruiz.com/magento/magento-timezones-timestamps/

Test data:
- for a rule with start date 10 dec 2017 and end date 30 jan 2018
- we see the following comparison on Thu 1 feb 2018 @ 14:28 GMT

TIMESTAMP: Thu, 01 Feb 2018 14:28:03 GMT
START; Sat, 09 Dec 2017 23:00:00 GMT
END: Tue, 30 Jan 2018 22:59:59 GMT

So rule in this case is turned OFF

* @colinmollenhour Use simply 'time()' to get Unix timestamp.
edannenberg pushed a commit to edannenberg/magento-lts that referenced this pull request Apr 1, 2019
…art/end date

1. Fromtime and totime are now measured in GMT
2. And compared to GMT time (now) in $timestamp

This way (if and) when the CRON runs the rules at that specific time are checked and
activated (or disabled) - as this cron job runs per default at 2 AM as I understand.
This would mean that all rules enabled and disable are in effect turned ON and OFF
at 2AM during the night the rule is activated (1st day) and de-activated after the
end date 2 hours after midnight.

Reference 1: https://magento.stackexchange.com/questions/61045/catalog-price-rule-from-today-does-not-apply
Reference 2: (under catalog rules) http://jokiruiz.com/magento/magento-timezones-timestamps/

Test data:
- for a rule with start date 10 dec 2017 and end date 30 jan 2018
- we see the following comparison on Thu 1 feb 2018 @ 14:28 GMT

TIMESTAMP: Thu, 01 Feb 2018 14:28:03 GMT
START; Sat, 09 Dec 2017 23:00:00 GMT
END: Tue, 30 Jan 2018 22:59:59 GMT

So rule in this case is turned OFF

* @colinmollenhour Use simply 'time()' to get Unix timestamp.
@sreichel sreichel added the bug label May 21, 2019
edannenberg pushed a commit to edannenberg/magento-lts that referenced this pull request Aug 22, 2019
…art/end date

1. Fromtime and totime are now measured in GMT
2. And compared to GMT time (now) in $timestamp

This way (if and) when the CRON runs the rules at that specific time are checked and
activated (or disabled) - as this cron job runs per default at 2 AM as I understand.
This would mean that all rules enabled and disable are in effect turned ON and OFF
at 2AM during the night the rule is activated (1st day) and de-activated after the
end date 2 hours after midnight.

Reference 1: https://magento.stackexchange.com/questions/61045/catalog-price-rule-from-today-does-not-apply
Reference 2: (under catalog rules) http://jokiruiz.com/magento/magento-timezones-timestamps/

Test data:
- for a rule with start date 10 dec 2017 and end date 30 jan 2018
- we see the following comparison on Thu 1 feb 2018 @ 14:28 GMT

TIMESTAMP: Thu, 01 Feb 2018 14:28:03 GMT
START; Sat, 09 Dec 2017 23:00:00 GMT
END: Tue, 30 Jan 2018 22:59:59 GMT

So rule in this case is turned OFF

* @colinmollenhour Use simply 'time()' to get Unix timestamp.
edannenberg pushed a commit to edannenberg/magento-lts that referenced this pull request Oct 25, 2019
…art/end date

1. Fromtime and totime are now measured in GMT
2. And compared to GMT time (now) in $timestamp

This way (if and) when the CRON runs the rules at that specific time are checked and
activated (or disabled) - as this cron job runs per default at 2 AM as I understand.
This would mean that all rules enabled and disable are in effect turned ON and OFF
at 2AM during the night the rule is activated (1st day) and de-activated after the
end date 2 hours after midnight.

Reference 1: https://magento.stackexchange.com/questions/61045/catalog-price-rule-from-today-does-not-apply
Reference 2: (under catalog rules) http://jokiruiz.com/magento/magento-timezones-timestamps/

Test data:
- for a rule with start date 10 dec 2017 and end date 30 jan 2018
- we see the following comparison on Thu 1 feb 2018 @ 14:28 GMT

TIMESTAMP: Thu, 01 Feb 2018 14:28:03 GMT
START; Sat, 09 Dec 2017 23:00:00 GMT
END: Tue, 30 Jan 2018 22:59:59 GMT

So rule in this case is turned OFF

* @colinmollenhour Use simply 'time()' to get Unix timestamp.
@sreichel sreichel added the Component: CatalogRule Relates to Mage_CatalogRule label Jun 8, 2020
edannenberg pushed a commit to edannenberg/magento-lts that referenced this pull request Aug 20, 2020
…art/end date

1. Fromtime and totime are now measured in GMT
2. And compared to GMT time (now) in $timestamp

This way (if and) when the CRON runs the rules at that specific time are checked and
activated (or disabled) - as this cron job runs per default at 2 AM as I understand.
This would mean that all rules enabled and disable are in effect turned ON and OFF
at 2AM during the night the rule is activated (1st day) and de-activated after the
end date 2 hours after midnight.

Reference 1: https://magento.stackexchange.com/questions/61045/catalog-price-rule-from-today-does-not-apply
Reference 2: (under catalog rules) http://jokiruiz.com/magento/magento-timezones-timestamps/

Test data:
- for a rule with start date 10 dec 2017 and end date 30 jan 2018
- we see the following comparison on Thu 1 feb 2018 @ 14:28 GMT

TIMESTAMP: Thu, 01 Feb 2018 14:28:03 GMT
START; Sat, 09 Dec 2017 23:00:00 GMT
END: Tue, 30 Jan 2018 22:59:59 GMT

So rule in this case is turned OFF

* @colinmollenhour Use simply 'time()' to get Unix timestamp.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Component: CatalogRule Relates to Mage_CatalogRule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants