Basket #83478 (Version: ) - Miva - Snippets
<mvt:comment> Logic to determine Next 'Tuesday' Tuesday is "3"" If bought Friday, Saturday Or Sunday - Calculate date of next Monday, If bought Monday or Tuesday, calculate next wednesdays date, if bought wednesday thursday, calculate upcoming fridays date. </mvt:comment> <mvt:assign name="l.sunday" value="1" /> <mvt:assign name="l.monday" value="2" /> <mvt:assign name="l.tuesday" value="3" /> <mvt:assign name="l.wednesday" value="4" /> <mvt:assign name="l.thursday" value="5" /> <mvt:assign name="l.friday" value="6" /> <mvt:assign name="l.saturday" value="7" /> <mvt:comment>Determine what day of week we are calculating the future date for based on current day</mvt:comment> <mvt:if expr="s.tm_wday EQ l.friday OR s.tm_wday EQ l.saturday OR s.tm_wday EQ l.sunday"> <mvt:assign name="l.dayofweek" value="l.monday" /> <mvt:elseif expr="s.tm_wday EQ l.monday OR s.tm_wday EQ l.tuesday"> <mvt:assign name="l.dayofweek" value="l.wednesday" /> <mvt:else> <mvt:assign name="l.dayofweek" value="l.friday" /> </mvt:if> <mvt:assign name="l.dayofweek" value="7" /> <mvt:assign name="l.today_dow" value="time_t_dayofweek( s.dyn_time_t, g.Merchant_Local_Timezone )" /> <mvt:assign name="l.math" value="( ( l.today_dow - l.dayofweek ) - 7 ) * -1" /> <mvt:assign name="l.next_tuesday" value="mktime_t( s.tm_year, s.tm_mon, s.tm_mday, 0, 0, 0, g.Merchant_Local_Timezone ) + ( 60 * 60 * 24 * l.math )" /> <mvt:assign name="l.months" value="miva_array_deserialize( 'January,February,March,April,May,June,July,August,September,October,November,December' )" /> <mvt:assign name="l.month" value="l.months[ time_t_month( l.next_tuesday, g.Merchant_Local_Timezone ) ]" /> <mvt:assign name="l.day" value="time_t_dayofmonth( l.next_tuesday, g.Merchant_Local_Timezone )" /> <mvt:assign name="g.ships_on_date" value="'Tuesday, ' $ l.month $ ' ' $ l.day" /> Ships by: &mvt:global:ships_on_date; <br> Current day: <mvt:eval expr="l.dayofweek" /> today_dow: <mvt:eval expr="l.today_dow" />