Post by ick » Fri Jun 01, 2018 6:40 pm

OC Version: 2.3.0.2
Theme: Journal 2

Hello, I need a URL link in the text of custom field. I add custom field (check box) to registration and checkout forms and there is a text description, part of which I need to be link. I tried "a href" tag but it is just displayed as plain text.

For example:

CHKbox - You can subscribe for our monthly .... from here
* from here is the link ;)

Can I edit the text in some file and add the link there? Which one?

Thank you in advance.

ick
Newbie

Posts

Joined
Fri Jun 01, 2018 6:16 pm

Post by Qphoria » Sat Jun 02, 2018 10:00 pm

Yes this can be done...

1. Change an option name to something like

Code: Select all

<a href="http://google.com">Click Me</a> for info about Size
2. EDIT: catalog/controller/product/product.php

3. FIND:

Code: Select all

=> $option['name']
4. REPLACE WITH:

Code: Select all

=> html_entity_decode($option['name'], ENT_QUOTES, 'UTF-8'),
5. IF you want to also allow option value text to be clickable (for radio buttons and checkboxes):
FIND:

Code: Select all

=> $option_value['name'],
6. REPLACE WITH:

Code: Select all

=> html_entity_decode($option_value['name'], ENT_QUOTES, 'UTF-8'),
Note this may make the admin side look weird when adding products in the admin.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator
Online

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by ick » Sun Jun 03, 2018 2:02 am

Qphoria wrote:
Sat Jun 02, 2018 10:00 pm
Yes this can be done... ...
Thank you for your answer, but this is not what I look for. I believe this method works for custom fields in products pages.
What I need is for register/checkout pages - see on :
Image
Once again thank you for your answer.

ick
Newbie

Posts

Joined
Fri Jun 01, 2018 6:16 pm

Post by Qphoria » Tue Jun 05, 2018 2:50 am

Those can just be entered through the language files. There are some examples in the language/en-gb/account/register.php file

Code: Select all

$_['text_agree']           = 'I have read and agree to the <a href="%s" class="agree"><b>%s</b></a>';
Just replace the %s with your words

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator
Online

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by ick » Thu Jun 07, 2018 3:29 pm

Qphoria wrote:
Tue Jun 05, 2018 2:50 am
Those can just be entered through the language files. There are some examples in the language/en-gb/account/register.php file

Code: Select all

$_['text_agree']           = 'I have read and agree to the <a href="%s" class="agree"><b>%s</b></a>';
Just replace the %s with your words
Thank you, but again this is not what I mean ::) . Your solution is for default "I have read and agree to the Privacy Policy " on the left of Continue button.

What do I need is a link to be placed in the custom field I have created in Home/Custom Fields, not to translate $_['text_agree'] option:
Image

ick
Newbie

Posts

Joined
Fri Jun 01, 2018 6:16 pm
Who is online

Users browsing this forum: No registered users and 3 guests