Implementation of OCMOD OpenCart 2.0

Has anyone implemented OCMOD for plugin development in opencart 2.0? Do I need to install VQMOD to run OCMOD?

I found https://github.com/opencart/opencart/wiki/Modification-System , but still unable to get a clear view.

Any help would be really appreciated. thanks

+5
source share
7 answers

No, you do not need to install VQMOD to run OCMOD. OCMOD works independently.

You need to create the xml ocmod file with the extension .ocmod.xml , then you can download this file using the "Extension Installer" from the opencart admin panel.

You must clear and update the modification cache in order to update the system and make the extension work. You can clear and update the upper right buttons on the Extension> Modification page in the admin panel.

+12
source

OCMod is essentially a poor person VQMod. There are a number of missing functions that are not / will not be in it, which are in VQMod, the largest of which allows you to add content before / after a certain line match, and as such would really recommend just sticking to VQMod which works fine (version 2.5 and higher )

+5
source

I used ocmod and released some free oc extensions. VQMOD and OCMOD are two separate things (as already noted). Both will not interfere with each other. You can download ocmod.ocmod.xml scripts from the administration panel (extensions and modifications).


The suggestion is not to invest too much work right now, as ocmod is still a bit limited and is likely to change in the near future.

Several people propose to implement almost all vqmod functions, and the whole system / methods may change in the near future https://github.com/opencart/opencart/issues/2045

I personally prefer vqmod, as development can be faster, and you can edit xml on the fly and update the browser. I did 3 different vqmods in about an hour, while in ocmod I spent the same time loading / editing / deleting (3) modifications with different tags (ocmod required).

Caching in ocmod seems to be slower on my system (with modifications in many php files), and sometimes modifications do not appear (in the browser) immediately. I do not know the problem is in my specific system.

The ocmod logs do not provide too much information in case of errors.

+4
source

I tried to install OCMOD today on version 2.0.1.0 of OpenCart. I did not understand this, and the forums and documentation did not provide adequate assistance.

While the installation may be corrupted or my environment is listening on it, VQMOD and OCMOD are separate objects and are independent of each other.

For example, VQMOD uses XML files to store changes and creates a cache with modified kernel files. OCMOD saves the code changes in the database directly, without saving the loaded XML, and it seems that it creates a cache from there (I hope that it does part of the cache, I have not found evidence yet).

The installation code for OCMOD is located in the \ admin \ controller \ extension \ installer.php folder

public function xml() { 

This way, you don’t have to bother with VQMOD to get OCMOD to work unless you have old VQMODs and you don't want to restart them.

0
source

I tried OCMOD now, it is quite easy if you know which files you need to change and how you want to change them. You can find the official documentation here and a good regular expression tester here .

If you click Extensions / Modifications / Add in admin, you can simply paste your XML, select Activated , Save and then Update modifications, then click Log to check the log messages, then check the modified files under the system/modifications directory.

Something to remember is to remove your modification and add it as a new one when changing it, it seems that just updating is not enough to reload the XML.

Here is an example module that I made to remove the wishlist buttons

 <?xml version="1.0" encoding="utf-8"?> <modification> <name>Remove wishlist buttons</name> <code>cjohanssonremovewishlistbutons</code> <version>1.0</version> <author>Christian Johansson</author> <link></link> <file path="catalog/view/theme/default/template/product/product.tpl"> <operation> <search trim="true"> <![CDATA[<button type="button" data-toggle="tooltip" class="btn btn-default" title="<?php echo $button_wishlist; ?>" onclick="wishlist.add('<?php echo $product_id; ?>');"><i style="color:<?php echo html_entity_decode($config->get('ekometcss_css_wishlist_color'), ENT_QUOTES, 'UTF-8'); ?>;" <i class="<?php global $config; echo $config->get('ekometcss_custom_icons_wishlist') ? 'fa fa-' . $config->get('ekometcss_custom_icons_wishlist') : 'fa fa-star'; ?>"></i></button>]]> </search> <add position="replace"> <![CDATA[]]> </add> </operation> </file> <file path="catalog/view/theme/default/template/module/*.tpl"> <operation> <search trim="true"> <![CDATA[<button style="width: 80%;" type="button" class="cat-cart"]]> </search> <add position="replace"> <![CDATA[<button style="width: 100%;" type="button" class="cat-cart"]]> </add> </operation> <operation> <search trim="true"> <![CDATA[<button style="width: 20%;" type="button" class="cat-wishlist" data-toggle="tooltip" title="<?php echo $button_wishlist; ?>" onclick="wishlist.add('<?php echo $product['product_id']; ?>');"><i style="color:<?php echo html_entity_decode($config->get('ekometcss_css_wishlist_color'), ENT_QUOTES, 'UTF-8'); ?>;" <i class="<?php global $config; echo $config->get('ekometcss_custom_icons_wishlist') ? 'fa fa-' . $config->get('ekometcss_custom_icons_wishlist') : 'fa fa-star'; ?>"></i></button>]]> </search> <add position="replace"> <![CDATA[]]> </add> </operation> </file> <file path="catalog/view/theme/default/template/product/category.tpl"> <operation> <search trim="true"> <![CDATA[<button style="width: 80%;" type="button" class="cat-cart"]]> </search> <add position="replace"> <![CDATA[<button style="width: 100%;" type="button" class="cat-cart"]]> </add> </operation> <operation> <search trim="true"> <![CDATA[<button style="width: 20%;" type="button" class="cat-wishlist" data-toggle="tooltip" title="<?php echo $button_wishlist; ?>" onclick="wishlist.add('<?php echo $product['product_id']; ?>');"><i style="color:<?php echo html_entity_decode($config->get('ekometcss_css_wishlist_color'), ENT_QUOTES, 'UTF-8'); ?>;" <i class="<?php global $config; echo $config->get('ekometcss_custom_icons_wishlist') ? 'fa fa-' . $config->get('ekometcss_custom_icons_wishlist') : 'fa fa-star'; ?>"></i></button>]]> </search> <add position="replace"> <![CDATA[]]> </add> </operation> </file> </modification> 
0
source

Has anyone implemented OCMOD for plugin development in opencart 2.0?

Ans: Yes

Do I need to install VQMOD to run OCMOD?

Ans: No

OCMOD Folder structure similar to this for Opencart

 -upload -admin...(if you have required) -catalog..(if you have required) - - - - - install.xml 

Replace these and so named .ocmod.zip

Then you can install using the Opencart installer

0
source

No VQMOD split plugin that depends on the OCMOD XML file system. Depends on the database when installing the new ocmod plugin, which it stores in the change table

0
source

Source: https://habr.com/ru/post/1204533/


All Articles