Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Payment module allowed depending on weight?

Payment module allowed depending on weight?

Locked

Views: 1,399

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
31 Aug 2006, 1:00 AM
#1
colibri avatar

colibri

New Zenner

Join Date:
Aug 2006
Posts:
3
Plugin Contributions:
0

Payment module allowed depending on weight?

We have shipping rates set up based on product weight (and 5 different shipping Zones).

Our customers have 2 payment module choices (money order and cod), and because of the extra fees we get charged for using cod we'd like to only allow it for shipments over a certain weight.

THis might not make complete sense, but there are more boring details about Norwegian Postal Services I don't really want to go into right now...

The gist of what we want is:

Over 500 grams total weight = choice of 2 payment methods
Under 500 grams total weight = only one payment method allowed (money order).

Is this possible?

31 Aug 2006, 6:00 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Payment module allowed depending on weight?

Two ways to tackle this:

  1. rewrite the code to set a handling fee for COD orders, which helps you recover the costs of COD shipping.
  2. rewrite the code to detect the weight of items in the cart and enable/disable COD based on the value

To use #2 above, edit the modules/payment/cod.php file:
around line 61 you see:if ($check_flag == false) { $this->enabled = false; } }add a few lines of code below it, starting on line 65:```
if ($_SESSION['cart']->weight < 500) {
$this->enabled = false;
}

This says ... if the weight of the items in the cart is under 500, then disable this module (in this case, COD).
Change the "500" to whatever suits your needs.
5 Nov 2006, 2:06 PM
#3
carol avatar

carol

New Zenner

Join Date:
Nov 2005
Posts:
44
Plugin Contributions:
0

Re: Payment module allowed depending on weight?

I added this code to my 1.3.0.2 shop and it worked perfectly. However I´m now upgrading to 1.3.6 and the code doesn´t seem to result in enable/disable COD like it does in 1.3.0.2.

Any ideas if the code should be adapted to zen 1.3.6? Thanks.