Site maintenance: Tuesday 17 Nov, from 10:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Forums / Addon Payment Modules / Activate Payment Module if $$$ Total exceeds a certain amount

Activate Payment Module if $$$ Total exceeds a certain amount

Started by smoothrider on 22 Jan 2012, 6:59 AM · Views: 1,912

Results 1 to 12 of 12
22 Jan 2012, 6:59 AM
#1
smoothrider avatar

smoothrider

New Zenner

Join Date:
Jan 2012
Posts:
6
Plugin Contributions:
0

Activate Payment Module if $$$ Total exceeds a certain amount

I am having trouble writing the correct PHP code to activate a payment module.

What I want is for the payment module to activate only if the order total exceeds a certain amount (lets say $100).

I thought it would be simple like this:

  if ($this->enabled == true) {
   	 if ($order_totals) < 100) {
      $this->enabled = false;
  }
  }

However it's not working. I think the $order_totals is not the correct input and I do not know PHP well. Does anyone know what the correct input might be?

Thank you for your help.

22 Jan 2012, 2:36 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Activate Payment Module if $$$ Total exceeds a certain amount

Let's say you were doing this with Check/Money Order moneyorder you could try the code in RED:

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

// bof: disable on orders less than 100
if (!IS_ADMIN_FLAG) {
  global $order;
  if ($order->info['total'] < 100) {
    $this->enabled = false;
  }
}
// eof: disable on orders less than 100

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!

22 Jan 2012, 3:03 PM
#3
sethf avatar

sethf

Zen Follower

Join Date:
Sep 2011
Posts:
228
Plugin Contributions:
0

Re: Activate Payment Module if $$$ Total exceeds a certain amount

Ajeh:

Let's say you were doing this with Check/Money Order moneyorder you could try the code in RED:

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

// bof: disable on orders less than 100
if (!IS_ADMIN_FLAG) {
global $order;
if ($order->info['total'] < 100) {
$this->enabled = false;
}
}
// eof: disable on orders less than 100


Ajeh, where would you apply this code for PayPal express checkout?

Thanks
22 Jan 2012, 3:12 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Activate Payment Module if $$$ Total exceeds a certain amount

Customize the file:
/includes/modules/payment/paypalwpp.php

and add the new code below:

    $this->enabled = (MODULE_PAYMENT_PAYPALWPP_STATUS == '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!

22 Jan 2012, 9:15 PM
#5
sethf avatar

sethf

Zen Follower

Join Date:
Sep 2011
Posts:
228
Plugin Contributions:
0

Re: Activate Payment Module if $$$ Total exceeds a certain amount

Ajeh:

Customize the file:
/includes/modules/payment/paypalwpp.php

and add the new code below:

$this->enabled = (MODULE_PAYMENT_PAYPALWPP_STATUS == 'True');

Thanks for the information.

I tried this, placing the code where you said I should, and it worked, but when you click 'Confirm order' the PayPal page does not load. When I remove this code the PayPal payment page loads.

*By the page 'not loading' I mean it just displays a blank white page.

Anything I'm missing?

Thanks
S
22 Jan 2012, 9:45 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Activate Payment Module if $$$ Total exceeds a certain amount

Put the code back in ... when you get the white page, go to your /cache directory and refresh ... and see what the debug logs say ...

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 Feb 2012, 8:32 AM
#7
vandiermen avatar

vandiermen

Totally Zenned

Join Date:
Feb 2007
Posts:
518
Plugin Contributions:
1

Re: Activate Payment Module if $$$ Total exceeds a certain amount

If I wanted to disable for one category ID only ?
I am not sure what the syntax is for the checkout_payment

this works for the checkout_shipping

// disable for one master_categories_id 
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','2') > 0)) { 
$this->enabled = false; 
} 

I tried adding variations under
$this->enabled = ((MODULE_PAYMENT_PAYPAL_STATUS == 'True') ? true : false);
but did not get it

6 Feb 2012, 2:00 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Activate Payment Module if $$$ Total exceeds a certain amount

Try adding:

// disable for one master_categories_id 
global $cart;
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','2') > 0)) { 
$this->enabled = false; 
}  

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 Feb 2012, 2:31 AM
#9
vandiermen avatar

vandiermen

Totally Zenned

Join Date:
Feb 2007
Posts:
518
Plugin Contributions:
1

Re: Activate Payment Module if $$$ Total exceeds a certain amount

Yes it worked. I made a donation. Thanks so much to Ajeh and zencart support. :smile:

7 Feb 2012, 2:31 AM
#10
ajeh avatar

ajeh

Oba-san

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

Re: Activate Payment Module if $$$ Total exceeds a certain amount

You are most welcome and thanks for the support! :smile:

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!

17 Apr 2012, 2:43 PM
#11
countrycharm avatar

countrycharm

Totally Zenned

Join Date:
Jul 2007
Posts:
2,179
Plugin Contributions:
2

Re: Activate Payment Module if $$$ Total exceeds a certain amount

Ajeh:

Let's say you were doing this with Check/Money Order moneyorder you could try the code in RED:

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

// bof: disable on orders less than 100
if (!IS_ADMIN_FLAG) {
global $order;
if ($order->info['total'] < 100) {
$this->enabled = false;
}
}
// eof: disable on orders less than 100


Hi Linda I have a question for you. If I didn't want a customer to checkout without entering reward points first how would create code in the Check/Money Order module to flag them to let them know. Thank You so much in advance.

Is your site Upgraded to the current version 1.5.4 Yet?
zencart-upgrades-website-installation

17 Apr 2012, 2:55 PM
#12
ajeh avatar

ajeh

Oba-san

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

Re: Activate Payment Module if $$$ Total exceeds a certain amount

I do not use the reward points so I am not sure what would be best for you ...

Perhaps ask on the support threads for the Reward Point add on that you are using ...

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!