CRE Loaded Community

Banner


Board index » Web Design and Development » Development Discussions

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to auto-select a payment method
PostPosted: Fri Jun 26, 2009 8:35 am 
Offline
CRE Newbie

Joined: Tue Jan 30, 2007 1:00 am
Posts: 31
So I've had a running 6.2.x B2B cart for years, and I'm working on bringing up a new 6.4 cart (also B2B).

As a part of bringing up that 6.2.x cart I tweaked the checkout_payment.tpl.php to auto select the top payment method when the customer enters the payment page of the checkout process. Thankfully I saved that info as I can't seem to find the thread on this site anymore (old link is dead).

Here were the changes that needed to be made for 6.2.x B2B (tested on 6.2.09)

Code:
/catalog/templates/content/checkout_payment.tpl.php

Tweaked based on this thread:  http://forums.oscommerce.com/index.php?showtopic=42029&hl=payment+method+default

This made the top payment method get selected AND highlighted by default.


Around lines 160-166
----------------------------------------------------
<?php
    if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) {
      echo '                  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
    } else {
      echo '                  <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
    }
?>
----------------------------------------------------
Changed to:
----------------------------------------------------
<?php
    if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) {
      echo '                  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
    } else {
      if ( (!$payment) && ($i==0) ) {

     echo '                  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";

} else {
      echo '                  <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
    }
    }
?>
----------------------------------------------------
----------------------------------------------------


Around line 172:

----------------------------------------------------
echo tep_draw_radio_field('payment', $selection[$i]['id']);
----------------------------------------------------
Changed to
----------------------------------------------------
echo tep_draw_radio_field('payment', $selection[$i]['id'], $i==0);
----------------------------------------------------




So now bringing up this 6.4 B2B cart I'm going back through my notes and finding of course that alot of the code is different and the mods/tweaks have to be applied differently. In some cases I've figured it out, but not being a real PHP guy I'm having trouble with this one.

The code in the 6.4 checkout_payment.tpl.php is definitely different from the 6.2.09 code. The sections are recognizable when comparing the two, but things are being done a bit differently. I've tried my hand at patching something together in the same vein as the 6.2.09 tweak but I haven't had any luck yet. Can anyone help? Here's the 6.4 code sections that line up with the same sections that were tweaked in 6.2.09 to accomplish this:


First around line 190:
Code:
<?php
    if ( (isset($payment) && $selection[$i]['id'] == $payment) || ($n == 1) ) {
      echo '                  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
    } else {
      echo '                  <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
    }
?>


and then a few lines further down around line 200:

Code:
<?php
    if (sizeof($selection) > 1) {
      if (isset($_SESSION['payment']) && $_SESSION['payment'] == $selection[$i]['id']) {
        echo tep_draw_radio_field('payment', $selection[$i]['id'], true);
      } elseif (!isset($_SESSION['payment']) && $i == 0) {
        echo tep_draw_radio_field('payment', $selection[$i]['id'], true);
      } else {
        echo tep_draw_radio_field('payment', $selection[$i]['id']);
      }
    } else {
      echo tep_draw_hidden_field('payment', $selection[$i]['id']);
    }
?>



Top
 Profile  
 
 Post subject: Re: How to auto-select a payment method
PostPosted: Mon Jun 28, 2010 11:22 am 
Offline
CRE Newbie
User avatar

Joined: Fri Apr 03, 2009 8:38 pm
Posts: 8
Hello.

I also require this doing.

Has anyone else solved this?

PM Me if you have or can fix it - i will pay for the fix if cost is reasonable.

Thanks


Top
 Profile  
 
 Post subject: Re: How to auto-select a payment method
PostPosted: Mon Jun 28, 2010 11:58 am 
Offline
CRE Freak
User avatar

Joined: Tue Sep 13, 2005 12:00 am
Posts: 47
Location: Suwanee, GA, USA
Contact CREHELP -- they took care of the issue for me very reasonably.

http://crehelp.com/

_________________
-Jerry


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

Board index » Web Design and Development » Development Discussions

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
It is currently Tue Feb 07, 2012 11:08 am
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

© CRE Loaded is a product of Chain Reaction Ecommerce, Inc. Usage & Privacy Policy