Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / shipping method disabled if total more than x

shipping method disabled if total more than x

Locked

Views: 1,627

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
15 Jan 2009, 11:31 PM
#1
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,769
Plugin Contributions:
20

shipping method disabled if total more than x

i use store pickup and two flat rate modules, cheap (delivery in 3-4 days) and expensive (next day delivery, safer).

i want to disable the cheap delivery option if an order is over 500$.

how do i do that?

i also use CWOA if it makes a difference...

17 Jan 2009, 6:21 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: shipping method disabled if total more than x

The shipping modules display or hide based on the setting of the:
$this->enabled

If you set that to true, then it shows ...

If you set that to false, then it hides ...

So, you can control that to not show when the Total of the shopping cart is > 500 ...

18 Jan 2009, 12:30 PM
#3
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,769
Plugin Contributions:
20

Re: shipping method disabled if total more than x

OK...

How do i do that? I don't see any options in admin so i guess it has to be done by code. Can you please give a "dummies guide" on how to do it?

18 Jan 2009, 3:41 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: shipping method disabled if total more than x

Something like this on the shipping module that you want to alter:

    global $cart;
    if (IS_ADMIN_FLAG === true || $_SESSION['cart']->show_total() > 500) {
        $this->enabled = false;
    }

Put it after the code for:

        if ($check_flag == false) {
          $this->enabled = false;
        }
18 Jan 2009, 9:18 PM
#5
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,769
Plugin Contributions:
20

Re: shipping method disabled if total more than x

i did that and it doesn't work.
here's what it looked like before

  $check->MoveNext();
        }

        if ($check_flag == false) {
          $this->enabled = false;
        }
      }

and this is now:

$check->MoveNext();
        }

        if ($check_flag == false) {
          $this->enabled = false;
        }
		global $cart;
    if (IS_ADMIN_FLAG === true || $_SESSION['cart']->show_total() > 2500) {
        $this->enabled = false;
    }

i uploaded it to my server, added a product that costs 4500 and still had the option for this shipping method available and working.

i actually use "item" module for my other flat rate shipping. so, the file i was working on was includes/modules/shipping/item.php

am I missing something or this really doesn't work?

19 Jan 2009, 3:52 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: shipping method disabled if total more than x

I had you put that one closing bracket to high ...

It should look like this when done:

          $check->MoveNext();
        }

        if ($check_flag == false) {
          $this->enabled = false;
        }
      }
    global $cart;
    if (IS_ADMIN_FLAG === true || $_SESSION['cart']->show_total() > 500) {
        $this->enabled = false;
    }
    }

// class methods
20 Jan 2009, 3:24 PM
#7
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,769
Plugin Contributions:
20

Re: shipping method disabled if total more than x

:blush: whoops...

thank you, this works!

i don't understand the code so good so i didn't see this, but i'll have to try and learn more.

Anyway, thank you!

20 Jan 2009, 4:39 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: shipping method disabled if total more than x

It did not help you much as I told you to put it one bracket too high ... :cool:

But isn't customizing fun? Now you can rule the world ... :flex:

5 Mar 2009, 4:34 PM
#9
charlz71 avatar

charlz71

New Zenner

Join Date:
Feb 2009
Posts:
17
Plugin Contributions:
0

Re: shipping method disabled if total more than x

Ajeh:

Something like this on the shipping module that you want to alter:

global $cart;
if (IS_ADMIN_FLAG === true || $_SESSION['cart']->show_total() > 500) {
    $this->enabled = false;
}
> 
> Put it after the code for:
> ```
        if ($check_flag == false) {
          $this->enabled = false;
        }

Hi Ajeh,

I want to implement the same code such as this one, hiding the shipping option when total reaches 500. But in my case, i want to hide Flat Rate shipping option during checkout based on the zip codes of customers. Dr Byte has done this already and posted in one of the forums which I failed to note where and it worked for me. So Im sure this is possible, to isolate those zip codes so the flat rate option will not show up when their zip code is entere.

I am not familiar with php so im really messed up on this. Hope you could find a way? Thanks a lot.

Francis