It's been a long time since I last used OpenCart however I seem to have found my way back here and I would like to pick some brains!
I want to display the store phone number within some information pages or the HTML module. Is there anyway I can pull this directly like within template files where I can use {{ telephone }}. If the store phone number changes I'd like to not have to go back through and update each page individually.
Thanks in advance.
Keiron
I want to display the store phone number within some information pages or the HTML module. Is there anyway I can pull this directly like within template files where I can use {{ telephone }}. If the store phone number changes I'd like to not have to go back through and update each page individually.
Thanks in advance.
Keiron
New member
you can if you know code with str_replace or contact me to get module for resolve your problem
Opencart Developer|Thiết kế website|Thiết kế website tại Đồng Nai
You could add this to your pages:keiron1992 wrote: ↑Thu Feb 14, 2019 5:09 amIs there anyway I can pull this directly like within template files where I can use {{ telephone }}. If the store phone number changes I'd like to not have to go back through and update each page individually.
Code: Select all
{tel}
Code: Select all
$("body").html($("body").html().replace(/\{tel\}/g,'<a href="tel:123456">123456</a>'));
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
New member
For anyone wanting to do this, I opted for str_replace. Here's the code I used:
Replace in catalog/controller/information/information.php
with
Replace in catalog/controller/information/information.php
Code: Select all
$data['description'] = html_entity_decode($information_info['description'], ENT_QUOTES, 'UTF-8');
Code: Select all
$data['description'] = str_replace("{{ telephone }}", $this->config->get('config_telephone'), html_entity_decode($information_info['description'], ENT_QUOTES, 'UTF-8'));
New member
Who is online
Users browsing this forum: No registered users and 46 guests