New Zenner
- Join Date:
- Aug 2006
- Posts:
- 4
- Plugin Contributions:
- 0
Disable shipping type based on weight
Hi, i have searched quite a bit an found many helpful threads on this matter but i'm still stuck :(
Basically i want to disable certain shipping types if the weight is more than the maximum allowed. Example: RM Second Classs is limited to 750g, RM Standard Parcels is limited to 20kgs, etc. I know i have to make a function and add it to my shipping php file, i have tried the ones i found but it didnt work.
Heres what i did:
Added a file cartweight.php to both extra_functions folder with the following code
function total_pounds() {
// for admin always true if installed
if (strstr($PHP_SELF, FILENAME_MODULES)) {
return true;
}
return false;
}
Added this code to my rmsecondclass.php
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_RMSECONDCLASS_STATUS == 'True') ? true : false);
}
[B]$total_pounds = $this->pounds;
if ($total_pounds > 0.750) { $this->enabled = false; }[/B]
When i add a product to my cart weighing 1.10 kgs it still shows up, so i have done something wrong, lol.
Please help, Nicola.