Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Paypal Express Checkout usability mod

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 06-18-2009, 09:59 PM
 
necroflux necroflux is offline
 

Advanced Member
  
Join Date: Feb 2009
Posts: 47
 

Default 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!
__________________
-----------------
X-cart version 4.2.1
Reply With Quote
  #2  
Old 06-18-2009, 10:52 PM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

Default 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.
__________________
4.6.1 Platinum


Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 09:11 PM.

   

 
X-Cart forums © 2001-2020