Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  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
    69,402
    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.5]
    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!

  3. #3
    Join Date
    Sep 2011
    Posts
    226
    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
    69,402
    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.5]
    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!

  5. #5
    Join Date
    Sep 2011
    Posts
    226
    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
    69,402
    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.5]
    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. #7
    Join Date
    Feb 2007
    Posts
    513
    Plugin Contributions
    2

    Default 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
    PHP Code:
    // 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

  8. #8
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

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

    Try adding:
    Code:
    // 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: v1.5.5]
    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!

  9. #9
    Join Date
    Feb 2007
    Posts
    513
    Plugin Contributions
    2

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

  10. #10
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

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

    You are most welcome and thanks for the support!
    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.5]
    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!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. 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
  2. Is this possible? Disabling downloads on orders over a certain total amount only...
    By DigitalScrapDesigns in forum Managing Customers and Orders
    Replies: 3
    Last Post: 1 Dec 2008, 12:41 AM
  3. Need help with module configuration--enable certain payment module for certain items
    By maxus in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 10 Mar 2008, 04:24 PM
  4. How to offer free gifts if purchase exceeds a certain limit.
    By bhavi in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 1
    Last Post: 28 Nov 2007, 05:19 AM
  5. Giving Discounts after total order is over a certain amount
    By medcop2000 in forum Setting Up Specials and SaleMaker
    Replies: 9
    Last Post: 5 Jun 2006, 04:02 AM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR