Page 1 of 1

OpenCart 4.1.x.x OCMOD is not working properly

Posted: Sun Mar 30, 2025 11:28 pm
by huntbee
Hello OpenCart Experts,

I'm testing the OCMOD for opencart 4.1.0.3. I'm trying with a simple test, i.e., to display a text in footer.

Here is my OCMOD code:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<modification>
  <name>Test OCMOD for store footer</name>
  <code>store_footer_updates</code>
  <version>1.0.0</version>
  <author>HuntBee OpenCart Extensions</author>
  <link>https://www.huntbee.com</link>

  <file path="catalog/controller/common/footer.php">
    <operation>
      <search><![CDATA[$data['scripts'] = $this->document->getScripts('footer');]]></search>
      <add position="before"><![CDATA[
            $data['test'] = 'TEST FOOTER TEXT';
      ]]></add>
    </operation>

    <operation error="skip">
      <search error="skip"><![CDATA[Opencart\Catalog\Controller\Common;]]></search>
      <add position="replace"><![CDATA[Opencart\Catalog\Controller\Extension\Ocmod\Common;]]></add>
    </operation>
  </file>
  
  <file path="catalog/view/template/common/footer.twig">
    <operation>
      <search><![CDATA[</body>]]></search>
      <add position="before"><![CDATA[
            <!-- huntbee test-->
            {{ test }} 
      ]]></add>
    </operation>
  </file>
  
</modification>
Both footer.php and footer.twig modification cache file is created with required changes, however it is not passing the $data['test'] value to the footer.twig

What could be the issue, am i missing something here?

Re: OpenCart 4.1.x.x OCMOD is not working properly

Posted: Mon Mar 31, 2025 12:40 am
by JNeuhoff
I can confirm this issue, just tested your script, see attached ocmod.zip. It looks like OpenCart isn't calling the modified controller.

Try it again with the master branch (upcoming 4.1.0.4). If that doesn't work, then open a new issue on github.