Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2010
    Location
    Royston, UK
    Posts
    14
    Plugin Contributions
    0

    Default How to disable certain payment methods? (when Max Order Value exceeded)

    My customer wants to offer Puchase Order as the only payment method when total order value exceeds £5000. I have used the Maximum Order module, which displays an error message “Your order value exceeds £5000…” and disables checkout.

    How can I now in this instance
    1.) disable the other payment options (e.g. sagepay debit/credit card) and leave Purchase Order as the only available payment method when max order amount has been exceeded?

    2.) enable the shopping cart in a more clever way other than commenting out the following line:
    ./includes/classes/observers/class.maximum_order_amount.php
    /* zen_redirect(zen_href_link(FILENAME_SHOPPING_CART)); */

    Thank you – help much appreciated!
    Annika
    ps. Am originally a C/Java programmer so php is understandable to me but am not very inventive with it yet!

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

    Default Re: How to disable certain payment methods? (when Max Order Value exceeded)

    If you wanted to disable Check/Money Order moneyorder payment module, you could change it with:
    Code:
          $this->enabled = ((MODULE_PAYMENT_MONEYORDER_STATUS == 'True') ? true : false);
    
    global $cart;
    if (!IS_ADMIN_FLAG && $_SESSION['cart']->show_total() >= 5000) {
      $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!

  3. #3
    Join Date
    Mar 2010
    Location
    Royston, UK
    Posts
    14
    Plugin Contributions
    0

    Default Re: How to disable certain payment methods? (when Max Order Value exceeded)

    Fantastic, thanks Linda!! I will play try this later :-)

    cheers,
    annika

  4. #4
    Join Date
    Mar 2010
    Location
    Royston, UK
    Posts
    14
    Plugin Contributions
    0

    Default Re: How to disable certain payment methods? (when Max Order Value exceeded)

    A slightly delayed thank you Linda - it worked for anyone else interested, I edited a sagepay file (of module for the credit card payment gateway) as follows:

    ./includes/modules/payment/sagepay_form.php

    // $this->enabled = ((MODULE_PAYMENT_SAGEPAY_FORM_STATUS == 'True') ? true : false);
    // REPLACE ABOVE LINE WITH THE FOLLOWING:
    // ***********************************************
    // ANNIKA disabling the card payment option when purchace order value exceeds £5000

    if (!IS_ADMIN_FLAG && $_SESSION['cart']->show_total() >= 5000)
    {
    $this->enabled = false;
    } else {
    $this->enabled = ((MODULE_PAYMENT_SAGEPAY_FORM_STATUS == 'True') ? true : false);
    }
    // ***********************************************

    This forum (and Linda) is absolutely brilliant.

    cheerio
    annika

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

    Default Re: How to disable certain payment methods? (when Max Order Value exceeded)

    Thanks for the update and glad that this did work for you to control when your Payment modules shows or does not show based on the order total ...
    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!

  6. #6
    Join Date
    Mar 2010
    Location
    Royston, UK
    Posts
    14
    Plugin Contributions
    0

    Default Re: How to disable certain payment methods? (when Max Order Value exceeded)

    Hello again Linda et.al. - a similar problem as above!

    Have all the functions that I can extract values from $_SESSION['cart'] been documented somewhere?!

    My customer would like to disable credit card payment method (sagepay) when no valid shipping zones available for the shipping address/destination, allowing only Purchase Order.

    So similar as above, but now I would need to see *in pseudo code*:

    if ($_SESSION['cart']->check_if_valid_shippingzones_function_of_some_kind() == false)) {
    // i.e. no valid shipping zones for this destination
    // disable credit card payment method
    $this->enabled = false;
    } else {
    $this->enabled = ((MODULE_PAYMENT_SAGEPAY_FORM_STATUS == 'True') ? true : false);
    }

    Thanks!
    annika

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

    Default Re: How to disable certain payment methods? (when Max Order Value exceeded)

    If there isn't a valid shipping method selected then you will never get to the checkout_payment ...

    Can you clarify what happens when you do not have a valid shipping address and how you are getting to the checkout_payment?
    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!

  8. #8
    Join Date
    Mar 2010
    Location
    Royston, UK
    Posts
    14
    Plugin Contributions
    0

    Default Re: How to disable certain payment methods? (when Max Order Value exceeded)

    Yes sorry, I also have always available the 'walk-in' i.e. 'storepickup' option (for all destinations & countries), and I have renamed it 'Arrange shipping after order', so that even when there are no valid shipping destinations, customer can go forward with this 'storepickup' and that's when only purchase order should be available for payment, no credit cards.

    How about something along the lines of (this doesn't work though, not sure why?!):

    includes/modules/payment/sagepay_form.php

    // ANNIKA disabling the card payment option when chosen shipping method is "Arrange shipping after order"

    if ($rates[$i]['module'] == 'storepickup')
    { $this->enabled = false;
    } else {
    $this->enabled = ((MODULE_PAYMENT_SAGEPAY_FORM_STATUS == 'True') ? true : false);
    }

    // ANNIKA END

    Thanks!
    annika

 

 

Similar Threads

  1. v138a Hide shipping method when order exceeds certain value of order
    By staudrak in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 17 Jun 2012, 05:22 PM
  2. Replies: 1
    Last Post: 18 Nov 2010, 11:53 PM
  3. Disable PayPal-payment when customer reachers a certain subtotal
    By andersw in forum PayPal Express Checkout support
    Replies: 2
    Last Post: 13 Mar 2009, 06:00 PM
  4. Replies: 2
    Last Post: 7 Aug 2008, 05:05 AM
  5. How to disable certain payment methods for certain products?
    By AccurateOptics in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 29 Mar 2007, 06:53 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR