Post by ianhaney50 » Thu Mar 13, 2025 5:53 pm

I have created a new textarea box on the admin side in the settings tab and it's showing ok on the admin side and I can edit the values and it saves/updates in the database but I can't get the value displayed on the front end in the footer on all pages

In admin/controller/setting/setting.php I have the following code

Code: Select all

if (isset($this->request->post['config_footer_description'])) {
			$data['config_footer_description'] = $this->request->post['config_footer_description'];
		} else {
			$data['config_footer_description'] = $this->config->get('config_footer_description');
		}
In admin/language/en-gb/setting/setting.php I have the following code

Code: Select all

$_['entry_footer_description']       = 'Footer Description';
In admin/view/template/setting/setting.twig I have the following code

Code: Select all

<div class="form-group">
                <label class="col-sm-2 control-label" for="input-footer-description">{{ entry_footer_description }}</label>
                <div class="col-sm-10">
                  <textarea name="config_footer_description" rows="5" placeholder="{{ entry_footer_description }}" id="input-footer-description" class="form-control">{{ config_footer_description }}</textarea>
                </div>
              </div>
In catalog/controller/common/footer.php I have the following code

Code: Select all

$this->config->get('config_footer_description');
In catalog/view/theme/eshop/template/common/footer.twig I have the following code

Code: Select all

<p>
              {{ footer_description }}
              </p>
Do I need to add any code anywhere else or in another file? I am using opencart 3.0.3.8

Active Member

Posts

Joined
Fri Apr 29, 2016 4:21 am

Post by OSWorX » Thu Mar 13, 2025 6:41 pm

Have you assigned

Code: Select all

$this->config->get('config_footer_description');
to

Code: Select all

$data['footer_description']
in the controller?

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by ianhaney50 » Thu Mar 13, 2025 6:56 pm

OSWorX wrote:
Thu Mar 13, 2025 6:41 pm
Have you assigned

Code: Select all

$this->config->get('config_footer_description');
to

Code: Select all

$data['footer_description']
in the controller?
Not yet, what file do I put the following code in?

Code: Select all

$data['footer_description']
In catalog/controller/common/footer.php I've got

Code: Select all

$this->config->get('config_footer_description');
I tried adding

Code: Select all

$data['footer_description'];
in to catalog/controller/common/footer.php but it don't show the value

Active Member

Posts

Joined
Fri Apr 29, 2016 4:21 am

Post by ianhaney50 » Thu Mar 13, 2025 7:44 pm

OSWorX wrote:
Thu Mar 13, 2025 6:41 pm
Have you assigned

Code: Select all

$this->config->get('config_footer_description');
to

Code: Select all

$data['footer_description']
in the controller?
Hi

Sorry I got what you meant now and done the following code and it's worked

Code: Select all

$data['footer_description'] = $this->config->get('config_footer_description');

Active Member

Posts

Joined
Fri Apr 29, 2016 4:21 am

Post by OSWorX » Thu Mar 13, 2025 10:25 pm

I wanted you to rethink what you've done.

It's always the same: whenever I want a value to be displayed in a template (.twig), we have to assign prior this value inside the corresponding controller.
In your case: footer = footer.php <> footer.twig.

Glad you found that O0

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria
Who is online

Users browsing this forum: No registered users and 65 guests