2
votes

i got alot of these messages

Notice: Undefined variable: config_facontact_address in /home/oclasico/public_html/catalog/view/theme/shoppa/template/common/footer.tpl on line 50

i already seen this answer

Undefined variable (opencart)

, and i tried to do it , but i didn`t find the code to replace :(

and here is my footer.tpl line 50 look like

<?php if ($config_facontact_address) { ?> 
            <div class="address"><?php echo $config_facontact_address; ?></div>
             <?php } ?> 

my OpenCart Version 1.5.4

thanks

2

2 Answers

4
votes

variable $config_facontact_address is not set,

to avoid this error use if(isset($config_facontact_address))

2
votes

The reason why it's undefined is because it hasn't been set in the controller file first.

Opencart uses the MVC architecture, varibles are defined in the Controller, then used within the Template / View files. For this reason, it will always evaluate false using isset()

The code missing from the controller file (located: catalog/controller/common/footer.php) would be:

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

If your not comfortable editing the controller, then you can replace your problem code with this:

    <?php if ($this->config->get('config_facontact_address')) { ?> 
    <div class="address"><?php echo $this->config->get('config_facontact_address'); ?></div>
    <?php } ?>