Post by divij » Mon Aug 31, 2015 6:39 pm

Hi,

I am trying to convert URLs on the front end to clickable links. The functionality is needed specifically for the order info page, where the customer can simply click on the Order Tracking URL that is entered in the comments to track order, rather than having to copy and paste the URL to open it. I found this PHP code to accomplish this-

function make_urls_into_links($plain_text) {
return preg_replace(
'@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-~]*(\?\S+)?)?)?)@',
'<a href="$1">$1</a>', $plain_text);
}

1. Where to put this code?
2. Does it need modification to work with Opencart 1.5.6.4?
3. Is there any way to run this function on the order details page only?

Thanks in anticipation :)

Newbie

Posts

Joined
Wed May 13, 2015 6:36 pm

Post by florinsith » Tue Sep 01, 2015 12:23 pm

I guess in system/library/response.php to work for everything. But I think you should just add the links as links from the start, perhaps edit tha ocmod/vqmod of the tracking extension, identify the code and make the text into link.

Image
My Extensions - SuperTheme - Opencart templates - Opencart modules


User avatar
Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am


Post by divij » Sat Sep 05, 2015 8:02 pm

Thanks for your reply. I made a VQMod to solve this issue. This works on the default theme.

Attachments


Newbie

Posts

Joined
Wed May 13, 2015 6:36 pm
Who is online

Users browsing this forum: Bing [Bot] and 41 guests