Working with opencart, I met this piece of code:

if($moneymaker2_footer_links_enabled){ // Какое-то действие } 

Moreover, if the $ moneymaker2_footer_links_enabled variable is not declared, php gives an error that this variable was not found, which is why this check is needed if $ moneymaker2_footer_links_enabled does not assume true or false, i.e. I am sure that in this piece of code there is a check of the existence of a variable, but in its absence, an error appears.

This is some old way of checking for the existence of a variable, because isset is coping with this?

  • Give the whole piece of code, and there may not only be true / false, such a check will work if the variable contains at least some data. - Vadim Pedchenko
  • There it’s just the output of the variable in the div, <div class="moneymaker2_title" ><?php echo $moneymaker2_footer_links_enabled; ?></div> <div class="moneymaker2_title" ><?php echo $moneymaker2_footer_links_enabled; ?></div> - Shillkas
  • Apparently moneymaker2, this is some kind of module or template, maybe it’s just a developer’s jamb, or somewhere else with a certain condition this variable is declared ... Judging by the name, it is responsible for some links in the footer. - Vadim Pedchenko
  • See what happens if you google the variable name: google.com/search?q=%24moneymaker2_footer_links_enabled - Vadim Pedchenko
  • joxi.ru/xAeYVvwiY8aNkA it surprised me, in the description of the site some logs. Apparently, moneymaker2 is also used on those sites and gives an error. - Shillkas

1 answer 1

In the search engine, you do not have logs, but notifications that the variable is not defined.

A variable with this name is not included in the standard set for Opencart. Judging by the notification, this variable should be passed by the footer.php controller to the footer.php view, or it should be generated right there. Unfortunately, many developers sin by working with opencart (which is mvc) often hiding part of the logic in presentation files (templates with the extension .tpl).

The very file footer.tpl , judging by the same notification, is read from the cache ( system/storage/modification ). The standard template files that are modified by extensions are usually saved there. From this we can assume that there was some extension ocMod, which overwritten the file template footer, bringing in his own changes. Judging by the name of the variable, it is responsible for displaying a block of links, on the social network or somewhere else.

If this extension was used by you and was disabled / removed, then the cached footer template file - footer.tpl could remain from it. In this case, you need to update the cache. This is done from the admin, menu "modifiers" (buttons in the upper right corner).

If you are not sure of the variable's origin, simply add the if statement to the isset test:

 if(isset($moneymaker2_footer_links_enabled)){ // Какое-то действие } 

It should be understood that if the extension is still installed and activated, any erasing of the caches will result in the rewriting of the footer.tpl file and the disappearance of the edits.