Zen Cart Logo
Forums / General Questions / If subtotal < 40 echo

If subtotal < 40 echo

Views: 1,623

Results 1 to 13 of 13
11 Feb 2012, 9:42 PM
#1
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

If subtotal < 40 echo

I'm trying to get a small piece of code to display on the checkout page.

What I would like is for the code to be able to do the following

40.00 - sub total = x

echo x if subtotal is < 40.00

Any ideas?

12 Feb 2012, 1:37 AM
#2
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Re: If subtotal < 40 echo

it can't be that hard....

12 Feb 2012, 1:54 AM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: If subtotal < 40 echo

Try using:
$order->info['subtotal']

12 Feb 2012, 11:36 AM
#4
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Re: If subtotal < 40 echo

will do

12 Feb 2012, 11:51 AM
#5
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Re: If subtotal < 40 echo

<?php if ($order->info['subtotal'] < 40.00) { echo 'test'; } else { echo 'test2'; } ?>

no joy

12 Feb 2012, 12:28 PM
#6
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Re: If subtotal < 40 echo

should say i'm on 1.3.9 not 1.5

12 Feb 2012, 2:13 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: If subtotal < 40 echo

I am not sure what to tell you ... I put your code in tpl_checkout_shipping_default.php and it works fine ...

Can you check in the Modules ... Order Totals ... that you have the Sub-Total ot_subtotal installed ...

12 Feb 2012, 9:44 PM
#8
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Re: If subtotal < 40 echo

It always results in "test"

I am basically trying to have a simple if statement that can see if the subtotal is less than £40, if it is, suggest they need to spend more to get free shipping.

Ideally it would tell them how much more they needed to spend to get free shipping.

12 Feb 2012, 11:22 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: If subtotal < 40 echo

Where in the code are you sticking this test line?

If you add it right at the top of the tpl_checkout_shipping.php below the line:

<div class="centerColumn" id="checkoutShipping">

Do you see it on the checkout_shipping?

13 Feb 2012, 10:54 AM
#10
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Re: If subtotal < 40 echo

What about in tpl_shopping_cart_default.php

13 Feb 2012, 2:06 PM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: If subtotal < 40 echo

Then you need to change that to the correct value ...

Try something like:

<?php if ($_SESSION['cart']->show_total() < 40.00) { echo 'test'; } else { echo 'test2'; } ?>
14 Feb 2012, 4:14 PM
#12
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Re: If subtotal < 40 echo

Thank you :)

14 Feb 2012, 4:22 PM
#13
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: If subtotal < 40 echo

You are most welcome ... glad that this worked for you thanks for the update ... :smile: