Post by szabolevi98 » Sat Apr 12, 2025 2:27 am

Hello,

I have this example ocmod:

Code: Select all

<modification>
    <name>OpenCart Log Cleaner Simple</name>
    <code>log_cleaner_simple</code>
    <version>1.0.0</version>
    <author>szabolevi98</author>
    <link>https://levente.net</link>
    <file path="system/library/log.php">
        <operation error="log">
            <search>
                <![CDATA[public function __construct(string $filename) {]]>
            </search>
            <add position="after">
                <![CDATA[        if (file_exists(DIR_LOGS . $filename) && filesize(DIR_LOGS . $filename) > ((defined('MAX_LOG_SIZE') ? MAX_LOG_SIZE : 50) * 1024 * 1024)) {
            file_put_contents(DIR_LOGS . $filename, '');
        }]]>
            </add>
        </operation>
        <operation error="log">
            <search>
                <![CDATA[namespace Opencart\System\Library;]]>
            </search>
            <add position="replace">
                <![CDATA[namespace Opencart\System\Library\Extension\Ocmod;]]>
            </add>
        </operation>
    </file>
</modification>

File created on /extension/ocmod/system/library/log.php but never executed.
I'm using phpStorm as IDE and I have xdebug installed, so I checked that this file never called. It calls the original file at /system/library/log.php.
What is the error here? I even modified the namespace. (I tried without it also)
Or it is not possible to make ocmod for system/library, it is only possible for controllers and models?

User avatar
Newbie

Posts

Joined
Thu Mar 03, 2022 6:10 pm

Post by MaxD » Mon Apr 14, 2025 3:47 pm

At 4.1.0.3, for me modding plain controllers does not work still, the original controller file is called.

User avatar
Active Member

Posts

Joined
Fri Jul 06, 2012 6:37 pm

Who is online

Users browsing this forum: No registered users and 4 guests