Miva Product Last Order Date
<mvt:foreach iterator="product" array="products">
<!--
SELECT order_id,product_id FROM s01_OrderItems WHERE product_id=6528 ORDER BY order_id DESC LIMIT 1
l.settings:appliedCoupon[1]:freeship
-->
<mvt:if expr="POS1 LT g.limit">
<mvt:item name="ry_toolbelt" param="assign|g.queryOrderId|'SELECT order_id,product_id FROM s01_OrderItems WHERE (product_id = `' $ l.all_settings:product:id $ '`) ORDER BY order_id DESC LIMIT 1'" />
<mvt:item name="ry_toolbelt" param="query|g.queryOrderId|getLastOrderId" />
<!-- Order: &mvt:getLastOrderId[1]:order_id; - -->
<mvt:item name="ry_toolbelt" param="assign|g.queryOrderDate|'SELECT id,orderdate FROM s01_Orders WHERE (id = `' $ l.all_settings:getLastOrderId[1]:order_id $ '`)'" />
<mvt:item name="ry_toolbelt" param="query|g.queryOrderDate|getLastOrderDate" />
<!-- Date: &mvt:getLastOrderDate[1]:orderdate;, -->
<mvt:item name="toolkit" param="vassign|orderDate|l.all_settings:getLastOrderDate[1]:orderdate" />
<mvt:item name="toolkit" param="time_t_year|nyear|g.orderDate" />
<mvt:item name="toolkit" param="padl|cyear|nyear|2|0" />
<mvt:item name="toolkit" param="time_t_month|nmonth|g.orderDate" />
<mvt:item name="toolkit" param="time_t_dayofnmonth|nday|g.orderDate" />
<mvt:if expr="g.orderDate EQ ''">
<strong style="color:red">No Orders</strong>
<mvt:else>
&mvt:global:orderDate;
</mvt:if> - <a href="&mvt:product:link;">&mvt:product:name;</a><br/>
</mvt:if>
</mvt:foreach>