X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   When an international customer logs in, having Paypal only (https://forum.x-cart.com/showthread.php?t=13493)

Ryano 04-19-2005 10:15 AM

When an international customer logs in, having Paypal only
 
Hi all, I was wondering if there is a way to set up my xcart so that when an international customer logs in, that their only payment option is to use paypal, instead of a couple others I have listed such as Credit card, etc.

My CC processor does not allow payments from any international customers including from Canada so I would like to make only Paypal available to them.

Thanks!

balinor 04-19-2005 12:34 PM

Whoa, sounds like you need a new payment gateway :( To my knowledge, you can only specify payment methods via membership level, not zone. That doesn't mean it can't be done, it just means it can't be done out of the box.

Ryano 04-19-2005 12:38 PM

Yes, my payment processors are very strict, and unfortunately I am signed in for 2 more years! I'm guessing there is no easy way then to allow international customers to only to be able to pay through paypal?

balinor 04-19-2005 12:45 PM

Might want to check with one of the PHP gurus (Shan, Jon, Carrie, X-Cart) and see what they would charge to customize it for you.

dsparks 04-20-2005 02:19 PM

This mod is for v3.5.8 and v4.0.13 only. It should work for all versions in between, since the code if very similar, but I have only checked it on these.

I did not know if you needed to determine this based on the customer billing or shipping address.

I have included code for the shipping address. Just change s_country to b_country if needed.


Modify the file /skin1/customer/main/checkout.tpl:


Find the following code at line 68 in v3.5.8 and line 92 in v4.0.13:

Code:

{section name=payment loop=$payment_methods}
<tr>
<td width=1><input type=radio name=paymentid value={$payment_methods[payment].paymentid}{if $payment_methods[payment].is_default eq "1"} checked{/if}></td>
<td nowrap>{$payment_methods[payment].payment_method}</td>
<td>{$payment_methods[payment].payment_details}</td>
</tr>
{/section}



and change it to:

Code:

{if $userinfo ne "" and ($userinfo.s_country eq $config.Company.location_country)}
{assign var="destination" value="L"}
{else}
{assign var="destination" value="I"}
{/if}
{section name=payment loop=$payment_methods}
{if $destination eq "L" or ($destination eq "I" and $payment_methods[payment].payment_method eq "PayPal")}
<tr>
<td width=1><input type=radio name=paymentid value={$payment_methods[payment].paymentid}{if $payment_methods[payment].is_default eq "1"} checked{/if}></td>
<td nowrap>{$payment_methods[payment].payment_method}</td>
<td>{$payment_methods[payment].payment_details}</td>
</tr>
{/if}
{/section}



That's it.

This will only allow the "PayPal" payment type if the customer shipping country is not the local country based on the configuration of your current x-cart setup and allow all normal payment types if the customer's country is the local country.

This is based on the same sort of logic as the shipping selector for International or Domestic shipping.

Hope this helps....

Ryano 04-25-2005 11:06 PM

wow, I just noticed that you replied to this thread. Thanks a lot dsparks. I will definitely try install it and let you know how it works out. :)

Ryano 04-25-2005 11:33 PM

That was really easy! Thanks a lot dsparks!

If I want to add another payment option such as pay by Gift Certificates, how would I do that? Also, is there a way that I can put a note inside the box titled Payment method stating that international customers may only use Paypal as a form of payment?

Thanks again! :D

dsparks 04-26-2005 08:30 AM

To add more payment types, you can just keep adding "or" statements to the if, like this:

Code:

{if $destination eq "L" or ($destination eq "I" and $payment_methods[payment].payment_method eq "PayPal") or
($destination eq "I" and $payment_methods[payment].payment_method eq "Gift Certificate")}


Note: Make sure the code above is all on one line. It looks like the display is multi-lined but it all has to be on the same line.

Yes, you can add a note inside the "Payment method" box. This is what I did:

In the file skin1/customer/main/checkout.tpl change the code around line 65 from:

Code:

{capture name=dialog}
<form method=get action="cart.php" name=checkout_form>
<table border=0 align=center>


to this:

Code:

{capture name=dialog}

<table border=0 align=center width=100%>
<tr>

International customers may only use Paypal and Gift Certificates as a payment options.

</tr>

</table>

<form method=get action="cart.php" name=checkout_form>
<table border=0 align=center>



This text will be displayed right above the payment types.

Hope this helps...

Ryano 04-27-2005 07:39 AM

Works great! Thanks again for all your help. :)

Last question, lol is there a way to make it so that the part that says
"International customers may only use Paypal and Gift Certificates as a payment options." also only shows up when an international customer logs in?

dsparks 04-27-2005 08:07 AM

Yes you can, just change the code in the file /skin1/customer/main/checkout.tpl to the following:

Code:

{capture name=dialog}

{if $userinfo ne "" and ($userinfo.s_country ne $config.Company.location_country)}
<table border=0 align=center width=100%>
<tr>

International customers may only use Paypal and Gift Certificates as a payment options.

</tr>
 
</table>
{/if}

<form method=get action="cart.php" name=checkout_form>
<table border=0 align=center>


Note: The above is based on the shipping country.

Hope this helps...

Ryano 04-27-2005 09:38 AM

Works perfect! Thanks a bunch dsparks! :D

balinor 06-20-2005 06:02 AM

Moving this to the Custom Mods forum...good one! :)

Ryano 07-12-2005 09:52 AM

Anyone know how to get this to work for version 4.0.14? I noticed that they made a few changes in the checkout.tpl because of the addition to the new Paypal Payment gateway. Here is the coding for my checkout.tpl in v 4.0.14. Can someone edit this for me? Thanks!

Code:

{* $Id: checkout.tpl,v 1.44.2.14 2005/06/17 06:27:11 svowl Exp $ *}
{if $payment_data.payment_method ne ""}
<H5>{$lng.lbl_payment_method}: {$payment_data.payment_method}</H5>
{capture name=dialog}
<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
<FORM action="{$payment_data.payment_script_url}" method="post" name="checkout_form">
<INPUT type="hidden" name="paymentid" value="{$payment_data.paymentid}">
<INPUT type="hidden" name="action" value="place_order">
<TR><TD>
<PRE>
<FONT>
{include file="customer/main/customer_details.tpl"}
</FONT>
</PRE>
{if $paypal_express_active}

{include file="payments/ps_paypal_pro_express_checkout.tpl" paypal_express_link="return"}
{else}
{include file="buttons/modify.tpl" href="register.php?mode=update&action=cart&paymentid=`$smarty.get.paymentid`"}
{/if}



{if $ignore_payment_method_selection eq ""}
<DIV align="right">
{include file="buttons/button.tpl" button_title=$lng.lbl_change_payment_method href="cart.php?mode=checkout"}
</DIV>
{/if}
<INPUT type="hidden" name="{$XCARTSESSNAME}" value="{$XCARTSESSID}">
<SCRIPT>
requiredFields = new Array();
</SCRIPT>
{include file="check_required_fields_js.tpl"}
{if $payment_data.payment_template ne ""}
{include file=$payment_data.payment_template}
{/if}
{if $payment_cc_data.cmpi eq 'Y' && $config.CMPI.cmpi_enabled eq 'Y'}
{include file="main/cmpi.tpl"}
{/if}
{include file="customer/main/checkout_notes.tpl"}


<INPUT type="hidden" name="payment_method" value="{$payment_data.payment_method}">
{$lng.txt_you_are_agree} "{$lng.lbl_terms_n_conditions}" {$lng.lbl_and} "{$lng.lbl_privacy_statement}".
<P align="center">
{if $js_enabled}
{assign var="button_href" value="javascript: "}
{if $config.General.check_cc_number eq "Y" and ($payment_cc_data.type eq "C" || $payment_data.paymentid eq 1) and $payment_cc_data.disable_ccinfo ne "Y"}
{assign var="button_href" value=$button_href|cat:"if(checkCCNumber(document.checkout_form.card_number,document.checkout_form.card_type) && checkExpirationDate(document.checkout_form.card_expire_Month,document.checkout_form.card_expire_Year)"}
{if $payment_cc_data.disable_ccinfo ne "C"}
{assign var="button_href" value=$button_href|cat:" && checkCVV2(document.checkout_form.card_cvv2,document.checkout_form.card_type)"}
{/if}
{assign var="button_href" value=$button_href|cat:")"}
{/if}
{assign var="button_href" value=$button_href|cat:" if(checkRequired()) document.checkout_form.submit()"}
{include file="buttons/button.tpl" button_title=$lng.lbl_submit_order style="button" href=$button_href}
{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_submit_order}
{/if}
</TD></TR>
</FORM>
</TABLE>
{/capture}
{include file="dialog.tpl" title=$lng.lbl_payment_details content=$smarty.capture.dialog extra="width=100%"}

{elseif $payment_methods ne ""}
{capture name=checkout_dialog}
<FORM action="cart.php" method="POST" name="cartform">
<INPUT type="hidden" name="cart_operation" value="cart_operation">
{include file="customer/main/cart_contents.tpl"}
<HR noshade size="1">

{include file="customer/main/cart_totals.tpl"}



{if $js_enabled}
{include file="buttons/update.tpl" href="javascript: document.cartform.submit()" js_to_href="Y"}
{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_update}{/if}
</FORM>
{/capture}
{include file="dialog.tpl" title=$lng.lbl_order_summary content=$smarty.capture.checkout_dialog extra="width=100%"}


{capture name=dialog}
<FORM method="get" action="cart.php" name="checkout_form">


{$lng.txt_payment_method}</p>
<TABLE border="0" align="center" width="400">
{section name=payment loop=$payment_methods}
<TR>
<TD><INPUT type="radio" name="paymentid" value="{$payment_methods[payment].paymentid}"{if $payment_methods[payment].is_default eq "1"} checked{/if}></TD>
{if $payment_methods[payment].processor eq "ps_paypal_pro.php"}
<TD colspan="2">
<TABLE border="0" cellpadding="0" cellspacing="0"><TR>
<TD>{include file="payments/ps_paypal_pro_express_checkout.tpl" paypal_express_link="logo"}</TD>
<TD></TD>
<TD>{include file="payments/ps_paypal_pro_express_checkout.tpl" paypal_express_link="text"}</TD>
</TR></TABLE>
</TD>
{else}
<TD nowrap>{$payment_methods[payment].payment_method}</TD>
<TD>{$payment_methods[payment].payment_details|default:""}</TD>
{/if}
</TR>
{/section}
<INPUT type="hidden" name="mode" value="checkout">
</TABLE>


<DIV align="center">
{if $js_enabled}
{include file="buttons/continue.tpl" style="button" href="javascript: document.checkout_form.submit()"}
{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_continue}
{/if}
</DIV>
</FORM>
{/capture}
{include file="dialog.tpl" title=$lng.lbl_payment_method content=$smarty.capture.dialog extra="width=100%"}
{/if}


Ryano 07-19-2005 06:59 AM

Still looking for some help on getting this to work for 4.0.14. Anyone?

Tuner 08-17-2005 12:10 PM

OK For the Revised 4.0.14 mod really a no brainer.

Find skin1/customer/main/checkout.tpl Line:98
Replace this code:
Code:

{section name=payment loop=$payment_methods}
<TR>
<TD><INPUT type="radio" name="paymentid" value="{$payment_methods[payment].paymentid}"{if $payment_methods[payment].is_default eq "1"} checked{/if}></TD>
{if $payment_methods[payment].processor eq "ps_paypal_pro.php"}
<TD colspan="2">
<TABLE border="0" cellpadding="0" cellspacing="0"><TR>
<TD>{include file="payments/ps_paypal_pro_express_checkout.tpl" paypal_express_link="logo"}</TD>
<TD></TD>
<TD>{include file="payments/ps_paypal_pro_express_checkout.tpl" paypal_express_link="text"}</TD>
</TR></TABLE>
</TD>
{else}
<TD nowrap>{$payment_methods[payment].payment_method}</TD>
<TD>{$payment_methods[payment].payment_details|default:""}</TD>
{/if}
</TR>
{/section}


With This Code:
Code:

{if $userinfo ne "" and ($userinfo.s_country eq $config.Company.location_country)}
{assign var="destination" value="L"}
{else}
{assign var="destination" value="I"}
{/if}
{section name=payment loop=$payment_methods}
{if $destination eq "L" or ($destination eq "I" and $payment_methods[payment].payment_method eq "PayPal")}
<TR>
<TD><INPUT type="radio" name="paymentid" value="{$payment_methods[payment].paymentid}"{if $payment_methods[payment].is_default eq "1"} checked{/if}></TD>
{if $payment_methods[payment].processor eq "ps_paypal_pro.php"}
<TD colspan="2">
<TABLE border="0" cellpadding="0" cellspacing="0"><TR>
<TD>{include file="payments/ps_paypal_pro_express_checkout.tpl" paypal_express_link="logo"}</TD>
<TD></TD>
<TD>{include file="payments/ps_paypal_pro_express_checkout.tpl" paypal_express_link="text"}</TD>
</TR></TABLE>
</TD>
{else}
<TD nowrap>{$payment_methods[payment].payment_method}</TD>
<TD>{$payment_methods[payment].payment_details|default:""}</TD>
{/if}
</TR>
{/if}
{/section}


bsinger 03-16-2006 02:17 PM

To bring this issue back to life = I have just implemented it into my site and have been trying to figure out how to turn off PayPal for US customers and ON for International.

This has worked well to make international customers use PayPal only but I dont want/need US customers using PayPal ever.

What would need to be changed to remove PayPal from the L designation?

Thanks in advance

alru111 05-14-2006 11:59 PM

Same question here. Is there a way to leave all other payment options for international customers but exclude paypal from US customers.

subzero 05-31-2006 02:00 PM

great addy thanx :)

billstevens 09-15-2006 05:16 PM

Re: When an international customer logs in, having Paypal only
 
Thanks a bunch guys - I was looking for just such code.

Shopkeeper09 10-12-2006 07:49 AM

Re: When an international customer logs in, having Paypal only
 
Great mod!

Was wondering, has anyone successfully implemented this for version 4.0.18?

balinor 10-12-2006 07:59 AM

Re: When an international customer logs in, having Paypal only
 
I did just this morning! You want one too? :)

magazine-collector 10-31-2006 11:32 PM

Re: When an international customer logs in, having Paypal only
 
Didn't know if I should start a new thread or not, but my question seems very similar so I thought it'd best be put here---Is there something I can alter in checkout.tpl in my version so that checks/money orders are only offered as a payment method to U.S. based (local) customers and not offered as a payment method for international customers?

As always, thank you in advance!

billstevens 11-13-2006 11:00 PM

Re: When an international customer logs in, having Paypal only
 
The basic mod is working great, anyone have any input on how to further enhance this mod to limit the payment type by both location and membership level. For instance:

International customers that have no membership must use paypal
International customers that have membership = wholesale may use paypal or purchase order.

Thanks in advance.

-Bill

jeeya 12-19-2007 07:18 PM

Re: When an international customer logs in, having Paypal only
 
any one got this working in 4.1.8? Thanks

bsinger 03-19-2008 09:47 AM

Re: When an international customer logs in, having Paypal only
 
Does anyone have this correctly implemented for 4.1.9?

I have been unable to make the correct changes...

zenkisser 03-22-2008 04:47 AM

Re: When an international customer logs in, having Paypal only
 
Hi!

I have a store that is on 4.019, I will pay someone to install this modification with a decent post count to install this for us at a fair price for the code edits as I can't get it perfect. If this request should be referened in the for hire section, our apologies.

Thank you

(please pm if interested)

fireflight 10-07-2008 08:29 AM

Re: When an international customer logs in, having Paypal only
 
Based on dsparks work I was able to get this working in 4.1.9 in the fast lane checkout.

Around line 85 in modules/Fast_Lane_Checkout/checkoutmethod2.tpl find

Code:

<td valign="top" width="70%" style="padding: 0 5px;">
{include file="customer/main/subheader.tpl" title=$lng.lbl_payment_method}
<table cellspacing="0" cellpadding="2" width="100%">
{foreach from=$payment_methods item=payment} 

and change it to:
Code:

<td valign="top" width="70%" style="padding: 0 5px;">
{include file="customer/main/subheader.tpl" title=$lng.lbl_payment_method}
<table cellspacing="0" cellpadding="2" width="100%">
{if $userinfo ne "" and ($userinfo.b_countryname eq "Canada")}
  {assign var="destination" value="L"}
{else}
  {assign var="destination" value="I"}
{/if}
{foreach from=$payment_methods item=payment} 

Then around line 95, you'll find:
Code:

<tr class="TableSubHead"{*cycle values=' class="TableSubHead", '*}{if $payment.is_cod eq "Y"} id="cod_tr{$payment.paymentid}"{/if}>
And change it to:
Code:

<tr class="TableSubHead"{*cycle values=' class="TableSubHead", '*}{if $payment.is_cod eq "Y"} id="cod_tr{$payment.paymentid}"{/if}{if $destination eq "L" and $payment.payment_method eq "Money Order"} style='display: none;'{/if}>

In this case, if the user is Canadian and the payment method is money order, then we don't display the table row.

koz 11-09-2008 10:36 AM

Re: When an international customer logs in, having Paypal only
 
Has anyone tried this with 4.1.11 by chance ? :D/


All times are GMT -8. The time now is 05:30 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.