Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / COD Fee disabled if total is more than x?

COD Fee disabled if total is more than x?

Locked

Views: 1,077

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
13 Jan 2009, 7:09 PM
#1
flasmar avatar

flasmar

New Zenner

Join Date:
Dec 2008
Posts:
26
Plugin Contributions:
0

COD Fee disabled if total is more than x?

Hi, I would like to add the feature that COD payment method do not appear on "checkout_payment.php" page when total order is more than x money, but I do not find where to put the code.
I checked payment.php, and cod.php, but I do not find the right place. The COD checking option is printed before it is calculated, so I am not sure where to put my code.

I have transfer, credit card and COD activated, but I do not want COD appears if purchase value is more tnan 300.

13 Jan 2009, 11:28 PM
#2
flasmar avatar

flasmar

New Zenner

Join Date:
Dec 2008
Posts:
26
Plugin Contributions:
0

Re: COD Fee disabled if total is more than x?

Hi, I already found the way, from a different path.
And it works.

15 Jan 2009, 10:55 PM
#3
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,798
Plugin Contributions:
22

Re: COD Fee disabled if total is more than x?

well thank you very much for sharing how you did it...

maybe someone else needs that information so it would be nice if you'd say how you did it...

18 Jan 2009, 6:34 PM
#4
pedro_martins avatar

pedro_martins

New Zenner

Join Date:
Oct 2007
Location:
Portugal
Posts:
10
Plugin Contributions:
0

Re: COD Fee disabled if total is more than x?

I'm running 1.3.8a version.

This topic is for "more than x", and I'm looking for "less than x".
I'm not expert in PHP programing, but I can do a couple of things.
After looking at the code, I ended at the same step I started.
How can I set the COD module to appear only if the order total is under value X?

18 Jan 2009, 7:07 PM
#5
ajeh avatar

ajeh

Oba-san

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

Re: COD Fee disabled if total is more than x?

Edit the COD module and find the line:

      $this->enabled = ((MODULE_PAYMENT_COD_STATUS == 'True') ? true : false);

Change that to read:

      $this->enabled = ((MODULE_PAYMENT_COD_STATUS == 'True') ? true : false);

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

where 25 is the amount you want to use for < 25 ...

18 Jan 2009, 10:04 PM
#6
pedro_martins avatar

pedro_martins

New Zenner

Join Date:
Oct 2007
Location:
Portugal
Posts:
10
Plugin Contributions:
0

Re: COD Fee disabled if total is more than x?

Hi Ajeh,

Many thanks! It solved my problem.
In this specific case, the code logis is inverse;
If Order Value is > 25, COD enabled=false, so code line must be

if (IS_ADMIN_FLAG === true || $_SESSION['cart']->show_weight() > 25) {
        $this->enabled = false;

Now I'm understanding how 'classes' and 'objects' work.
I must read more about OOP :cool:

Regards

18 Jan 2009, 10:14 PM
#7
pedro_martins avatar

pedro_martins

New Zenner

Join Date:
Oct 2007
Location:
Portugal
Posts:
10
Plugin Contributions:
0

Re: COD Fee disabled if total is more than x?

Sorry... This is the right way (admin settings don't let me edit the post):
Hi Ajeh,

..., the code logic is inverse and it must be under TOTAL and not WEIGHT, but you gave me the way to do it:
If Order Value is > 25, COD enabled=false, so code line must be

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

...