Site maintenance: Sun 15 Nov, from 20:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Forums / Addon Shipping Modules / Free Shipping Rules - Default, hide other shipping option upon checkout

Free Shipping Rules - Default, hide other shipping option upon checkout

Started by sangelo on 11 May 2010, 12:41 PM · Views: 9,361

Results 41 to 42 of 42
26 Feb 2011, 11:36 PM
#41
mdo82 avatar

mdo82

New Zenner

Join Date:
Apr 2010
Posts:
39
Plugin Contributions:
0

Free Shipping Rules - Default, hide other shipping option upon checkout

I'm also looking for this.
I have a weight of 570 gr en a total of €65

I have the follow code:

      if (IS_ADMIN_FLAG == false && $_SESSION['cart']->show_weight() < 570) {
      $this->enabled = true;
      } else {
      $this->enabled = false;
      }

      if (IS_ADMIN_FLAG == false && $_SESSION['cart']->show_total() > 65) {
      $this->enabled = false;
      } else {
      $this->enabled = true;
      }

But if I have a cart with a total of 8 products and a total of € 60 the module stays active.

8 product are above 570gr

27 Feb 2011, 12:01 AM
#42
ajeh avatar

ajeh

Oba-san

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

Re: Free Shipping Rules - Default, hide other shipping option upon checkout

You have two IF statements and they contain ELSE ...

$this->enabled is probably true prior to your IF statements ...

8 product are above 570gr € 60

$this->enabled = true ...

this code runs:

      if (IS_ADMIN_FLAG == false && $_SESSION['cart']->show_weight() < 570) {
      $this->enabled = true;
      } else {
      $this->enabled = false;
      }

$this->enabled = true ... :eek:

then this code runs:

      if (IS_ADMIN_FLAG == false && $_SESSION['cart']->show_total() > 65) {
      $this->enabled = false;
      } else {
      $this->enabled = true;
      }

$this->enabled = true ... :eek:

How can that happen?! :blink:

Look above your code ...

Do you see anywhere above your code between it and the line that starts with:
function

a line that contains:
global $cart;

If not, your values for the tests are being compared to 0 ...

Also, you really should put the code in an IF to test when in the Admin ... the way you have them written is half correct ...

The Top of the IF test for the Admin, what about the bottom?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!