Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

simple smarty question

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 05-18-2004, 06:20 AM
 
spoonernyc spoonernyc is offline
 

Member
  
Join Date: Apr 2004
Posts: 18
 

Default simple smarty question

I have an offer of free shipping for all orders over $30 so I want to implement the following:

{if $subtotal<30}
if you order just ($30-$subtotal} more you can get free shipping
{/if}

I can get the message to print if it is lower than $30 but how do you do simple math in Smarty?

Just as a side note: the Smarty folks MUST get their act together on the docs. I have spent the past hour trying to find some documentation of how to do this VERY SIMPLE task and cannot find it on the SMARTY site. they have one example of MATH for variables but it does not talk about using those variables it just shows you that you can add things together...
LAME...

thank you for any help
Reply With Quote
  #2  
Old 05-18-2004, 06:44 AM
 
jeremye jeremye is offline
 

Senior Member
  
Join Date: Apr 2004
Location: Philadelphia, PA
Posts: 158
 

Default

Try this:

Code:
{if $subtotal<30} {math equation="30 - subtot" subtot=$subtotal assign="amtleft"} If you order just {$amtleft} more you can get free shipping {/if}

And yes, the Smarty docs suck; especially the search function.

HTH.
__________________
Jeremy
X-Cart Gold v3.4.14 [Linux/Apache]
Heavily Modded
Reply With Quote
  #3  
Old 05-18-2004, 06:46 AM
  TelaFirma's Avatar 
TelaFirma TelaFirma is offline
 

X-Adept
  
Join Date: Nov 2002
Location: North Carolina USA
Posts: 930
 

Default

Try this:

Code:
{if $subtotal lt 30} {math equation="30-x" x=$subtotal assign="more" } If you order just {$more} more you can get free shipping {/if}

I have not tested this, but it should work just fine.

Here is the page in the Smarty Docs that references math equations in templates:

http://smarty.php.net/manual/en/language.function.math.php
Reply With Quote
  #4  
Old 05-18-2004, 06:48 AM
  TelaFirma's Avatar 
TelaFirma TelaFirma is offline
 

X-Adept
  
Join Date: Nov 2002
Location: North Carolina USA
Posts: 930
 

Default

LOL
Reply With Quote
  #5  
Old 05-18-2004, 06:49 AM
 
jeremye jeremye is offline
 

Senior Member
  
Join Date: Apr 2004
Location: Philadelphia, PA
Posts: 158
 

Default

Well if that's not a coincidence I don't know what is...

I guess great minds think alike.
__________________
Jeremy
X-Cart Gold v3.4.14 [Linux/Apache]
Heavily Modded
Reply With Quote
  #6  
Old 05-18-2004, 10:36 AM
 
spoonernyc spoonernyc is offline
 

Member
  
Join Date: Apr 2004
Posts: 18
 

Default

thank you very much for the help...

Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:52 PM.

   

 
X-Cart forums © 2001-2020