Philip79 Posted January 23, 2014 Share Posted January 23, 2014 I want to not allow customers to pay with a check or money order if they are outside of the USA. Most of my customers know not to choose that payment option but since I just had a customer in Europe choose that payment mthod and in spite of email messages indicating not to send their payment in Euros they did just that. So I found in another thread for the credit card module the following lines of code: if($_SESSION['customer_country_id']==223) { $this->enabled = true; } else { $this->enabled = false; } so that it would be inserted into the \includes\modules\payment/moneyorder.php program after the initial lines of code: class moneyorder { var $code, $title, $description, $enabled; // class constructor function moneyorder() { global $order; $this->code = 'moneyorder'; $this->title = MODULE_PAYMENT_MONEYORDER_TEXT_TITLE; $this->description = MODULE_PAYMENT_MONEYORDER_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_MONEYORDER_SORT_ORDER; $this->enabled = ((MODULE_PAYMENT_MONEYORDER_STATUS == 'True') ? true : false); So would this be appropriate so that only customers in the USA would have this payment method display after it was selected otherwise the money order screen does not diaplay and they would be returned to the payment method sleection screen? Thanks. Quote Link to comment Share on other sites More sharing options...
De Dokta Posted January 24, 2014 Share Posted January 24, 2014 (edited) Hi, Simply paste the code snippet under "class methods". I don't know if your code works. If not, try: if ($order->delivery['country_id'] != "223") { $this->enabled = false; } This definitely works. ;) J.J. Edited January 24, 2014 by De Dokta Quote Link to comment Share on other sites More sharing options...
burt Posted January 24, 2014 Share Posted January 24, 2014 Use the inbuilt ZONES for this. I'm not sure why this is called "Tax Zones", must be changed in the next release. admin > locations/taxes > "tax zones" Set up a new Zone called Payments USA, insert the USA into it. Go to your payment module and set its "Payment Zone" to "Payments USA". Quote Link to comment Share on other sites More sharing options...
burt Posted January 24, 2014 Share Posted January 24, 2014 (edited) Hi, Simply paste the code snippet under "class methods". I don't know if your code works. If not, try: if ($order->delivery['country_id'] != "223") { $this->enabled = false; } This definitely works. ;) J.J. Unless the USA != 223 .... the number attached to any country is nothing more than a auto-incremented ID that is not the same across all shops. Use the country ISO codes ( which never change, eg countries_iso_code_2 ) for such comparisons. Edited January 24, 2014 by burt Quote Link to comment Share on other sites More sharing options...
Philip79 Posted January 24, 2014 Author Share Posted January 24, 2014 Thanks for the replies. I did insert a new payment/tax zone as you suggested and I had fogotten about the Details to associate the country with the new zone. Works great and no customization. Thanks also for the information about the correct value for the country for future refernce. Quote Link to comment Share on other sites More sharing options...
♥14steve14 Posted September 17, 2018 Share Posted September 17, 2018 I know this is an old post, but I would like to thank gary for this post. It took some finding, but I was glad that it showed up. I wanted to disable all payments methods aparet from payPal for all non UK customers and this worked. Thanks @burt burt 1 Quote REMEMBER BACKUP, BACKUP AND BACKUP Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.