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)
-   -   Paypal Express Checkout usability mod (https://forum.x-cart.com/showthread.php?t=48174)

necroflux 06-18-2009 09:59 PM

Paypal Express Checkout usability mod
 
At default, x-cart includes both a "checkout with paypal" option on the cart page as well as the payment options page, which to me is confusing from a user perspective.

I wanted to eliminate the Paypal option from the payment options page EXCEPT for when the user has already logged in through Paypal and came back to my X-cart to complete the payment. At that point, they can click "Change shipping options", change their shipping method to anything they like (since this wasn't possible anywhere previously in this process), and the Paypal option will be available (and checked by default since they are logged in).

From here, if they leave Paypal checked as the option, the next page will reflect the new shipping cost and they will still be logged into the same Paypal session. If they select an alternate payment option, the paypal session is cleared and they'd have to go back to the initial link on the cart page to pay through Paypal. To me this is optimal from a customer use perspective.

So here's how I did it:

In cart.php, after:

Code:

    $smarty->assign("payment_methods",$payment_methods);
    $smarty->assign("main","checkout");


Paste the following code:

Code:

x_session_register('paypal_token');
if($paypal_token) {
    x_session_register('paypal_express_details');
    $smarty->assign('paypal_active', 'yes');
    $smarty->assign('payer_email', $paypal_express_details['Payer']);
}


Then if you are using Fast Lane Checkout, in checkout_2_method.tpl, after:

Code:

{if $payment.processor eq "ps_paypal_pro.php"}

Paste:

Code:

    {if $paypal_active eq "yes"}

And BEFORE:

Code:

{else}
        <tr{interline class="subhead-row" index=$smarty.foreach.pm.index total=$smarty.foreach.pm.total}{if $payment.is_cod eq "Y"} id="cod_tr{$payment.paymentid}"{/if}>


Paste:

Code:

{/if}

To make the Paypal option checked when the customer is currently logged into a paypal session, replace the FIRST instance of the following code:

Code:

{if $payment.is_default eq "1"}

With:

Code:

{if $payment.is_default eq "1" || $paypal_active eq "yes"}


And replace the SECOND instance with:

Code:

{if $payment.is_default eq "1" && $paypal_active neq "yes"}




Finally I wanted to add the text for whatever paypal account the customer is currently logged into for clarity purposes. To do this, after:

Code:

{include file="payments/ps_paypal_pro_express_checkout.tpl" paypal_express_link="logo"}

Paste:

Code:

<span style="color:#777">({$payer_email})</span>

That's it!

Learner 06-18-2009 10:52 PM

Re: Paypal Express Checkout usability mod
 
Thanks necroflux for these fine codes.
But My Primary currency is set to one Credit card payment method . I want to link alt currency for customers opting to pay using Paypal (in USD -"$")...

Is it possible? Can you help me?

Thanks to all.


All times are GMT -8. The time now is 01:23 PM.

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