It is a great feeling to know that the little ideas I knocked around over the years turned into such a popular modification system. Now, thanks to the great effort and coding skills of JayG, we bring version 2.0 to the community. I am going to retire the vQmod v1.0 thread so I will recap a bit about what vQmod is in this thread for new users, as well as explain any changes for those upgrading from vQmod 1.x to vQmod 2.0.

What is vQmod?
"vQmod™" (aka Virtual Quick Mod) is an override system designed to avoid having to change core files. The concept is quite simple... Instead of making changes to the core files directly, the changes are created as xml search/replace script files. These script files are parsed during page load as each "source" core file is loaded with the "include" or "require" php functions. The source is then patched with the script file changes, and saved to a temp file. That temp file is then substituted for the original during execution. The original source file is never altered. This results in a "virtual" change to the core during execution without any actual modification to the core files.

Add/Remove a mod by simply adding/removing the associated xml file from the vqmod/xml folder

OpenCart upgrades will not overwrite your changes or scripts

Different modifications to the same file can co-exist down to a single character! No other modification system exists with this much granularity

Powerful yet simple xml formatted syntax

Can be used to virtually alter any php or tpl file in OpenCart (except the main index.php)

How do I use it?
Simple.
1. Download the latest version that has "opencart" in the title
2. Using FTP, upload the "vqmod" folder from the zip to the root of your opencart store.
3. Be sure the vqmod folder and the vqmod/vqcache folders are writable (either 755 or 777). Also be sure index.php and admin/index.php are writable. If not sure which you need, first try 755. If you get errors about permissions, then try 777.
4. Goto http: //www.yoursite.com/vqmod/install.
5. You should get a success message. If not, be sure your store root is writable and try again
6. Load your store homepage
7. Using FTP, verify that there are new "vq" files in the "vqmod/vqcache" folder.
8. If yes, then you are ready to start downloading or creating vQmod scripts, otherwise ask for assistance.
9. The OpenCart development community has made hundreds of vQmod mod scripts in the free and commercial vqmod forums, and almost all developers use vQmod for their other larger modifications that require core alterations.
10. vQmod scripts are simple xml files that you upload into the vqmod/xml folder. If you want to disable a mod, simply remove the script from this folder. After installing a new mod, test it out and verify that no errors are being written to the vqmod/vqmod.log file. If you see errors in that file, be sure you contact the script author for assistance. Do not post script errors here.

What's new in vQmod 2.0?
vQmod 2.0 is a complete rewrite of the code by JayG. The original vQmod 1.x was my original brainchild and was a mess of good and bad ideas mixed into a single file and written as fast as the thoughts came to me. It worked surprisingly well for the shape it was in. JayG took the caterpillar code and turned it into a butterfly It still functions the same but should resolve some small nuances. Performance was never really an issue with v1.0 and v2.0 appears to be just as fast.

How do I upgrade from a previous version of vQmod?
Great news! There are no syntax changes or index.php changes for 2.0. So you should not have to change any of your script files.
1. Back up your /vqmod/xml/ folder locally. This is really just a for good practice, but really the files won't be overwritten anyway so this is optional but recommended just for having a backup.
2. Upload the vqmod/ folder to your store's root path so that it merges with your existing vqmod/ folder via FTP. This should retain your current files, but replace existing vqmod files (not folders). FileZilla is recommended. Be sure you drag-n-drop the new vQmod folder to the scroll bar and NOT ON TOP of the existing vQmod folder as that will put the new one inside of the old one instead of merging them. See the install video above for visual example.
3. Delete the vqmod.log (if it exists) and delete all files in the "vqmod/vqcache" folder on your site. The logs are now written to vqmod/logs on "{day}.log" format to break up the logs a bit.

That's it! The same goes for future versions!

Things to Note:

While the overall concept of this is virtual modifications, the vQmod installer has to make real changes to the main index.php and admin/index.php files only to initialize the vQmod class. This means if you upgrade to a new version of opencart, you will need to re-run the vQmod install steps above as the index files will likely be overwritten by the upgrade. Be sure that you don't delete the vqmod/install folder after use. There is no danger of keeping it as running the install again will simply note that it is already installed.

vQmod is limited to php and tpl files. It cannot modify browser loaded files like css and js. However, you can create new css and js files and alter the tpl file to load the newly created files.

vQmod will create a "vqmod.log" file in the vqmod folder if and only if there are script errors. If you don't see the file, then there are no script errors. If you are having trouble with a script or you see the vqmod.log file, open it up to figure out what the issue is. Keep in mind that it will log an error for every page load so if you don't take care of errors your vqmod.log file can get extremely large very quickly. You can delete this log at any time.. it will recreate itself as needed.

Troubleshooting vQmod scripts
vQmod scripts are only as good as the authors who make them. Once vQmod is installed and working, it is very unlikely that there will be any issues with the vQmod engine itself. If you are having issues with a mod not loading properly it is likely due to a script issue. vQmod has a log file that will record any script errors. It is good practice to always check for this file after installing a new mod. If the file doesn't exist, then there are no script errors. Please do not post script problems in this thread. Script bugs or issues need to be discussed with the author of the individual script. This thread is for discussion of the system, and for bug reporting only. Also be sure the "vqmod_opencart.xml" file is always in the vqmod/xml folder. This is the main script that is required for all others to work. It is included as part of the "opencart version" of the main vQmod install.

If you are getting php errors like "Warning: file_put_contents" or "permissions" then be sure to follow step 3 above.

I upgraded my opencart and vQmod stopped working??
Remember, the vQmod installed must make real file changes to the index.php and admin/index.php for vQmod to be initialized. If you ugpraded OpenCart, then you also replaced the index files with the new ones. Simply rerun the install command: http://mysite.com/vqmod/install/index.php and you should be ready to go again.

This is likely to be the last update for a while, except for bug fixes. One feature I'm sure plenty of developers have been waiting for is the arrival of the * in place of a file/folder name. Here's an example of it's use

This will then apply the modification to ANY product.tpl file regardless of the theme name
A restriction on the * is in place, where it will only match up to a forward slash, so you can't do
catalog/view/*.tpl to apply to all .tpl files within a directory. This restriction is intended, not a flaw for anyone who may want to do so in an extreme circumstance

The Problem:
The page loads once, and sets the vqcache files based on the xml scripts. Then if the page has ajax callbacks, they would also cause the vqcache files to be rewritten (if not using useCache). Tracing all the writes showed that a page load might have 9 vqcache writes, but the ajax callbacks generated another 50 writes to the same file. And since they write so fast, it was causing file writing lock issues

The Solution:
New "Pseudo-cache" code. Quite simply, if the vqcache file is less than 3 secs old, it will just reuse it rather than rewrite it. That prevents all the underlying ajax callbacks from regenerating the same file over and over, removing the issue. It is like having useCache enabled for 3 secs at a time, without the tedious step of having to manually delete the vqcache files when adding new scripts.

vQmod performance was already great, but now it is the fastest it has ever been.

NOTE: This version will be required for the next version of OpenCart v1.5.2
I've added ajax error messaging to all steps of the checkout page in the next version of opencart to allow tracking problems better. Due to the ajax callback issue mentioned above, the file locking will cause checkout to throw more errors until you upgrade to this version of vQmod. So be sure to upgrade.

Upgrade simply by grabbing the new vqmod.php file from the zip and drop it into your vqmod folder. That's it!

"log" is default. Simply logs the missing file and continues on with the rest of the operations
"skip" means it just ignores and continues on with the rest of the operations
"abort" means it aborts that remainder of that single xml file. It does not revert changes to other files made in that xml file before that operation and does not revert changes from other xml scripts.

It ONLY works for non-wildcard file paths. Wildcard paths are handled differently and already bypass the existence check.

Features:
- Updated vqmod_opencart.xml file to support OpenCart v1.5.4 (also works with older versions)
- Added new cacheTime to replace useCache with default of 60 secs (vqcache files will only rewrite every 60 secs. You can override this in the index.php file by adding $vqmod->cacheTime=30;
- Deprecated useCache

To upgrade:
1. Unzip the vqmod-2.1.7.opencart.zip file
2. Upload the vqmod folder to your store root path
The existing vqmod folder will merge so you don't need to worry about deleting anything
Be sure to say YES to overwrite existing files

Changes
=======
- Fixed minor bug with mods.cache - now refreshes cache when deleted
- Added <ignoreif> tag to operations
- Added path rewrites to make moved folders easier to manage
- Multiple files can now be named inside name="" attribute, separated by commas
- path="" attribute added to <file> tag to allow base prefix for multiple names
- We now recommend adding a info="" attribute for operations to make it clearer what the operation does. This at present is purely optional but we advise adding for the benefit of others reading the files

Details of the new changes can be read in the development thread (linked above)

OpenCart specific changes
- Added seamless upgrade code to installer
- Added XML header to "vqmod_opencart.xml"
- Changed "vqmod_opencart.xml" to be greatly simplified and cover all php files
in "/system/library" and "/system/engine" more consistently
- Changed "admin" folder name variable to make it easier to edit in Oinstaller
- Changed installer code to use new "VQMod::modCheck()" and "VQMod::bootup()"
code