X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   simple smarty question (https://forum.x-cart.com/showthread.php?t=7636)

spoonernyc 05-18-2004 06:20 AM

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

jeremye 05-18-2004 06:44 AM

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.

TelaFirma 05-18-2004 06:46 AM

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

TelaFirma 05-18-2004 06:48 AM

LOL

jeremye 05-18-2004 06:49 AM

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

I guess great minds think alike.

spoonernyc 05-18-2004 10:36 AM

thank you very much for the help...

:lol:


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

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.