Jump to content

Help whit a code timestamp Rate Topic   - - - - -

 
  • posto
  • Senior Member
  • Members
  • Join Date: 19-Sep 11
  • 151 posts

Posted 28 June 2012 - 03:23 PM #1

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 ?
Templates for v3

**see Posto's Templates Tread**

 
  • tbirnseth
  • Senior Member
  • Members
  • Join Date: 08-Nov 08
  • 5,277 posts

Posted 28 June 2012 - 04:53 PM #2

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.
EZ Merchant Solutions

Authorized Reseller - Cart licenses: $305 (lowest reseller price)
Custom B2B Development, Consulting and Special Projects (get a quote).
Commercial addons to meet your business and operations needs.

http://www.ez-ms.com

 
  • posto
  • Senior Member
  • Members
  • Join Date: 19-Sep 11
  • 151 posts

Posted 28 June 2012 - 05:54 PM #3

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.
Templates for v3

**see Posto's Templates Tread**

 
  • tbirnseth
  • Senior Member
  • Members
  • Join Date: 08-Nov 08
  • 5,277 posts

Posted 29 June 2012 - 06:32 PM #4

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?
EZ Merchant Solutions

Authorized Reseller - Cart licenses: $305 (lowest reseller price)
Custom B2B Development, Consulting and Special Projects (get a quote).
Commercial addons to meet your business and operations needs.

http://www.ez-ms.com

 
  • posto
  • Senior Member
  • Members
  • Join Date: 19-Sep 11
  • 151 posts

Posted 30 June 2012 - 06:24 AM #5

:) 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
{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"}

{$coupon_valid_till|date_format:"%e. %B %Y"}

Templates for v3

**see Posto's Templates Tread**