Promotion schemes

Not for built in.
But we can make it may be from navigation or entity. For make promotion.
Like my example we set all rule. And at entity or navigation we can set what rule we choose n what item product we make promotion, and date promotion.
If this plan can’t do.
Other question how to make date promtion start n end from rule.

Have two program settings, one for end date, one for close date. Have a script to read both dates and compare if it is in beetween the two dates.

How to setting it. I still can’t make it

have a script

function checkPromo(StartD, EndD) {
Date current = new Date();
if(dateCheck(StartD,EndD,current))
    return true;
else
    return false;

}
function dateCheck(from,to,check) {

    var fDate,lDate,cDate;
    fDate = Date.parse(from);
    lDate = Date.parse(to);
    cDate = Date.parse(check);

    if((cDate <= lDate && cDate >= fDate)) {
        return true;
    }
    return false;
}

function getDate(date){

var d = new Date(date);
return d;
}

Then on your rule you just need to do something like this


where the constraint would be: {CALL:pr.CheckPromo{'{SETTING:promo_start}', '{SETTING:promo_end}'}}

And also a way to set the dates
Simpny call an action to set an setting with CALL:pr.CheckPrmo{‘Value of day, Value of Month, Value of year’}

UPDATE Added a function to create a date.

2 Likes

Sorry, i still not understand. How to make start date n end date

You make an entity screen widget 2 label widget and uses tem to call an Automation command with their value. Have a rule then to check if the automation command is fired and if it has call an action which updates a setting called promo_start or prom_end with {CALL:pr.CheckPromo{’{[:CommandValue]}’}}

The sort of value you would put inside the label widget are like these October 13, 2014 11:13:00

Wed Mar 25 2015 01:00:00 GMT+0100 (W. Europe Standard Time)

2015-03-25

2015-03

2015-03-25T12:00:00

Mar 25 2015

25 Mar 2015

January 25 2015

Jan 25 2015

JANUARY, 25, 2015

2015/03/25

Why a script, you can use normal constraints. Is greater than and is smaller than.

How to constraint star n end date

Look at half the happy hour tutorials.
You set a so strains of {DATE} is greater than ??? And smaller than.
Or you can use the date tag options to return day of week and do it as matches ?|?|? With a list of days
or as in most happy hour examples use time grater and smaller to just do time of day.
Even combinations like 18:00 to 20:00 on Mon to Thursday.

1 Like