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.
Hi,
I am trying to add some card/payment type images to the Payment Method selection area.
Currently we have:-
We would like something similar to:-
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
This is the hot new that I really attract. I will contact with you right now. Thanks for sharing.
Offline
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.
// +------------------------------------------------------------------+ // | 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:-
$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
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:-
<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:-
<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
OK realized I am looking in completely the wrong place in the Formfield radio button code.
The buttons get printed here
$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
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.
// $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
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
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
All Done!
Screen shot of the finished result below.
Thanks again for the assistance.
Rob
Offline
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
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!
Offline