Skip to Content
author's profile photo Former Member
Former Member

rulebased promotions and time service

Hi experts,

our current project will run globally and will have to support different time zones. For this reason, time evaluation (flexible search queries, cms time restrictions, ...) heaviliy relies on de.hybris.platform.servicelayer.time.TimeService (session attribute "currentDate").

Of course, also evaluation of startDate/endDate of (rule based) promotions should take the time zone into account. Unfortunately, it seems drools based evaluation using "date-expires" and "date-effective" works against system clock instead of TimeService#getCurrentTime().

Is there any chance to change this behavior, so also drools time/date evaluation use TimeService#getCurrentTime()?

Regards, Norbert

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Jul 27, 2016 at 11:35 AM

    Hi Norbert,

    This is intentional as it is possible to set the TimeZone on Stnd End date for Promotion Source Rules and it drools expects that the time values are already translated to the correct timezone value.

    If you still need to use TimeService within drools rule, you can change the rule compiler to generate it accordingly from the source rules. But it could have a performance impact as it is recommended not to invoke additional services to in condition evaluation part of drools.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 27, 2016 at 12:25 PM

    Hi Charles,

    thanks for your answer!

    As i understood it's possible to set an (time zone unaware) stnd end date for a promotion source rule. So if i want to have a 10% promotion for USA (e.g. Time Zone America/Denver) and Germany (Europe/Berlin) starting at 10:00 local time, i would actually have to create two promotions with two different start dates, correct? (assuming server time zone is Europe/Berlin the german promotion would stt 10:00 and the US promotion would have to be set to stt 02:00)

    Of course our customer only wants to maintain a single promotion with start/end date in UTC.

    Thanks again, Best Regards, Norbert

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 07, 2017 at 12:27 AM

    Hello, I have a similar issue. Our customers can (today) place an order for today, tomorrow or next 3 days (choosing the picking date). If the promo starts in 2 day it happens that today the customer can't see the promo apllied. We suppose becasue the system don't use TimeService.getCurrentTime (timeoffset)... now how we can solve this issue?

    The calculationService takes in consideration the TimeService instead calculating prices, discounts, etc...

    You mentioned the possibility to extend the rule compiler. Have you some additional info? Classes/spring definition, ecc?

    Many thanks! Diego

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.