I am new to OpenCart OCMOD and VQMOD systems. So I need some help. My questions are.
It is said that OCMOD is OC2+ default system. It is also said we have to
First time we were talking about general OCMOD and VQMOD logic. This time I'll describe the OCMOD working experience (VQMOD works mostly the same and is outdated, so I will omit it). OCMOD itself is an engine (built in OpenCart since 2.X). We need to place in this engine an instructions to make it works. The instruction files are in XML format and has specific names, like my_file.ocmod.xml, where .ocmod.xml ending is required.
Here is an example of OCMOD file
My OCMOD file
my-ocmod
1.0
Me
http://mywebsite.com
]]>
Add Something
Here we have 2 instructions (operations) in 2 different file (we can implement multiple operations in a single file as well). In operation we are searching for a line of the code in original core file and add before/after or replace it with tho code in add
tag. Here is OCMOD file documentation, might help with .ocmod.xml file building.
When you have .ocmod.xml file - you need to install it. There are two different ways to do it:
In some cases you could see .ocmod.zip archive with install.xml and upload folder. It could be the module with OCMOD file and additional files, compiled in a single installer.
Now, when we have a file with operations .ocmod.xml installed and cache is cleared - system creates core files copies and keep them in /system/storage/modifications/.... If we take the code from the example - you will find file /system/storage/modifications/catalog/view/theme/default/template/common/header.twig with implemented changes from .ocmod.xml.
So that's it. OCMOD works as simple as this. As soon as you have installed any .ocmod.xml file - this file is keeps in OpenCart, and implement operations after every cache cleaning. You made changes in .ocmod.xml file - clear the cache. Installed new .ocmod.xml - clear the cache. Removed some old .ocmod.xml - clear the cache.
After upgrading OpenCart version - OCMOD files may stay untouched. But if they are gone - just install them again (you should save them before somewhere).
P.S. Different .ocmod.xml files can affect on the same core file. This is absolutely OK.