OpenCart 3.0.3.5 and 3.0.3.6 Extension Modification system

WOW, we already came to OpenCart 3.0.3.5 and 3.0.3.6 versions. Time flies, right?
I recently installed the latest version for a project and after installing a plugin it does not show anywhere in the store admin section. No errors are displayed whatsoever. If you came across the same issue here is what did the trick for me.

Thanks to the support of the huge OpenCart community I got this fix from a great developer #CartBinder.
This fix should be applied before any actual plugin install, because it fixes the OC bug in the versions 3.0.3.5 and 3.0.3.6. related to the Extension Modification system.

You need the FTP access to the server and find the file modification.xml located in /system/ folder.

Needless to say that you should make a backup of this file before proceeding to the next step.

Delete the content of the file and paste the following code:


<?xml version="1.0" encoding="utf-8"?>
<modification>
  <name>Modification Default</name>
〈code〉default〈/code〉
  <version>1.1</version>
  <author>OpenCart Ltd</author>
  <link>http://www.opencart.com</link>
  <file path="system/{engine,library}/{action,loader,config,language}*.php|system/library/template/template.php">
    <operation>
      <search regex="true">
        <![CDATA[~(require|include)(_once)?\(([^)]+)~]]>
      </search>
      <add position="replace">
        <![CDATA[$1$2(modification($3)]]>
      </add>
    </operation>
  </file>
  <file path="system/library/template/twig.php">
    <operation>
      <search>
        <![CDATA[if (is_file($file)) {]]>
      </search>
      <add position="replace">
        <![CDATA[if (defined('DIR_CATALOG') && is_file(DIR_MODIFICATION . 'admin/view/template/' . $filename . '.twig')) {	
                $code = file_get_contents(DIR_MODIFICATION . 'admin/view/template/' . $filename . '.twig');
            } elseif (is_file(DIR_MODIFICATION . 'catalog/view/theme/' . $filename . '.twig')) {
                $code = file_get_contents(DIR_MODIFICATION . 'catalog/view/theme/' . $filename . '.twig');
            } elseif (is_file($file)) {]]>
      </add>
    </operation>
  </file> 
</modification>

*P.S. Mind the line 4 of this code and change the tag brackets for the code tag, because the plugin that I’m using for displaying the code has a bug with nesting code tags (which are also used by the plugin itself). Note the difference of the <> brackets and just retype them on your keyboard after pasting the code from this page.

Save the file and upload it back to the server.

Now you can install the plugin(s) that you need and press the Refresh button without any errors.

0 comments

Leave a Reply