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)
-   -   Feature help: This much until free shipping. (https://forum.x-cart.com/showthread.php?t=55321)

rubberneck 08-30-2010 01:27 PM

Feature help: This much until free shipping.
 
Hi,
My apologies if this mentioned somewhere else in the forum - couldn't find it.

I've got my cart set to give free shipping to orders over $300. What I want is a blurb that says "$xx until you qualify for free shipping". I think I know how to test if the total is less than a certain amount ({if $minicart_total_cost < 300}), but I don't know how to calculate the amount remaining. I assume I need to add it to a function somewhere.

Can someone help?

Thanks.

balinor 08-30-2010 02:00 PM

Re: Feature help: This much until free shipping.
 
Try something like this:

Code:

{if $cart.discounted_subtotal gt 300.00}
<div style="font-weight: bold; color:#00AEAF;">Congratulations, you qualify for Free Shipping!</div>
{else}
<div style="font-weight: bold; color:#00AEAF;">Spend an additional {math equation="x - y" x=300.00 y=$cart.discounted_subtotal} to qualify for Free Shipping</div>
{/if}


rubberneck 08-30-2010 02:28 PM

Re: Feature help: This much until free shipping.
 
Thanks for the quick reply. I got the following error:

Spend an additional Warning: Smarty error: math ``x - y'' in ``.../new_offers_short_list.tpl'': parameter ``y'' is empty in .../Smarty-2.6.12/Smarty.class.php on line 1095
to qualify for Free Shipping

rubberneck 08-30-2010 03:38 PM

Re: Feature help: This much until free shipping.
 
I managed to make it work by using $minicart_total_cost. Maybe not ideal, but works.

{if $minicart_total_cost gt 300.00}
<div style="font-weight: bold; color:red;">Congratulations, you qualify for free shipping!</div>
{else}
<div style="font-weight: bold; color:red;">Spend an additional ${math equation="x - y" x=300.00 y=$minicart_total_cost} to qualify for Free Shipping</div>
{/if}

balinor 08-31-2010 05:21 AM

Re: Feature help: This much until free shipping.
 
The solution I posted was for 4.0 - 4.1 uses a different smarty variable I believe. Be careful about the minicart total - you want subtotal, not total as if shipping is already added in it will throw off the calculation.


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

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