"order" Snippets


Basket #57209

Simply changes any order_Status that is "Pending" to "In Progress"
Created: 1504214967
View "Basket #57209"
<mvt:assign name="l.settings:scrubme" value="'I am a really long and boring sentance.'"/> <mvt:assign name="g.return_value" value="substring( l.settings:scrubme, 0, 10 )" /> &mvt:global:return_value;
 

Updating order array order_status from Pending to In Progress

Simply changes any order_Status that is "Pending" to "In Progress"
Created: 1498090111
View "Updating order array order_status from Pending to In Progress"
<mvt:comment> | | By http://www.scotsscripts.com | </mvt:comment> <mvt:assign name="l.settings:order[1]:id" value="'1'" /> <mvt:assign name="l.settings:order[1]:order_status" value="'In Progress'" /> <mvt:assign name="l.settings:order[2]:id" value="'2'" /> <mvt:assign name="l.settings:order[2]:order_status" value="'In Progress'" /> <mvt:assign name="l.settings:order[3]:id" value="'3'" /> <mvt:assign name="l.settings:order[3]:order_status" value="'Pending'" /> <mvt:assign name="l.settings:order[4]:id" value="'4'" /> <mvt:assign name="l.settings:order[4]:order_status" value="'In Progress'" /> <p><b>Original:</b></p> <mvt:foreach iterator="item" array="order"> id: &mvt:item:id; status: &mvt:item:order_status;<br> </mvt:foreach> <mvt:assign name="l.elements" value="miva_array_elements(l.settings:order)" /> <mvt:while expr="l.counter LT l.elements"> <mvt:assign name="l.counter" value="l.counter + 1" /> <mvt:assign name="l.struct" value="l.settings:order[l.counter]" /> <mvt:if expr="tolower(l.struct:order_status) EQ 'pending'"> <mvt:assign name="l.struct:order_status" value="'In Progress'" /> </mvt:if> <mvt:assign name="l.success" value="miva_array_insert( l.settings:temp_array, l.struct, -1 )" /> </mvt:while> <mvt:assign name="l.settings:order" value="l.settings:temp_array" /> <p><b>Updated:</b></p> <mvt:foreach iterator="item" array="order"> id: &mvt:item:id; status: &mvt:item:order_status;<br> </mvt:foreach>
 
View "Estimate Order Shipping Date"
<mvt:comment> Account for Daylight Savings time </mvt:comment> <mvt:if expr="s.tm_isdst"> <mvt:assign name="g.Timezone_Offset" value="'-5'" /> <mvt:assign name="g.Timezone_Abbreviation" value="'CDT'" /> <mvt:else> <mvt:assign name="g.Timezone_Offset" value="'-6'" /> <mvt:assign name="g.Timezone_Abbreviation" value="'CST'" /> </mvt:if> <mvt:if expr="s.tm_isdst"> <p>Daylight savings time <b>IS</b> in effect. Timezone Offset: &mvte:global:Timezone_Offset;</p> <mvt:else> <p>Daylight savings time is <b>NOT</b> in effect. Timezone Offset: &mvte:global:Timezone_Offset;</p> </mvt:if> <hr> <mvt:comment> Assign a Days-of-the-week text array for later </mvt:comment> <mvt:assign name="l.settings:daysofweek[1]" value="'Sunday'" /> <mvt:assign name="l.settings:daysofweek[2]" value="'Monday'" /> <mvt:assign name="l.settings:daysofweek[3]" value="'Tuesday'" /> <mvt:assign name="l.settings:daysofweek[4]" value="'Wednesday'" /> <mvt:assign name="l.settings:daysofweek[5]" value="'Thursday'" /> <mvt:assign name="l.settings:daysofweek[6]" value="'Friday'" /> <mvt:assign name="l.settings:daysofweek[7]" value="'Saturday'" /> <mvt:comment> Prepare days to simulate & test senarios </mvt:comment> <mvt:assign name="l.settings:senarios[1]:descrip" value="'Monday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[1]:timestamp" value="1470657660" /> <mvt:assign name="l.settings:senarios[2]:descrip" value="'Monday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[2]:timestamp" value="1470693660" /> <mvt:assign name="l.settings:senarios[3]:descrip" value="'Tuesday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[3]:timestamp" value="1470744060" /> <mvt:assign name="l.settings:senarios[4]:descrip" value="'Tuesday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[4]:timestamp" value="1470780060" /> <mvt:assign name="l.settings:senarios[5]:descrip" value="'Wednesday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[5]:timestamp" value="1470830460" /> <mvt:assign name="l.settings:senarios[6]:descrip" value="'Wednesday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[6]:timestamp" value="1470866460" /> <mvt:assign name="l.settings:senarios[7]:descrip" value="'Thursday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[7]:timestamp" value="1470916860" /> <mvt:assign name="l.settings:senarios[8]:descrip" value="'Thursday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[8]:timestamp" value="1470952860" /> <mvt:assign name="l.settings:senarios[9]:descrip" value="'Friday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[9]:timestamp" value="1471003260" /> <mvt:assign name="l.settings:senarios[10]:descrip" value="'Friday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[10]:timestamp" value="1471039260" /> <mvt:assign name="l.settings:senarios[11]:descrip" value="'Saturday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[11]:timestamp" value="1471089660" /> <mvt:assign name="l.settings:senarios[12]:descrip" value="'Saturday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[12]:timestamp" value="1471125660" /> <mvt:assign name="l.settings:senarios[13]:descrip" value="'Sunday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[13]:timestamp" value="1471089660" /> <mvt:assign name="l.settings:senarios[14]:descrip" value="'Sunday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[14]:timestamp" value="1471125660" /> <mvt:comment> Loop over each senario and test the estimation logic </mvt:comment> <mvt:foreach iterator="senario" array="senarios"> <mvt:comment> Assign some date-time variables that make it easier to read, write, and compare dates when we apply the estimation logic </mvt:comment> <mvt:assign name="l.settings:senario:date:year" value="time_t_year( l.settings:senario:timestamp, g.Timezone_Offset )" /> <mvt:assign name="l.settings:senario:date:month" value="padl(time_t_month( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:day" value="padl(time_t_dayofmonth( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:dayofweek" value="time_t_dayofweek( l.settings:senario:timestamp, g.Timezone_Offset )" /> <mvt:assign name="l.settings:senario:date:dayofweek_formatted" value="l.settings:daysofweek[time_t_dayofweek( l.settings:senario:timestamp, g.Timezone_Offset )]" /> <mvt:assign name="l.settings:senario:date:hour" value="padl(time_t_hour( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:min" value="padl(time_t_min( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:sec" value="padl(time_t_sec( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:formatted" value="l.settings:senario:date:year $ '-' $ l.settings:senario:date:month $ '-' $ l.settings:senario:date:day $ ' ' $ l.settings:senario:date:hour $ ':' $ l.settings:senario:date:min $ ':' $ l.settings:senario:date:sec $ ' ' $ g.Timezone_Offset" /> <h2>Senario: &mvt:senario:descrip;<small>&mvt:senario:date:formatted;</small></h2> <mvt:if expr="l.settings:senario:date:dayofweek_formatted CIN 'Monday, Tuesday, Wednesday, Thursday' AND l.settings:senario:date:hour LT 10"> <mvt:comment> Estimation Logic: Ship Today </mvt:comment> <mvt:assign name="l.settings:senario:cutoff:hours" value="10 - l.settings:senario:date:hour" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="60 - l.settings:senario:date:min" /> <mvt:if expr="l.settings:senario:cutoff:minutes EQ 60"> <mvt:assign name="l.settings:senario:cutoff:hours" value="l.settings:senario:cutoff:hours + 1" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="0" /> </mvt:if> <h3>Order within <b>&mvt:senario:cutoff:hours; hours &mvt:senario:cutoff:minutes; minutes</b>, and it should ship today.</h3> <mvt:elseif expr="l.settings:senario:date:dayofweek_formatted CIN 'Monday, Tuesday, Wednesday' AND l.settings:senario:date:hour GE 10"> <mvt:comment> Estimation Logic: Ship Tomorrow </mvt:comment> <mvt:assign name="l.settings:senario:cutoff:hours" value="34 - l.settings:senario:date:hour" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="60 - l.settings:senario:date:min" /> <mvt:if expr="l.settings:senario:cutoff:minutes EQ 60"> <mvt:assign name="l.settings:senario:cutoff:hours" value="l.settings:senario:cutoff:hours + 1" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="0" /> </mvt:if> <mvt:comment><h3>Order within <b>&mvt:senario:cutoff:hours; hours &mvt:senario:cutoff:minutes; minutes</b> and it should ship tomorrow.</h3></mvt:comment> <h3>Order today, and it should ship tomorrow.</h3> <mvt:else> <mvt:comment> Estimation Logic: Ship Monday </mvt:comment> <h3>Order today, and it should ship on Monday.</h3> </mvt:if> <p> <small> <ul> <li>From Monday to Thursday, orders placed <i>before</i> 10am will <b>ship the same day</b></li> <li>From Monday to Wednesday, orders placed <i>after</i> 10am will <b>ship the next day</b></li> <li>All other others (Thursday after 10am to Monday before 10 am) will be <b>shipped on Monday</b>.</li> </ul> </small> </p> <br><hr><br> </mvt:foreach> <mvt:comment> Just a Debugging Helper </mvt:comment> <mvt:comment> <mvt:eval expr="glosub(miva_array_serialize(l.settings:senarios), ',', '<br>')" /> </mvt:comment>
 
View "Estimate Order Shipping Date"
<mvt:comment> Account for Daylight Savings time </mvt:comment> <mvt:if expr="s.tm_isdst"> <mvt:assign name="g.Timezone_Offset" value="'-5'" /> <mvt:assign name="g.Timezone_Abbreviation" value="'CDT'" /> <mvt:else> <mvt:assign name="g.Timezone_Offset" value="'-6'" /> <mvt:assign name="g.Timezone_Abbreviation" value="'CST'" /> </mvt:if> <mvt:if expr="s.tm_isdst"> <p>Daylight savings time <b>IS</b> in effect. Timezone Offset: &mvte:global:Timezone_Offset;</p> <mvt:else> <p>Daylight savings time is <b>NOT</b> in effect. Timezone Offset: &mvte:global:Timezone_Offset;</p> </mvt:if> <hr> <mvt:comment> Assign a Days-of-the-week text array for later </mvt:comment> <mvt:assign name="l.settings:daysofweek[1]" value="'Sunday'" /> <mvt:assign name="l.settings:daysofweek[2]" value="'Monday'" /> <mvt:assign name="l.settings:daysofweek[3]" value="'Tuesday'" /> <mvt:assign name="l.settings:daysofweek[4]" value="'Wednesday'" /> <mvt:assign name="l.settings:daysofweek[5]" value="'Thursday'" /> <mvt:assign name="l.settings:daysofweek[6]" value="'Friday'" /> <mvt:assign name="l.settings:daysofweek[7]" value="'Saturday'" /> <mvt:comment> Prepare days to simulate & test senarios </mvt:comment> <mvt:assign name="l.settings:senarios[1]:descrip" value="'Monday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[1]:timestamp" value="1470657660" /> <mvt:assign name="l.settings:senarios[2]:descrip" value="'Monday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[2]:timestamp" value="1470693660" /> <mvt:assign name="l.settings:senarios[3]:descrip" value="'Tuesday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[3]:timestamp" value="1470744060" /> <mvt:assign name="l.settings:senarios[4]:descrip" value="'Tuesday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[4]:timestamp" value="1470780060" /> <mvt:assign name="l.settings:senarios[5]:descrip" value="'Wednesday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[5]:timestamp" value="1470830460" /> <mvt:assign name="l.settings:senarios[6]:descrip" value="'Wednesday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[6]:timestamp" value="1470866460" /> <mvt:assign name="l.settings:senarios[7]:descrip" value="'Thursday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[7]:timestamp" value="1470916860" /> <mvt:assign name="l.settings:senarios[8]:descrip" value="'Thursday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[8]:timestamp" value="1470952860" /> <mvt:assign name="l.settings:senarios[9]:descrip" value="'Friday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[9]:timestamp" value="1471003260" /> <mvt:assign name="l.settings:senarios[10]:descrip" value="'Friday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[10]:timestamp" value="1471039260" /> <mvt:assign name="l.settings:senarios[11]:descrip" value="'Saturday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[11]:timestamp" value="1471089660" /> <mvt:assign name="l.settings:senarios[12]:descrip" value="'Saturday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[12]:timestamp" value="1471125660" /> <mvt:assign name="l.settings:senarios[13]:descrip" value="'Sunday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[13]:timestamp" value="1471089660" /> <mvt:assign name="l.settings:senarios[14]:descrip" value="'Sunday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[14]:timestamp" value="1471125660" /> <mvt:comment> Loop over each senario and test the estimation logic </mvt:comment> <mvt:foreach iterator="senario" array="senarios"> <mvt:comment> Assign some date-time variables that make it easier to read, write, and compare dates when we apply the estimation logic </mvt:comment> <mvt:assign name="l.settings:senario:date:year" value="time_t_year( l.settings:senario:timestamp, g.Timezone_Offset )" /> <mvt:assign name="l.settings:senario:date:month" value="padl(time_t_month( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:day" value="padl(time_t_dayofmonth( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:dayofweek" value="time_t_dayofweek( l.settings:senario:timestamp, g.Timezone_Offset )" /> <mvt:assign name="l.settings:senario:date:dayofweek_formatted" value="l.settings:daysofweek[time_t_dayofweek( l.settings:senario:timestamp, g.Timezone_Offset )]" /> <mvt:assign name="l.settings:senario:date:24hour" value="padl(time_t_hour( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:min" value="padl(time_t_min( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:sec" value="padl(time_t_sec( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:formatted" value="l.settings:senario:date:year $ '-' $ l.settings:senario:date:month $ '-' $ l.settings:senario:date:day $ ' ' $ l.settings:senario:date:24hour $ ':' $ l.settings:senario:date:min $ ':' $ l.settings:senario:date:sec $ ' ' $ g.Timezone_Offset" /> <h2 style='color: gray'> Senario #<mvt:eval expr="POS1"/>: &mvt:senario:descrip; <small>&mvt:senario:date:formatted;</small> </h2> <mvt:if expr="l.settings:senario:date:dayofweek_formatted CIN 'Monday, Tuesday, Wednesday, Thursday' AND l.settings:senario:date:24hour LT 10"> <mvt:comment> Estimation Logic: Ship Today </mvt:comment> <mvt:assign name="l.settings:senario:cutoff:hours" value="10 - l.settings:senario:date:24hour" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="60 - l.settings:senario:date:min" /> <mvt:if expr="l.settings:senario:cutoff:minutes EQ 60"> <mvt:assign name="l.settings:senario:cutoff:hours" value="l.settings:senario:cutoff:hours + 1" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="0" /> </mvt:if> <h3>Order within <b>&mvt:senario:cutoff:hours; hours &mvt:senario:cutoff:minutes; minutes</b>, and it should ship today.</h3> <mvt:elseif expr="l.settings:senario:date:dayofweek_formatted CIN 'Monday, Tuesday, Wednesday' AND l.settings:senario:date:24hour GE 10"> <mvt:comment> Estimation Logic: Ship Tomorrow </mvt:comment> <mvt:assign name="l.settings:senario:cutoff:hours" value="34 - l.settings:senario:date:24hour" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="60 - l.settings:senario:date:min" /> <mvt:if expr="l.settings:senario:cutoff:minutes EQ 60"> <mvt:assign name="l.settings:senario:cutoff:hours" value="l.settings:senario:cutoff:hours + 1" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="0" /> </mvt:if> <mvt:comment><h3>Order within <b>&mvt:senario:cutoff:hours; hours &mvt:senario:cutoff:minutes; minutes</b> and it should ship tomorrow.</h3></mvt:comment> <h3>Order today, and it should ship tomorrow.</h3> <mvt:else> <mvt:comment> Estimation Logic: Ship Monday </mvt:comment> <h3>Order today, and it should ship on Monday.</h3> </mvt:if> <p> <small> <ul> <li>From Monday to Thursday, orders placed <i>before</i> 10am will ship the same day.</li> <li>From Monday to Wednesday, orders placed <i>after</i> 10am will ship the next day.</li> <li>All other others (Thursday after 10am to Monday before 10 am) will be shipped on Monday.</li> </ul> </small> </p> <br><br><hr><br><br> </mvt:foreach> <mvt:comment> Just a Debugging Helper </mvt:comment> <mvt:comment><mvt:eval expr="glosub(miva_array_serialize(l.settings:senarios), ',', '<br>')" /></mvt:comment>
 
View "Estimate Order Shipping Date"
<mvt:comment> Account for Daylight Savings time </mvt:comment> <mvt:if expr="s.tm_isdst"> <mvt:assign name="g.Timezone_Offset" value="'-5'" /> <mvt:assign name="g.Timezone_Abbreviation" value="'CDT'" /> <mvt:else> <mvt:assign name="g.Timezone_Offset" value="'-6'" /> <mvt:assign name="g.Timezone_Abbreviation" value="'CST'" /> </mvt:if> <mvt:if expr="s.tm_isdst"> <p>Daylight savings time <b>IS</b> in effect. Timezone Offset: &mvte:global:Timezone_Offset;</p> <mvt:else> <p>Daylight savings time is <b>NOT</b> in effect. Timezone Offset: &mvte:global:Timezone_Offset;</p> </mvt:if> <hr> <mvt:comment> Assign a Days-of-the-week text array for later </mvt:comment> <mvt:assign name="l.settings:daysofweek[1]" value="'Sunday'" /> <mvt:assign name="l.settings:daysofweek[2]" value="'Monday'" /> <mvt:assign name="l.settings:daysofweek[3]" value="'Tuesday'" /> <mvt:assign name="l.settings:daysofweek[4]" value="'Wednesday'" /> <mvt:assign name="l.settings:daysofweek[5]" value="'Thursday'" /> <mvt:assign name="l.settings:daysofweek[6]" value="'Friday'" /> <mvt:assign name="l.settings:daysofweek[7]" value="'Saturday'" /> <mvt:comment> Prepare days to simulate & test senarios </mvt:comment> <mvt:assign name="l.settings:senarios[1]:descrip" value="'Monday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[1]:timestamp" value="1470657660" /> <mvt:assign name="l.settings:senarios[2]:descrip" value="'Monday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[2]:timestamp" value="1470693660" /> <mvt:assign name="l.settings:senarios[3]:descrip" value="'Tuesday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[3]:timestamp" value="1470744060" /> <mvt:assign name="l.settings:senarios[4]:descrip" value="'Tuesday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[4]:timestamp" value="1470780060" /> <mvt:assign name="l.settings:senarios[5]:descrip" value="'Wednesday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[5]:timestamp" value="1470830460" /> <mvt:assign name="l.settings:senarios[6]:descrip" value="'Wednesday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[6]:timestamp" value="1470866460" /> <mvt:assign name="l.settings:senarios[7]:descrip" value="'Thursday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[7]:timestamp" value="1470916860" /> <mvt:assign name="l.settings:senarios[8]:descrip" value="'Thursday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[8]:timestamp" value="1470952860" /> <mvt:assign name="l.settings:senarios[9]:descrip" value="'Friday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[9]:timestamp" value="1471003260" /> <mvt:assign name="l.settings:senarios[10]:descrip" value="'Friday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[10]:timestamp" value="1471039260" /> <mvt:assign name="l.settings:senarios[11]:descrip" value="'Saturday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[11]:timestamp" value="1471089660" /> <mvt:assign name="l.settings:senarios[12]:descrip" value="'Saturday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[12]:timestamp" value="1471125660" /> <mvt:assign name="l.settings:senarios[13]:descrip" value="'Sunday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[13]:timestamp" value="1471089660" /> <mvt:assign name="l.settings:senarios[14]:descrip" value="'Sunday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[14]:timestamp" value="1471125660" /> <mvt:comment> Loop over each senario and test the estimation logic </mvt:comment> <mvt:foreach iterator="senario" array="senarios"> <mvt:comment> Assign some date-time variables that make it easier to read, write, and compare dates when we apply the estimation logic </mvt:comment> <mvt:assign name="l.settings:senario:date:year" value="time_t_year( l.settings:senario:timestamp, g.Timezone_Offset )" /> <mvt:assign name="l.settings:senario:date:month" value="padl(time_t_month( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:day" value="padl(time_t_dayofmonth( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:dayofweek" value="time_t_dayofweek( l.settings:senario:timestamp, g.Timezone_Offset )" /> <mvt:assign name="l.settings:senario:date:dayofweek_formatted" value="l.settings:daysofweek[time_t_dayofweek( l.settings:senario:timestamp, g.Timezone_Offset )]" /> <mvt:assign name="l.settings:senario:date:24hour" value="padl(time_t_hour( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:min" value="padl(time_t_min( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:sec" value="padl(time_t_sec( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:formatted" value="l.settings:senario:date:year $ '-' $ l.settings:senario:date:month $ '-' $ l.settings:senario:date:day $ ' ' $ l.settings:senario:date:24hour $ ':' $ l.settings:senario:date:min $ ':' $ l.settings:senario:date:sec $ ' ' $ g.Timezone_Offset" /> <h2 style='color: gray'> Senario #<mvt:eval expr="POS1"/>: &mvt:senario:descrip; <small>&mvt:senario:date:formatted;</small> </h2> <mvt:if expr="l.settings:senario:date:dayofweek_formatted CIN 'Monday, Tuesday, Wednesday, Thursday' AND l.settings:senario:date:24hour LT 10"> <mvt:comment> Estimation Logic: Ship Today </mvt:comment> <mvt:assign name="l.settings:senario:cutoff:hours" value="10 - l.settings:senario:date:24hour" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="60 - l.settings:senario:date:min" /> <mvt:if expr="l.settings:senario:cutoff:minutes EQ 60"> <mvt:assign name="l.settings:senario:cutoff:hours" value="l.settings:senario:cutoff:hours + 1" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="0" /> </mvt:if> <h3>Order within <b>&mvt:senario:cutoff:hours; hours &mvt:senario:cutoff:minutes; minutes</b>, and it should ship today.</h3> <mvt:elseif expr="l.settings:senario:date:dayofweek_formatted CIN 'Monday, Tuesday, Wednesday' AND l.settings:senario:date:24hour GE 10"> <mvt:comment> Estimation Logic: Ship Tomorrow </mvt:comment> <mvt:assign name="l.settings:senario:cutoff:hours" value="34 - l.settings:senario:date:24hour" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="60 - l.settings:senario:date:min" /> <mvt:if expr="l.settings:senario:cutoff:minutes EQ 60"> <mvt:assign name="l.settings:senario:cutoff:hours" value="l.settings:senario:cutoff:hours + 1" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="0" /> </mvt:if> <mvt:comment><h3>Order within <b>&mvt:senario:cutoff:hours; hours &mvt:senario:cutoff:minutes; minutes</b> and it should ship tomorrow.</h3></mvt:comment> <h3>Order today, and it should ship tomorrow.</h3> <mvt:else> <mvt:comment> Estimation Logic: Ship Monday </mvt:comment> <h3>Order today, and it should ship on Monday.</h3> </mvt:if> <p> <small> <ul> <li>From Monday to Thursday, orders placed <i>before</i> 10am will ship the same day.</li> <li>From Monday to Wednesday, orders placed <i>after</i> 10am will ship the next day.</li> <li>All other others (Thursday after 10am to Monday before 10 am) will be shipped on Monday.</li> </ul> </small> </p> <br><br><hr><br><br> </mvt:foreach> <mvt:comment> Just a Debugging Helper </mvt:comment> <mvt:eval expr="glosub(miva_array_serialize(l.settings:senarios), ',', '<br>')" />
 
View "Estimate Order Shipping Date"
<mvt:comment> Account for Daylight Savings time </mvt:comment> <mvt:if expr="s.tm_isdst"> <mvt:assign name="g.Timezone_Offset" value="'-5'" /> <mvt:assign name="g.Timezone_Abbreviation" value="'CDT'" /> <mvt:else> <mvt:assign name="g.Timezone_Offset" value="'-6'" /> <mvt:assign name="g.Timezone_Abbreviation" value="'CST'" /> </mvt:if> <mvt:if expr="s.tm_isdst"> <p>Daylight savings time <b>IS</b> in effect. Timezone Offset: &mvte:global:Timezone_Offset;</p> <mvt:else> <p>Daylight savings time is <b>NOT</b> in effect. Timezone Offset: &mvte:global:Timezone_Offset;</p> </mvt:if> <hr> <mvt:comment> Assign a Days-of-the-week text array for later </mvt:comment> <mvt:assign name="l.settings:daysofweek[1]" value="'Sunday'" /> <mvt:assign name="l.settings:daysofweek[2]" value="'Monday'" /> <mvt:assign name="l.settings:daysofweek[3]" value="'Tuesday'" /> <mvt:assign name="l.settings:daysofweek[4]" value="'Wednesday'" /> <mvt:assign name="l.settings:daysofweek[5]" value="'Thursday'" /> <mvt:assign name="l.settings:daysofweek[6]" value="'Friday'" /> <mvt:assign name="l.settings:daysofweek[7]" value="'Saturday'" /> <mvt:comment> Prepare days to simulate & test senarios </mvt:comment> <mvt:assign name="l.settings:senarios[1]:descrip" value="'Monday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[1]:timestamp" value="1470657660" /> <mvt:assign name="l.settings:senarios[2]:descrip" value="'Monday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[2]:timestamp" value="1470693660" /> <mvt:assign name="l.settings:senarios[3]:descrip" value="'Tuesday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[3]:timestamp" value="1470744060" /> <mvt:assign name="l.settings:senarios[4]:descrip" value="'Tuesday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[4]:timestamp" value="1470780060" /> <mvt:assign name="l.settings:senarios[5]:descrip" value="'Wednesday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[5]:timestamp" value="1470830460" /> <mvt:assign name="l.settings:senarios[6]:descrip" value="'Wednesday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[6]:timestamp" value="1470866460" /> <mvt:assign name="l.settings:senarios[7]:descrip" value="'Thursday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[7]:timestamp" value="1470916860" /> <mvt:assign name="l.settings:senarios[8]:descrip" value="'Thursday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[8]:timestamp" value="1470952860" /> <mvt:assign name="l.settings:senarios[9]:descrip" value="'Friday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[9]:timestamp" value="1471003260" /> <mvt:assign name="l.settings:senarios[10]:descrip" value="'Friday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[10]:timestamp" value="1471039260" /> <mvt:assign name="l.settings:senarios[11]:descrip" value="'Saturday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[11]:timestamp" value="1471089660" /> <mvt:assign name="l.settings:senarios[12]:descrip" value="'Saturday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[12]:timestamp" value="1471125660" /> <mvt:assign name="l.settings:senarios[13]:descrip" value="'Sunday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[13]:timestamp" value="1471089660" /> <mvt:assign name="l.settings:senarios[14]:descrip" value="'Sunday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[14]:timestamp" value="1471125660" /> <mvt:comment> Loop over each senario and test the estimation logic </mvt:comment> <mvt:foreach iterator="senario" array="senarios"> <mvt:comment> Assign some date-time variables that make it easier to read, write, and compare dates when we apply the estimation logic </mvt:comment> <mvt:assign name="l.settings:senario:date:year" value="time_t_year( l.settings:senario:timestamp, g.Timezone_Offset )" /> <mvt:assign name="l.settings:senario:date:month" value="padl(time_t_month( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:day" value="padl(time_t_dayofmonth( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:dayofweek" value="time_t_dayofweek( l.settings:senario:timestamp, g.Timezone_Offset )" /> <mvt:assign name="l.settings:senario:date:dayofweek_formatted" value="l.settings:daysofweek[time_t_dayofweek( l.settings:senario:timestamp, g.Timezone_Offset )]" /> <mvt:assign name="l.settings:senario:date:24hour" value="padl(time_t_hour( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:min" value="padl(time_t_min( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:sec" value="padl(time_t_sec( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:formatted" value="l.settings:senario:date:year $ '-' $ l.settings:senario:date:month $ '-' $ l.settings:senario:date:day $ ' ' $ l.settings:senario:date:24hour $ ':' $ l.settings:senario:date:min $ ':' $ l.settings:senario:date:sec $ ' ' $ g.Timezone_Offset" /> <h2 style='color: gray'> Senario #<mvt:eval expr="POS1"/>: &mvt:senario:descrip; <small>&mvt:senario:date:formatted;</small> </h2> <mvt:if expr="l.settings:senario:date:dayofweek_formatted CIN 'Monday, Tuesday, Wednesday, Thursday' AND l.settings:senario:date:24hour LT 10"> <mvt:comment> Estimation Logic: Ship Today </mvt:comment> <mvt:assign name="l.settings:senario:cutoff:hours" value="10 - l.settings:senario:date:24hour" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="60 - l.settings:senario:date:min" /> <mvt:if expr="l.settings:senario:cutoff:minutes EQ 60"> <mvt:assign name="l.settings:senario:cutoff:hours" value="l.settings:senario:cutoff:hours + 1" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="0" /> </mvt:if> <h3>Order within <b>&mvt:senario:cutoff:hours; hours &mvt:senario:cutoff:minutes; minutes</b>, and it should ship today.</h3> <mvt:elseif expr="l.settings:senario:date:dayofweek_formatted CIN 'Monday, Tuesday, Wednesday' AND l.settings:senario:date:24hour GE 10"> <mvt:comment> Estimation Logic: Ship Tomorrow </mvt:comment> <mvt:assign name="l.settings:senario:cutoff:hours" value="34 - l.settings:senario:date:24hour" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="60 - l.settings:senario:date:min" /> <mvt:if expr="l.settings:senario:cutoff:minutes EQ 60"> <mvt:assign name="l.settings:senario:cutoff:hours" value="l.settings:senario:cutoff:hours + 1" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="0" /> </mvt:if> <mvt:comment><h3>Order within <b>&mvt:senario:cutoff:hours; hours &mvt:senario:cutoff:minutes; minutes</b> and it should ship tomorrow.</h3></mvt:comment> <h3>Order today, and it should ship tomorrow.</h3> <mvt:else> <mvt:comment> Estimation Logic: Ship Monday </mvt:comment> <h3>Order today, and it should ship on Monday.</h3> </mvt:if> <p> <small> <ul> <li>From Monday to Thursday, orders placed <i>before</i> 10am will <b>ship the same day</b></li> <li>From Monday to Wednesday, orders placed <i>after</i> 10am will <b>ship the next day</b></li> <li>All other others (Thursday after 10am to Monday before 10 am) will be <b>shipped on Monday</b>.</li> </ul> </small> </p> <br><hr><br> </mvt:foreach> <mvt:comment> Just a Debugging Helper </mvt:comment> <mvt:eval expr="glosub(miva_array_serialize(l.settings:senarios), ',', '<br>')" />
 
View "Estimate Order Shipping Date"
<mvt:if expr="s.tm_isdst"> <mvt:assign name="g.Timezone_Offset" value="'-5'" /> <mvt:assign name="g.Timezone_Abbreviation" value="'CDT'" /> <mvt:else> <mvt:assign name="g.Timezone_Offset" value="'-6'" /> <mvt:assign name="g.Timezone_Abbreviation" value="'CST'" /> </mvt:if> <mvt:if expr="s.tm_isdst"> <p>Daylight savings time <b>IS</b> in effect. Timezone Offset: &mvte:global:Timezone_Offset;</p> <mvt:else> <p>Daylight savings time is <b>NOT</b> in effect. Timezone Offset: &mvte:global:Timezone_Offset;</p> </mvt:if> <mvt:assign name="l.settings:daysofweek[1]" value="'Sunday'" /> <mvt:assign name="l.settings:daysofweek[2]" value="'Monday'" /> <mvt:assign name="l.settings:daysofweek[3]" value="'Tuesday'" /> <mvt:assign name="l.settings:daysofweek[4]" value="'Wednesday'" /> <mvt:assign name="l.settings:daysofweek[5]" value="'Thursday'" /> <mvt:assign name="l.settings:daysofweek[6]" value="'Friday'" /> <mvt:assign name="l.settings:daysofweek[7]" value="'Saturday'" /> <hr> <mvt:assign name="l.settings:senarios[1]:descrip" value="'Monday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[1]:timestamp" value="1470657660" /> <mvt:assign name="l.settings:senarios[2]:descrip" value="'Monday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[2]:timestamp" value="1470693660" /> <mvt:assign name="l.settings:senarios[3]:descrip" value="'Tuesday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[3]:timestamp" value="1470744060" /> <mvt:assign name="l.settings:senarios[4]:descrip" value="'Tuesday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[4]:timestamp" value="1470780060" /> <mvt:assign name="l.settings:senarios[5]:descrip" value="'Wednesday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[5]:timestamp" value="1470830460" /> <mvt:assign name="l.settings:senarios[6]:descrip" value="'Wednesday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[6]:timestamp" value="1470866460" /> <mvt:assign name="l.settings:senarios[7]:descrip" value="'Thursday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[7]:timestamp" value="1470916860" /> <mvt:assign name="l.settings:senarios[8]:descrip" value="'Thursday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[8]:timestamp" value="1470952860" /> <mvt:assign name="l.settings:senarios[9]:descrip" value="'Friday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[9]:timestamp" value="1471003260" /> <mvt:assign name="l.settings:senarios[10]:descrip" value="'Friday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[10]:timestamp" value="1471039260" /> <mvt:assign name="l.settings:senarios[11]:descrip" value="'Saturday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[11]:timestamp" value="1471089660" /> <mvt:assign name="l.settings:senarios[12]:descrip" value="'Saturday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[12]:timestamp" value="1471125660" /> <mvt:assign name="l.settings:senarios[13]:descrip" value="'Sunday - before 10am CT'" /> <mvt:assign name="l.settings:senarios[13]:timestamp" value="1471089660" /> <mvt:assign name="l.settings:senarios[14]:descrip" value="'Sunday - after 10am CT'" /> <mvt:assign name="l.settings:senarios[14]:timestamp" value="1471125660" /> <mvt:foreach iterator="senario" array="senarios"> <mvt:assign name="l.settings:senario:date:year" value="time_t_year( l.settings:senario:timestamp, g.Timezone_Offset )" /> <mvt:assign name="l.settings:senario:date:month" value="padl(time_t_month( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:day" value="padl(time_t_dayofmonth( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:dayofweek" value="time_t_dayofweek( l.settings:senario:timestamp, g.Timezone_Offset )" /> <mvt:assign name="l.settings:senario:date:dayofweek_formatted" value="l.settings:daysofweek[time_t_dayofweek( l.settings:senario:timestamp, g.Timezone_Offset )]" /> <mvt:assign name="l.settings:senario:date:24hour" value="padl(time_t_hour( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:min" value="padl(time_t_min( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:sec" value="padl(time_t_sec( l.settings:senario:timestamp, g.Timezone_Offset ), 2, 0)" /> <mvt:assign name="l.settings:senario:date:formatted" value="l.settings:senario:date:year $ '-' $ l.settings:senario:date:month $ '-' $ l.settings:senario:date:day $ ' ' $ l.settings:senario:date:24hour $ ':' $ l.settings:senario:date:min $ ':' $ l.settings:senario:date:sec $ ' ' $ g.Timezone_Offset" /> <h2 style="color: gray;">Senario #<mvt:eval expr="POS1"/>: &mvt:senario:descrip; <small>&mvt:senario:date:formatted;</small></h2> <mvt:if expr="l.settings:senario:date:dayofweek_formatted CIN 'Monday, Tuesday, Wednesday, Thursday' AND l.settings:senario:date:24hour LT 10"> <mvt:comment> Ship Today </mvt:comment> <mvt:assign name="l.settings:senario:cutoff:hours" value="10 - l.settings:senario:date:24hour" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="60 - l.settings:senario:date:min" /> <mvt:if expr="l.settings:senario:cutoff:minutes EQ 60"> <mvt:assign name="l.settings:senario:cutoff:hours" value="l.settings:senario:cutoff:hours + 1" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="0" /> </mvt:if> <h3>Order within <b>&mvt:senario:cutoff:hours; hours &mvt:senario:cutoff:minutes; minutes</b> and it should ship today.</h3> <mvt:elseif expr="l.settings:senario:date:dayofweek_formatted CIN 'Monday, Tuesday, Wednesday' AND l.settings:senario:date:24hour GE 10"> <mvt:comment> | Ship Tomorrow </mvt:comment> <mvt:assign name="l.settings:senario:cutoff:hours" value="34 - l.settings:senario:date:24hour" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="60 - l.settings:senario:date:min" /> <mvt:if expr="l.settings:senario:cutoff:minutes EQ 60"> <mvt:assign name="l.settings:senario:cutoff:hours" value="l.settings:senario:cutoff:hours + 1" /> <mvt:assign name="l.settings:senario:cutoff:minutes" value="0" /> </mvt:if> <mvt:comment><h3>Order within <b>&mvt:senario:cutoff:hours; hours &mvt:senario:cutoff:minutes; minutes</b> and it should ship tomorrow.</h3></mvt:comment> <h3>Order today and it should ship tomorrow.</h3> <mvt:else> <mvt:comment> Ship Monday </mvt:comment> <h3>Order today and it should ship monday.</h3> </mvt:if> <p> <small> <ul> <li>From Monday to Thursday, orders placed <i>before</i> 10am will <b>ship the same day</b></li> <li>From Monday to Wednesday, orders placed <i>after</i> 10am will <b>ship the next day</b></li> <li>All other others (Thursday after 10am to Monday before 10 am) will be <b>shipped on Monday</b>.</li> </ul> </small> </p> <br><hr><br> </mvt:foreach> <mvt:eval expr="glosub(miva_array_serialize(l.settings:senarios), ',', '<br>')" />
 

Basket #11760

Get the formatted date one week from now.
Created: 1455057431
View "Basket #11760"
<mvt:eval expr="7 - 3" />