Post by Joe1234 » Sat Apr 19, 2025 6:35 am

Can the system/framework.php file be OCMOD, or is that expected to not be touched? I have a modified one in the modification dir, and I see a couple other mods have edited it as well, but when i put a log write in the modified and original file, I see the original file is what is being called. Any thoughts?

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by JNeuhoff » Sat Apr 19, 2025 4:41 pm

Joe1234 wrote:
Sat Apr 19, 2025 6:35 am
Can the system/framework.php file be OCMOD, or is that expected to not be touched? I have a modified one in the modification dir, and I see a couple other mods have edited it as well, but when i put a log write in the modified and original file, I see the original file is what is being called. Any thoughts?
Don't modify the system/framework.php via OCMOD ! The framework.php mainly creates and sets all the singleton class library instances in the registry. And if you need to modify a library cart there are better techniques to do so.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Joe1234 » Mon Apr 21, 2025 10:19 am

So which file do you suggest I put a code in that I need to activate on every page load? I tried the system/framework, system/startup, index and none of them will take a mod. So now I'm thinking to go with controller/startup/startup, controller/common/header and footer (for whatever reason I just don't like header/footer) Why won't index take a mod?

PS, why can't I/shouldn't I edit the framework file (or the others that were unsuccessful)? Is there a way to override whatever is preventing OC from using those modded versions?

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Joe1234 » Sat Apr 26, 2025 3:41 pm

I added: viewtopic.php?t=235067#p876702 so I can see the 1064 errors in the php and admin log and which file exactly they are coming from.
I have another script that decrypts encrypted coupons in the URL.
I have another code that is meant to be able to start an extension profile without being logged into the admin panel (for creating CRON Jobs on the server).

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by paulfeakins » Mon Apr 28, 2025 10:40 pm

It's still not really clear what you're trying to do that needs to be done on every page load, but if I were you, seeing as the file can't be modified by OCMOD, I'd keep a copy of the original file called something like framework_original.php and modify it.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by JNeuhoff » Tue Apr 29, 2025 12:31 am

Rather than modifying the system/framework.php, you could use an event handler for the trigger catalog/controller/*/before, and once the first controller load gets triggered initiate your exception handler once, which will then be used for all subsequent controllers and other code during the request.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Joe1234 » Fri May 02, 2025 10:08 am

I hate everything to do with events. So you don't think putting the codes in the front end and admin footer is a good alternative?

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by paulfeakins » Fri May 02, 2025 9:27 pm

Joe1234 wrote:
Fri May 02, 2025 10:08 am
I hate everything to do with events. So you don't think putting the codes in the front end and admin footer is a good alternative?
Haha, something we agree on!

In this case though, events are probably not a bad idea.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by OSWorX » Wed May 07, 2025 12:17 pm

Joe1234 wrote:
Fri May 02, 2025 10:08 am
I hate everything to do with events. So you don't think putting the codes in the front end and admin footer is a good alternative?
Sorry, but wrong opinion.
Because "you hate" this type of development, does not mean it would be not the best option.

And what you are suggesting ".. putting codes in .." is quite the same approach ..

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria
Who is online

Users browsing this forum: No registered users and 77 guests