Results 1 to 10 of 12

Hybrid View

  1. #1
    Join Date
    Jan 2012
    Posts
    6
    Plugin Contributions
    0

    Default 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.

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,726
    Plugin Contributions
    6

    Default 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:
    Code:
          $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: v1.5.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  3. #3
    Join Date
    Sep 2011
    Posts
    224
    Plugin Contributions
    0

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

    Quote Originally Posted by Ajeh View Post
    Let's say you were doing this with Check/Money Order moneyorder you could try the code in RED:
    Code:
          $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

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,726
    Plugin Contributions
    6

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

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

    and add the new code below:
    Code:
        $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: v1.5.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  5. #5
    Join Date
    Sep 2011
    Posts
    224
    Plugin Contributions
    0

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

    Quote Originally Posted by Ajeh View Post
    Customize the file:
    /includes/modules/payment/paypalwpp.php

    and add the new code below:
    Code:
        $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

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,726
    Plugin Contributions
    6

    Default 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: v1.5.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  7. #7
    Join Date
    Jul 2007
    Posts
    1,881
    Plugin Contributions
    12

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

    Quote Originally Posted by Ajeh View Post
    Let's say you were doing this with Check/Money Order moneyorder you could try the code in RED:
    Code:
          $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.

  8. #8
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,726
    Plugin Contributions
    6

    Default 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: v1.5.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

 

 

Similar Threads

  1. Replies: 46
    Last Post: 21 Apr 2013, 05:30 PM
  2. Minimum purchase to activate the cod payment module.
    By Deakoi in forum Built-in Shipping and Payment Modules
    Replies: 15
    Last Post: 31 Mar 2012, 07:46 PM
  3. Replies: 0
    Last Post: 8 Mar 2011, 02:35 AM
  4. disable payment module over a specific amount
    By timdwyer42 in forum General Questions
    Replies: 0
    Last Post: 28 Jan 2010, 12:10 PM
  5. Tax amount excluded from total amount transferred to Paypal
    By Rykmann in forum Built-in Shipping and Payment Modules
    Replies: 15
    Last Post: 1 Dec 2007, 11:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •