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

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

Views: 9,340

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?