If this is your first visit, check our documentation. To post, register or login.
Forums / Addon Payment Modules / Do not show Nochex option if cart total over 250

Do not show Nochex option if cart total over 250

Started by congerman on 16 Aug 2011, 10:46 AM · Views: 4,301

Results 21 to 40 of 48
9 Jan 2012, 10:19 PM
#21
inception avatar

inception

New Zenner

Join Date:
Jun 2011
Posts:
63
Plugin Contributions:
0

Do not show Nochex option if cart total over 250

yes, if i install only moneyorder payment module, for the orders less than $100, i get
Sorry, we are not accepting payments from your region at this time.
Please contact us for alternate arrangements.

if i install another payment module besides moneyorder, it will only display the other module when i checkout

that is not the problem

the problem is if the orders over than $100, after you place an order, you will find the payment module code of this order is not "moneyorder" but "GV/DC"

10 Jan 2012, 12:16 AM
#22
ajeh avatar

ajeh

Oba-san

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

Re: Do not show Nochex option if cart total over 250

Aha! a clue ... :cool:

This should be lots of fun to figure out ... :lamo:

I am on it ... :flex:

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!

10 Jan 2012, 12:23 AM
#23
ajeh avatar

ajeh

Oba-san

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

Re: Do not show Nochex option if cart total over 250

Try this code instead:

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

Does that work better for you? :unsure:

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!

10 Jan 2012, 1:16 AM
#24
inception avatar

inception

New Zenner

Join Date:
Jun 2011
Posts:
63
Plugin Contributions:
0

Re: Do not show Nochex option if cart total over 250

Ajeh:

Try this code instead:

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

> 
> Does that work better for you? :unsure:

this code works, everything displays correctly, 
but it limits the sub total in cart, is there any way to limit the order total (sub total in cart + shipping + tax) ?
10 Jan 2012, 3:20 AM
#25
ajeh avatar

ajeh

Oba-san

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

Re: Do not show Nochex option if cart total over 250

Edit the file:
/includes/classes/order_total.php

and add the code in RED:

      $calculatedOrderTotal = $order->info['total'];

// bof: get total for payment modules
      $_SESSION['my_total'] = $order->info['total'];
// eof: get total for payment modules

      $order->info = $orderInfoSaved;

Edit the file:
/includes/modules/payment/moneyorder.php

and add the code in RED:

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

// bof: disable on orders less than 100
  if ($_SESSION['my_total'] < 100.00) {
    $this->enabled = false;
  }
// eof: disable on orders less than 100

      if ((int)MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID > 0) {

Does this work the way you need it? :unsure:

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!

10 Jan 2012, 4:53 AM
#26
ajeh avatar

ajeh

Oba-san

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

Re: Do not show Nochex option if cart total over 250

Oops ... once change ... forgot the IS_ADMIN_FLAG ...

// bof: disable on orders less than 100
if (!IS_ADMIN_FLAG) {
  if ($_SESSION['my_total'] < 100.00) {
    $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!

10 Jan 2012, 4:04 PM
#27
inception avatar

inception

New Zenner

Join Date:
Jun 2011
Posts:
63
Plugin Contributions:
0

Re: Do not show Nochex option if cart total over 250

this works ! amazing
thanks a lot :hug:

10 Jan 2012, 4:18 PM
#28
ajeh avatar

ajeh

Oba-san

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

Re: Do not show Nochex option if cart total over 250

Was not the prettiest ... but gets the job done ... :cool:

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, 11:14 AM
#29
sethf avatar

sethf

Zen Follower

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

Re: Do not show Nochex option if cart total over 250

Hi

I tried to integrate this with PayPal express checkout. I only want PayPal to show as a payment method for orders of 3000 or over.

I tried following the above steps by Ajeh (using PayPal's module and not the money order module) but it did not work.

Is there something I'm missing?

Thanks
S

24 Jan 2012, 10:38 AM
#30
nochexman avatar

nochexman

New Zenner

Join Date:
Dec 2011
Posts:
3
Plugin Contributions:
0

Re: Do not show Nochex option if cart total over 250

*> Congerman:

I sell items priced from £20 to £900. I am new to Nochex and they have imposed a £250 transaction limit to start with.*

Hi Congerman.

Have you tried asking Nochex for an increase to your transaction limit?

Get in touch with your account manager and see whether we are able to help you.

Kind regards,

  • Peter (I work for Nochex)
15 Oct 2015, 3:20 PM
#31
congerman avatar

congerman

Zen Follower

Join Date:
Oct 2008
Posts:
392
Plugin Contributions:
0

Re: Do not show Nochex option if cart total over 250

Hi, Thought I ought to post here in my thread as now have a similar problem but in reverse.

I now need to only show Paypal as a payment method if the order total inc vat and delivery charges is above £2000

Any clues to the code changes

Thanks in advance

15 Oct 2015, 5:40 PM
#32
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Do not show Nochex option if cart total over 250

Not sure which paypal method to which you refer, but fortunately it doesn't matter... In includes/payment/YOUR_PAYPAL_METHOD.php is a function status_update() that is called when order information has become available. In here you would identify the values that need to be "added" together to identify your minimum "limit" and if that amount is less than your goal, set $this->enabled = false; and provide a notification possibly as to why it is disabled (ie follow programming method(s) already in the file regarding zcLog if that variable is in your version of ZC) but... Still want to be sure that it will be possible for a customer that is to be allowed to make a purchase has an available payment method..

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

15 Oct 2015, 5:50 PM
#33
congerman avatar

congerman

Zen Follower

Join Date:
Oct 2008
Posts:
392
Plugin Contributions:
0

Re: Do not show Nochex option if cart total over 250

mc12345678:

Not sure which paypal method to which you refer, but fortunately it doesn't matter... In includes/payment/YOUR_PAYPAL_METHOD.php is a function status_update() that is called when order information has become available. In here you would identify the values that need to be "added" together to identify your minimum "limit" and if that amount is less than your goal, set $this->enabled = false; and provide a notification possibly as to why it is disabled (ie follow programming method(s) already in the file regarding zcLog if that variable is in your version of ZC) but... Still want to be sure that it will be possible for a customer that is to be allowed to make a purchase has an available payment method..

Hi would it possible for you to spell this out for me with the appropriate code blocks and files as Ajay did for my other restriction in posts 25 and 26. It is website payments standard

Thanks

15 Oct 2015, 6:10 PM
#34
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Do not show Nochex option if cart total over 250

Sure. Will just "steal" Ajeh's code as I expect/suspect that the session data is still valid since it doesn't look like there was any session removal code provided for that new value:

Includes/modules/payments/paypal.php

look for: function update_status()

And towards the bottom of that section of code

Before:

if ($check_flag == false) {
 $this->enabled = false;
}

Insert:

// bof: disable on orders less than 2000
if (!IS_ADMIN_FLAG) {
  if ($_SESSION['my_total'] < 2000.00) {
    $this->enabled = false;
  }
}
// eof: disable on orders less than 2000

To look like this in that area:

// bof: disable on orders less than 2000
if (!IS_ADMIN_FLAG) {
  if ($_SESSION['my_total'] < 2000.00) {
    $this->enabled = false;
  }
}
// eof: disable on orders less than 2000

if ($check_flag == false) {
 $this->enabled = false;
}

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

15 Oct 2015, 6:18 PM
#35
congerman avatar

congerman

Zen Follower

Join Date:
Oct 2008
Posts:
392
Plugin Contributions:
0

Re: Do not show Nochex option if cart total over 250

mc12345678:

Sure. Will just "steal" Ajeh's code as I expect/suspect that the session data is still valid since it doesn't look like there was any session removal code provided for that new value:

Includes/modules/payments/paypal.php

look for: function update_status()

And towards the bottom of that section of code

Before:

if ($check_flag == false) {
$this->enabled = false;
}

> 
> Insert:
> ```
// bof: disable on orders less than 2000
if (!IS_ADMIN_FLAG) {
  if ($_SESSION['my_total'] < 2000.00) {
    $this->enabled = false;
  }
}
// eof: disable on orders less than 2000

To look like this in that area:

// bof: disable on orders less than 2000
if (!IS_ADMIN_FLAG) {
if ($_SESSION['my_total'] < 2000.00) {
$this->enabled = false;
}
}
// eof: disable on orders less than 2000

if ($check_flag == false) {
$this->enabled = false;
}


Many thanks, I will try that in the morning as I have family coming over shortly.

Will post the results

Thanks a lot
15 Oct 2015, 6:26 PM
#36
congerman avatar

congerman

Zen Follower

Join Date:
Oct 2008
Posts:
392
Plugin Contributions:
0

Re: Do not show Nochex option if cart total over 250

I guess I still have to make the changes that Ajay said in /includes/classes/order_total.php as this is a different site?

15 Oct 2015, 6:29 PM
#37
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Do not show Nochex option if cart total over 250

Congerman:

I guess I still have to make the changes that Ajay said in /includes/classes/order_total.php as this is a different site?

Just the first change in this post: https://www.zen-cart.com/showthread.php?184639-Do-not-show-Nochex-option-if-cart-total-over-%A3250&p=1093278#post1093278

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

15 Oct 2015, 8:03 PM
#38
congerman avatar

congerman

Zen Follower

Join Date:
Oct 2008
Posts:
392
Plugin Contributions:
0

Re: Do not show Nochex option if cart total over 250

I have made those changes but paypal still appears as an option on low value orders

15 Oct 2015, 8:36 PM
#39
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Do not show Nochex option if cart total over 250

Congerman:

I have made those changes but paypal still appears as an option on low value orders

Refreshed browser (cleared cache) tried a different browser, logged out, and then back in? And this IS paypal standard not paypal express nor paypal professional? And when saying that paypal still appears this is on the payment processing screen correct?

Try placing it before the if as in between these two lines of the same function update_status() {

global $order, $db;

// bof: disable on orders less than 2000
if (!IS_ADMIN_FLAG) {
  if ($_SESSION['my_total'] < 2000.00) {
    $this->enabled = false;
  }
}
// eof: disable on orders less than 2000

if ($this->enabled && (int)MODULE_PAYMENT_PAYPAL_ZONE > 0 && isset($order->billing['country']['id'])) {

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

15 Oct 2015, 8:48 PM
#40
congerman avatar

congerman

Zen Follower

Join Date:
Oct 2008
Posts:
392
Plugin Contributions:
0

Re: Do not show Nochex option if cart total over 250

mc12345678:

Refreshed browser (cleared cache) tried a different browser, logged out, and then back in? And this IS paypal standard not paypal express nor paypal professional? And when saying that paypal still appears this is on the payment processing screen correct?

Try placing it before the if as in between these two lines of the same function update_status() {

global $order, $db;

// bof: disable on orders less than 2000
if (!IS_ADMIN_FLAG) {
if ($_SESSION['my_total'] < 2000.00) {
$this->enabled = false;
}
}
// eof: disable on orders less than 2000

if ($this->enabled && (int)MODULE_PAYMENT_PAYPAL_ZONE > 0 && isset($order->billing['country']['id'])) {


Looked there and I do not have under global $order, $db;

if ($this->enabled && (int)MODULE_PAYMENT_PAYPAL_ZONE > 0 && isset($order->billing['country']['id'])) {

 I have

if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_ZONE > 0) ) {