Forums / Built-in Shipping and Payment Modules / Hide table rate shipping under a certain weight

Hide table rate shipping under a certain weight

Views: 2,578

Results 1 to 11 of 11
6 Aug 2016, 4:39 AM
#1
kcin avatar

kcin

New Zenner

Join Date:
Jan 2014
Location:
Florida
Posts:
39
Plugin Contributions:
0

Hide table rate shipping under a certain weight

Good evening, I'm trying to accomplish pretty much exactly what was done in this thread here:

https://www.zen-cart.com/showthread.php?93535-Disable-Flat-rate-after-weight-of-cart-is-over-a-certain-amoun

Unfortunately, that thread is rather old, so the line 62 doesn't appear to even remotely be the right place to put that little snippet of code. If I want to hide the table rate shipping for orders over a certain weight, will this snippet still work for version 1.5.5 and if so, where is the best place in table.php to put it?

Thanks!

6 Aug 2016, 1:37 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Hide table rate shipping under a certain weight

Put this code on the blank line of 63 and see if that works for you ...

// final check for display of Table Options 
if (IS_ADMIN_FLAG == false && $_SESSION['cart']->show_weight() > 500) { 
  $this->enabled = false; 
} else { 
  $this->enabled = true; 
}  

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!

6 Aug 2016, 9:07 PM
#3
kcin avatar

kcin

New Zenner

Join Date:
Jan 2014
Location:
Florida
Posts:
39
Plugin Contributions:
0

Re: Hide table rate shipping under a certain weight

Ajeh:

Put this code on the blank line of 63 and see if that works for you ...

// final check for display of Table Options
if (IS_ADMIN_FLAG == false && $_SESSION['cart']->show_weightCOLOR=#007700 >
500) {
$this->enabled = false;
} else {
$this->enabled = true;
}
[/COLOR]


That doesn't seem quite right to me, that's right in the middle of this:

/**

  • Enter description here...

  • @var unknown_type

*/


** In fact, that definitely won't work because it's inside the commented out section, so the enter block just becomes a comment.
6 Aug 2016, 9:12 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Hide table rate shipping under a certain weight

You should place it below this code:

    // disable only when entire cart is free shipping
    if (zen_get_shipping_enabled($this->code)) {
      $this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);
    }

which ends on line 62 ...

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!

6 Aug 2016, 10:21 PM
#5
ajeh avatar

ajeh

Oba-san

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

Re: Hide table rate shipping under a certain weight

NOTE: on line numbers, perhaps your file is double spaced ...

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!

7 Aug 2016, 12:06 AM
#6
kcin avatar

kcin

New Zenner

Join Date:
Jan 2014
Location:
Florida
Posts:
39
Plugin Contributions:
0

Re: Hide table rate shipping under a certain weight

Ajeh:

You should place it below this code:

// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
  $this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);
}
> 
> which ends on line 62 ...

That worked. Though I'm not sure what I was doing wrong formatting wise, when I left the comment, it turned the entire block into a comment for some reason. I guess because there wasn't a hard return there. I couldn't quite figure out how to get one there.... anyway, once I removed it the comment, it worked. Thank you very much for your help.
19 Jul 2020, 3:06 AM
#7
IDEASLady avatar

IDEASLady

Totally Zenned

Join Date:
Aug 2005
Location:
Trujillo Alto, Puerto Rico
Posts:
1,449
Plugin Contributions:
3

Re: Hide table rate shipping under a certain weight

Ajeh:

You should place it below this code:

// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
  $this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);
}
> 
> which ends on line 62 ...

I'm trying this on 1.5.6 (under the lines that are available for customization - 215) and it doesn't work. Is the code the same for that version?

I think the table module should not give a $0 value if I stop on a certain level. So if I have a table that goes up to 3.7lbs. it shouldn't display $0 shipping if the cart hast 4 pounds in it. Am I doing something wrong?

IDEASLady
IDEAS Creative Studio

Your image... our business!

19 Jul 2020, 12:28 PM
#8
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Hide table rate shipping under a certain weight

ideasgirl:

I'm trying this on 1.5.6 (under the lines that are available for customization - 215) and it doesn't work. Is the code the same for that version?

I think the table module should not give a $0 value if I stop on a certain level. So if I have a table that goes up to 3.7lbs. it shouldn't display $0 shipping if the cart hast 4 pounds in it. Am I doing something wrong?
What code has been attempted to be added below the lines in the previous post? When say doesn't work, what is happening?
Also what you're saying is that basically the table shipping method should never provide a free shipping option to select?
There hasn't been much changed of the default shipping methods other than filling in gaps to prevent php notices and issues detected by newer php versions.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

20 Jul 2020, 12:36 AM
#9
IDEASLady avatar

IDEASLady

Totally Zenned

Join Date:
Aug 2005
Location:
Trujillo Alto, Puerto Rico
Posts:
1,449
Plugin Contributions:
3

Re: Hide table rate shipping under a certain weight

What code has been attempted to be added below the lines in the previous post?
The code that Linda provided.

When say doesn't work, what is happening?
There's no change. No errors, but module continues behaving the same way.

Also what you're saying is that basically the table shipping method should never provide a free shipping option to select?
Correct. If the last weight you have in your table (if you are doing it by weight), is 3.7:15, then if you have an order of 4.1#, the table quote is $0, which should be null, or not appear at all because is not available. The system is saying that if is 4.1# is free, which is not true.

IDEASLady
IDEAS Creative Studio

Your image... our business!

20 Jul 2020, 5:56 AM
#10
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,727
Plugin Contributions:
56

Re: Hide table rate shipping under a certain weight

ideasgirl:

I'm trying this on 1.5.6 (under the lines that are available for customization - 215) and it doesn't work. Is the code the same for that version?

I think the table module should not give a $0 value if I stop on a certain level. So if I have a table that goes up to 3.7lbs. it shouldn't display $0 shipping if the cart hast 4 pounds in it. Am I doing something wrong?

This is how these modules work. If your configuration is (say)

3.7:10

Then it will charge $10 for up to 3.7 pounds, and then 0 after that.

If you want it to not be valid after that, you have to add logic, like what Ajeh suggested.

// final check for display of Table Options
if (IS_ADMIN_FLAG == false && $_SESSION['cart']->show_weight() > 3.7) {
$this->enabled = false;
} else {
$this->enabled = true;
}

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

20 Jul 2020, 3:45 PM
#11
IDEASLady avatar

IDEASLady

Totally Zenned

Join Date:
Aug 2005
Location:
Trujillo Alto, Puerto Rico
Posts:
1,449
Plugin Contributions:
3

Re: Hide table rate shipping under a certain weight

swguy:

This is how these modules work. If your configuration is (say)

3.7:10

Then it will charge $10 for up to 3.7 pounds, and then 0 after that.

I didn't say it wasn't working as it's supposed to, I said that it shouldn't. Not because I can't ship on that table more that certain weight, should mean that over that limit will be free shipping, because that should be controlled by the free shipping options module. That's why you see other people coming to this code to edit the functionality.

If you want it to not be valid after that, you have to add logic, like what Ajeh suggested.

// final check for display of Table Options
if (IS_ADMIN_FLAG == false && $_SESSION['cart']->show_weight() > 3.7) {
$this->enabled = false;
} else {
$this->enabled = true;
}

Yes, and I tried it again with your code after the mentioned line and nothing. (check screenshots)

IDEASLady
IDEAS Creative Studio

Your image... our business!