Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 04-20-2011 12:22:54

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Decorate "Payment Method" Selection in Checkout

Hi,

I am trying to add some card/payment type images to the Payment Method selection area.

Currently we have:-

http://www.protronica.co.uk/onlinestore/images/selection1.png

We would like something similar to:-

http://www.protronica.co.uk/onlinestore/images/selection2.jpg

I tried adding an html tag in the "Field Display Text" box in the details for the appropriate processing gateway, which is a trick that has worked in a couple of other places, but not this time.

Have looked through the HTML includes and cant find where this form gets put together - any info on where I should be looking to add these card images would be much appreciated.

Rob

Offline

 

#2 04-20-2011 21:36:08

Nicolasa77
Member
Registered: 04-20-2011
Posts: 1

Re: Decorate "Payment Method" Selection in Checkout

This is the hot new that I really attract. I will contact with you right now. Thanks for sharing.

Offline

 

#3 04-21-2011 05:04:09

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Re: Decorate "Payment Method" Selection in Checkout

Hi,

Looked through GBU_Checkout.php and as I know very little about  php I am struggling quite a bit, but looks like the following code is where the gateways get printed.

Code:

// +------------------------------------------------------------------+
// | Function: coprintcustgw                                          |
// +------------------------------------------------------------------+

function coprintcustgw ($custom_fields = array(), $gateway_fields = array()) {

// +--
// | This function prints the custom and gateway fields to the checkout
// | form.
// +--

$fields = array();

// +--
// | Work with custom fields first.
// +--

if (!(empty($custom_fields))) {

     foreach ($custom_fields as $num => $field) {

          $fields[] = $field;

     } // End of foreach statement.

} // End of if statement.

// +--
// | Now work with gateway fields.
// +--

if (!(empty($gateway_fields))) {

     foreach ($gateway_fields as $num => $field) {

          $fields[] = $field;

     } // End of foreach statement.

} // End of if statement.

// +--
// | Print the form.  We want to suppress the form header and form
// | footer as we print them in checkout on our own.
// +--

$this->globals('khxc_form.suppress_header',1);
$this->globals('khxc_form.suppress_footer',1);

$form = array('form'        => 'coform',
              'app'         => $this->app,
              'nspost'      => 'checkoutp',
              'name'        => 'Checkout Form',
              'description' => '',
              'dispcolumns' => 2,
              'fields'      => $fields);

$this->KHXC_Form->print_form($form);

$this->globals('khxc_form.suppress_header','0');
$this->globals('khxc_form.suppress_footer','0');

// +--
// | Log that we were here.
// +--

if ($this->debug) {$this->debugger("cogateways: Created gateway checkout fields.");}

// +--
// | Return true.
// +--

return 1;

} // End of function.

The line below would seem to be the key to getting to add some additional tags:-

Code:

$this->KHXC_Form->print_form($form);

But I have no idea where to find this or how to modify. the idea would to add somewhere an:-

If(specified gateway) add <img> tag

But it is not looking like this is easy to do.

anyone wilt any ideas - much appreciated.

Rob

Offline

 

#4 04-21-2011 08:05:05

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Re: Decorate "Payment Method" Selection in Checkout

Hi,

As trying to deal with GBU_Checkout.php looked difficult, I had another idea when I found the XHTML include:-

Formfield: Radio Button

This generates the Radio Button display and includes the description field if present, so should be possible to modify to add some html if the description matches something in particular.

The original code is:-

Code:

<fieldset>

<legend class="strong"><label for="<?php print $id . '--1'; ?>">

<?php print $name; if ($required) {print '*';} ?>

</label></legend>

<?php if ($description) {print $description;} ?>

I modified this to:-

Code:

<fieldset>

<legend class="strong"><label for="<?php print $id . '--1'; ?>">

<?php print $name; if ($required) {print '*';} ?>

</label></legend>

<?php if ($description) {print $description;
                          if ($description == 'Purchase using your PayPal account') {
                          print '<p>   add PayPal logo here</p>' ; }
} ?>

It doesn't work but I have no idea why. Like I said I am very new to php and could have all sorts of things wrong

Any help much appreciated.

Rob

Offline

 

#5 04-22-2011 04:23:55

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Re: Decorate "Payment Method" Selection in Checkout

OK realized I am looking in completely the wrong place in the Formfield radio button code.

The buttons get printed here

Code:

$field  = '<p class="khxc_formfieldp"><input class="' . $cssstyle . '" type="radio" name="';
$field .= $id . '" id="' . $id . '--' . $count . '" value="' . $name . '"' . $checked;
$field .= ' />' . ' ' . $value . '</p>' . $this->globals('khxc.eol');

print $field;

So it looks like I need to detect something about the particular buttons I am interested in e.g. $value == 'paypalpp' and use that to insert an image tag in the correct place in $field.

Back to Google and the PHP tutorials.

Rob

Offline

 

#6 04-22-2011 06:15:27

bbac
Member
From: Bristol, UK
Registered: 08-25-2008
Posts: 141

Re: Decorate "Payment Method" Selection in Checkout

Hi

A quick fix is to do the following:

In the payment gateway page, edit the gateway and change the "Field Display Text" to something like:

Credit Card <img src="/images/cc.png" />

To prevent this from being cleaned you will then need to comment out the following line in formfield_radio.php (bear in mind that there may be more than one of these, I had to comment out in apps/gbu0/GBU/includes/formfield_radio.php but yours may be at core/KHXC/includes/formfield_radio.php), at around line 40 or so.

Code:

//     $value = $this->xhtml_encode($value);

This should now work and give you an image after the text.  you should be a little more clever about this since your output is now "raw" with all the security issues that brings about. How about having a type of marker which you could detect in code to ignore the html encoding opertion? For example, in "Field Display Text" set it to

###Credit Card <img src="/images/cc.png" />

Then modify the code in formfield_radio.php to something like

Code:

      if (substr ( $value, 0, 3 ) == '###') {
        $value = substr ( $value, 3);
      } else {
       $value = $this->xhtml_encode($value);
      }

Bear in mind that the "Field Display Text" is limited to 250 characters in length so don't be too chatty. Also this code is not guaranteed, it's just a pointer!

Offline

 

#7 04-22-2011 12:51:08

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Re: Decorate "Payment Method" Selection in Checkout

Thanks Beta Test Team!

Suggestion works perfectly - including the ### marker code

There are a few layout issues to sort out to get the text and images on the same centre line, but with 250 characters to play with this should not be difficult.

A very simple solution to what looked like a tricky problem.

Thanks again.

Rob

Offline

 

#8 04-23-2011 04:25:12

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Re: Decorate "Payment Method" Selection in Checkout

All Done!

Screen shot of the finished result below.

Thanks again for the assistance.

Rob

http://www.protronica.co.uk/onlinestore/images/Payselect_live.JPG

Offline

 

#9 04-28-2011 09:46:30

glentizzard
Member
Registered: 01-03-2007
Posts: 8

Re: Decorate "Payment Method" Selection in Checkout

I have lost the payment method from the web site. The world pay part is missing. How to retrieve it?We moved server location. maybe this has something to do with it as was working fine.Why is it not displaying and allowing one to pay by card?

Offline

 

#10 04-29-2011 03:24:14

ZipSkins
Member
From: United Kingdom
Registered: 01-15-2006
Posts: 822
Website

Re: Decorate "Payment Method" Selection in Checkout

glentizzard wrote:

I have lost the payment method from the web site. The world pay part is missing. How to retrieve it?We moved server location. maybe this has something to do with it as was working fine.Why is it not displaying and allowing one to pay by card?

A URL would be helpful!


| Professional Quality Customisable Skins for your ClickCartPro Powered Site


-----------------------------
Certified Support Partner

Offline

 

Board footer