Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Disallow Check /Money Order Payment Mehtod for non-US customers


Philip79

Recommended Posts

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.

Link to comment
Share on other sites

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 by De Dokta
Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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 by burt
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 4 years later...

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

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...