Help whit a code timestamp

Hi ,

I make a product template like groupon with coupons.

now i have make in database a field service_till

This field numeric and present the coupon till date in Months 1-12



Now i try to put it out the order.date + this value

i assing this field with
{assign var="stm" value=strtotime("+`$oi.extra.service_till` months")}


how i can add this to {$order_info.timestamp} for a correct output ?

You woudln't do it in the template, you would do it in a PHP PRE controller. However, I would NOT recommend adjusting the timestamp of the order based on a coupon or other external factor. You should use a completely different field and I would suggest NOT modifying your database, but to use the $order_info.extras array instead.

Hi thanks for answer.

i not adjust the $order_info.timestamp i need it for make a calculation for the expired date of the coupon that show in the invoice.tpl.

i have this solution whit the unix based calculation


{$order_info.timestamp+60*60*24*30*$oi.extra.service_till|date_format:"%e. %B %Y"}


bit this whit 30 day.

i would like a correct solution.

You should use the 'math' function and assign the result to a variable for comparison.

If you are doing a comparison for validity, why are you formatting the result as a date rather than just comparing whether one timestamp is greater than the other?

:) strange local the code works on the server dont works.

Jes have now assign the math. Works is Oke

i dont understand the comparing of the the timestamp.



I leave it so is okey. Thank you for help

<br />
{math equation="order_date + 60 * 60 * 24 * 30 * how_many_months_are_valid" order_date=$order_info.timestamp how_many_months_are_valid=$oi.extra.service_till assign="coupon_valid_till"}<br />
<br />
{$coupon_valid_till|date_format:"%e. %B %Y"}<br />