Jump to content
Philip79

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

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.

Share this post


Link to post
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

Share this post


Link to post
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".

 

 


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
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

This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×