Page 1 of 1

[vQmod] *FREE* Support for Theme Overrides in 3.0

Posted: Mon Jul 09, 2018 12:19 pm
by Qphoria
OpenCart 3.0 has a nifty theme editor built into the admin now. It allows you to edit the template files through the admin, but when you save, it doesn't modify the original file. Instead, it saves the file with the modification to the database and when the page is loaded, if an override exists in the database, it will serve up this saved version instead of the file version.

But since ocmod and vQmod are both made to trigger on physical files as they are included, this override process bypasses both modification systems.

So this is a free simple script to save that database output to a temp file, and then pass that temp file into vQmod to apply any scripts to the modified version. It won't add ocmod support however as that has to be handled differently, but at least vQmod scripts will now trigger correctly on this override content.

In the case of errors, it will still report the original file (not the temp override file) as not having a match, so be conscientious of that.
vqcache files will match the temp override name which will be in this naming format:

Code: Select all

vq2-system_storage_override_common_home.php
Just drop this script into your vqmod/xml folder. Only works with 3.0 or later.

Re: [vQmod] *FREE* Support for Theme Overrides in 3.0

Posted: Mon Jul 09, 2018 8:35 pm
by straightlight
Is this provided solution also on your GitHub page?

Re: [vQmod] *FREE* Support for Theme Overrides in 3.0

Posted: Mon Jul 09, 2018 9:37 pm
by Qphoria
Technically since vQmod is a file-based system, it doesn't really belong in the official release so it's released as a separate script. However, it might make sense to rewrite or add another modCheck-like function to support passing in strings as well as files as the source. But that's something we'll need to think about. For now, this is a simple enough workaround.

Re: [vQmod] *FREE* Support for Theme Overrides in 3.0

Posted: Mon Jul 09, 2018 10:17 pm
by straightlight
No problem. However, this topic may be lost in the mud pretty quick and that is if there are any muds left. Otherwise, while reflection needs to be made regarding an additional set of class from your package, perhaps setting this topic as sticky would be ideal.