title: Opencart how to test if module installed?
body: <p>Is there a better way to check if a module has been installed in opencart. I am sure I must be missing something obvious for such a common task as this. </p>
  
  <p>I want this to work in both the frontend (catalog) and admin area. This is the reason for checking if the method exists and if it is a multidimensional array.</p>
  
  <pre><code>$this-&gt;load-&gt;model('setting/extension');
  $this-&gt;model_setting_extension = new ModelSettingExtension($this-&gt;registry);
  
  if(method_exists($this-&gt;model_setting_extension, "getExtensions")){ 
      $extensions = $this-&gt;model_setting_extension-&gt;getExtensions('module');
  } else {
      $extensions = $this-&gt;model_setting_extension-&gt;getInstalled('module');
  }   
  
  $installed = false;
  foreach($extensions as $extension){
      if(is_array($extension) &amp;&amp; $extension['code'] == "myfoo"){
          $installed = true;
      } elseif($extension == "myfoo") {
          $installed = true;
      }
  }
  if(!$installed){
      exit('Error: Could not load module: myfoo!');
  }
  </code></pre>