Estimated Shipping Delivery Dates (Version: 8) - Miva - Snippets
<mvt:comment><!-- Days --></mvt:comment> <mvt:assign name="g.timezone_offset" value="'local'" /> <mvt:assign name="l.settings:days[1]:name" value="'Sunday'" /> <mvt:assign name="l.settings:days[1]:time" value="1431284400" /> <mvt:assign name="l.settings:days[2]:name" value="'Monday'" /> <mvt:assign name="l.settings:days[2]:time" value="1431370800" /> <mvt:assign name="l.settings:days[3]:name" value="'Tuesday'" /> <mvt:assign name="l.settings:days[3]:time" value="1431457200" /> <mvt:assign name="l.settings:days[4]:name" value="'Wednesday'" /> <mvt:assign name="l.settings:days[4]:time" value="1431543600" /> <mvt:assign name="l.settings:days[5]:name" value="'Thursday'" /> <mvt:assign name="l.settings:days[5]:time" value="1431630000" /> <mvt:assign name="l.settings:days[6]:name" value="'Friday'" /> <mvt:assign name="l.settings:days[6]:time" value="1431716400" /> <mvt:assign name="l.settings:days[7]:name" value="'Saturday'" /> <mvt:assign name="l.settings:days[7]:time" value="1431802800" /> <mvt:comment><!-- Shipping Methods --></mvt:comment> <mvt:assign name="l.settings:shippingmethods[1]:name" value="'Next Day'" /> <mvt:assign name="l.settings:shippingmethods[1]:delivery:min" value="1" /> <mvt:assign name="l.settings:shippingmethods[1]:delivery:max" value="1" /> <mvt:assign name="l.settings:shippingmethods[2]:name" value="'2nd Day'" /> <mvt:assign name="l.settings:shippingmethods[2]:delivery:min" value="2" /> <mvt:assign name="l.settings:shippingmethods[2]:delivery:max" value="2" /> <mvt:assign name="l.settings:shippingmethods[3]:name" value="'Ground'" /> <mvt:assign name="l.settings:shippingmethods[3]:delivery:min" value="7" /> <mvt:assign name="l.settings:shippingmethods[3]:delivery:max" value="10" /> <mvt:foreach iterator="day" array="days"> <mvt:assign name="l.settings:day:month" value="time_t_month( l.settings:day:time, g.timezone_offset )" /> <mvt:assign name="l.settings:day:day" value="time_t_dayofmonth( l.settings:day:time, g.timezone_offset )" /> <mvt:assign name="l.settings:day:formatted_date" value="l.settings:day:month $ '/' $ l.settings:day:day" /> <h2>Order Placed: &mvt:day:name; @ &mvt:day:formatted_date;</h2> <mvt:foreach iterator="method" array="shippingmethods"> <mvt:assign name="l.settings:method:elapsed:days" value="0" /> <mvt:assign name="l.settings:method:shipping:days" value="0" /> <mvt:assign name="l.settings:method:processing:days" value="0" /> <mvt:assign name="l.settings:method:delivered" value="''" /> <mvt:assign name="l.settings:method:estimated:min" value="''" /> <mvt:assign name="l.settings:method:estimated:max" value="''" /> <mvt:while expr="ISNULL l.settings:method:delivered"> <mvt:assign name="l.settings:method:counter" value="l.settings:method:counter + 1" /> <mvt:assign name="l.settings:method:elapsed:days" value="l.settings:method:elapsed:days + 1" /> <mvt:assign name="l.settings:method:elapsed:duration" value="60 * 60 * 24 * l.settings:method:elapsed:days" /> <mvt:assign name="l.settings:method:elapsed:future_time" value="l.settings:day:time + l.settings:method:elapsed:duration"/> <mvt:assign name="l.settings:method:estimated:month" value="time_t_month( l.settings:method:elapsed:future_time, g.timezone_offset )" /> <mvt:assign name="l.settings:method:estimated:day" value="time_t_dayofmonth( l.settings:method:elapsed:future_time, g.timezone_offset )" /> <mvt:assign name="l.settings:method:estimated:dayofweek" value="time_t_dayofweek( l.settings:method:elapsed:future_time, g.timezone_offset )" /> <mvt:if expr="l.settings:method:estimated:dayofweek GT 1 AND l.settings:method:estimated:dayofweek LT 7"> <mvt:if expr="l.settings:method:processing:days EQ 0"> </mvt:if> <mvt:assign name="l.settings:method:processing:days" value="l.settings:method:processing:days + 1" /> </mvt:if> <mvt:if expr="l.settings:method:processing:days GT 1 AND l.settings:method:estimated:dayofweek GT 1"> <mvt:assign name="l.settings:method:shipping:days" value="l.settings:method:shipping:days + 1" /> </mvt:if> <mvt:if expr="ISNULL l.settings:method:estimated:min AND l.settings:method:shipping:days GE l.settings:method:delivery:min AND (l.settings:method:estimated:dayofweek GT 1 AND l.settings:method:estimated:dayofweek LT 7)"> <mvt:assign name="l.settings:method:estimated:min" value="l.settings:method:estimated:month $ '/' $ l.settings:method:estimated:day" /> <mvt:assign name="l.settings:method:estimated:min_day" value="l.settings:days[l.settings:method:estimated:dayofweek]:name" /> </mvt:if> <mvt:if expr="ISNULL l.settings:method:estimated:max AND l.settings:method:shipping:days GE l.settings:method:delivery:max AND (l.settings:method:estimated:dayofweek GT 1 AND l.settings:method:estimated:dayofweek LT 7)"> <mvt:assign name="l.settings:method:estimated:max" value="l.settings:method:estimated:month $ '/' $ l.settings:method:estimated:day" /> <mvt:assign name="l.settings:method:estimated:max_day" value="l.settings:days[l.settings:method:estimated:dayofweek]:name" /> <mvt:assign name="l.settings:method:delivered" value="1" /> </mvt:if> </mvt:while> </mvt:foreach> <mvt:foreach iterator="method" array="shippingmethods"> <p> <b>&mvt:method:name;</b><br> Estimated Delivery: &mvt:method:delivery:min;<mvt:if expr="l.settings:method:delivery:min NE l.settings:method:delivery:max">-&mvt:method:delivery:max;</mvt:if> business day(s)<br> Should Arrive: &mvt:method:estimated:min_day; &mvt:method:estimated:min;<mvt:if expr="l.settings:method:delivery:min NE l.settings:method:delivery:max"> to &mvt:method:estimated:max_day; &mvt:method:estimated:max;</mvt:if> </p> </mvt:foreach> <hr> </mvt:foreach>