• g***ace 21:12:36 下单 虚机:HCU1
  • m***ran 18:30:46 续费 虚机:tw000
  • m***ran 18:28:42 续费 虚机:tw000
  • g***999 16:01:52 开通 虚机:HK1
  • g***999 15:59:32 下单 虚机:HK1
  • l***nig 15:51:13 create 虚机:HCU1
  • l***nig 15:50:19 下单 虚机:HCU1
  • b***ond 14:05:34 下单 虚机:SDV1
  • x***oyu 13:25:05 购买 虚机:xgyx1g_w
  • x***oyu 13:24:42 新购 虚机:xgyx1g_w
  • x***oyu 13:22:56 新购 虚机:xgyx1g_w
  • 1***937 13:18:25 下单 云服务器:alicloudserver
  • x***oyu 13:16:19 新购 虚机:xgyx1g_w
  • x***han 9:24:26 续费 域名:domcom
  • x***han 9:22:42 续费 虚机:domcom
  • q***ang 17:27:24 购买 卡密:BaCodeB
  • 1***531 17:04:06 续费 虚机:HCA1
  • 1***531 17:04:00 续费 虚机:HCA1
  • f***fei 16:43:01 购买 卡密:BaCodeB
  • 1***588 16:37:56 create 虚机:HCU1


ocmod是opencart电商系统的文件更新管理机制,而他的鼻祖vQmod 全称是 Virtual File Modification System 又称快速虚拟MOD)是一个虚拟覆盖系统的设计,以避免原有系统核心文件被修改。这个概念是很简单,它通过创建XML搜索/替换脚本文件,而不是直接更改核心文件。这些脚本文件是在页面加载解析为每个“源”核心文件“包括”或“规定”的php函数加载和资源,然后打补丁的脚本文件的变化,并保存到一个临时文件,然后在执行临时文件,在过程中取代了原来的文件。原来的源文件是永远不会改变。这将实现一个“虚拟”的变化中,在没有任何实际修改的核心文件中执行想要的过程和结果。

<modification>        /* 根 */
    <id>Very simple AJAX live search</id>
    <file name="admin/controller/catalog/product.php">  /* 替换的文件名*/
            <search position="after">  /*ater: 在寻找到的字符串后面增加;before:在寻找到的字符串前面增加;replace:替换寻找到的字符串*/
            $this->data['products'][] = array(  /* 查找的字符串*/
            'sku'      => $result['sku'],   /* 增加或替换的字符串*/
            'upc'      => $result['upc'],





  vqmod-2.3.2-opencart.zip (13.4 KB, 391 次)








Modifying OpenCart: vQmod vs OCMOD 

Having two or more ways to do something can be useful, but it isn't always the case. When it comes to OpenCart, there are four ways to modify its core functionality: vQmod, OCMOD, Override Engine and Event Handlers. Let’s take a quick look at vQmod and OCMOD and the differences between these two.

What is vQmod and How Does it Work?

vQmod (or Virtual Quick Mod) is the most widely used of the four override systems available today. If you're using MultiMerch, you probably know that we only use vQmod for OpenCart core modifications.

It's actually quite simple – search/replace code modifications are specified as separate xml files (see the syntax examples here). vQmod then parses the xml files during page load and applies the modifications to the target files. The result is saved as a temporary modified file, which is then loaded by OpenCart instead of the original one.

This means vQmod doesn’t make any direct changes to the actual OpenCart core files. Because of this, the modifications are non-destructive and the original files are left intact – you can always undo the changes by simply removing the xml file.

vQmod lets you apply multiple modifications to same files, making it possible to install multiple vQmod-powered extensions (usually) without conflicts. The system also has a variety of options for finding/replacing code, error handling, positions, indexing and more. If an error occurs, OpenCart will simply fall back to the original source file.

The drawback is that vQmod isn't part of OpenCart – it needs to be installed separately. If you're creating your own vQmod-powered extensions, you'll need to make sure your clients have vQmod installed on their servers. If it's not present, the extension will not work correctly. (The good thing is – the installation process is really simple: upload, run the installer, done)

Finally, even though vQmod was designed to use it with OpenCart, it can also be used separately – there is a standalone version of vQmod available for download that can be integrated into any custom project unrelated to OpenCart.

Is OCMOD a Better Alternative?

If vQmod is so awesome, why would you need something else? Well, the idea was to have something simpler built into OpenCart and available by default. Or, as Daniel Kerr, the main guy behind OpenCart, put it: "The problem also is vQmod, I just don't like how there are a lot of unnecessary features."

In fact, OCMOD is basically a stripped down version of vQmod system built into OpenCart. It works in a similar way – modifications are stored in xml files and uploaded to the store, then parsed and applied to OpenCart core code. Unlike vQmod, OpenCart has a built-in OCMOD modification uploader and manager. In addition to this, OCMOD allows you to specify extra SQL and PHP code to be executed during modification installation in separate install.php and install.sql files.

There are a few drawbacks compared to the original vQmod, though. This includes a few missing advanced search/replacement modifiers such as top, bottom, iafter and ibefore, as well as partial line matching and a few other things. In addition to this, OpenCart's modification cache needs to be refreshed every time there are changes to OCMOD files, which may slow down development, and OCMOD log files aren't as informative as vQmod's.

Because of these differences and the lack of a clear benefit, OCMOD hasn't received wider adoption (with some of the community calling it a “poor man’s vQmod”) and vQmod is still used by many OpenCart developers who are reluctant to spend time and effort converting their mods. (If you feel like converting, however, see a great vQmod to OCMOD conversion guide by an OpenCart developer rph here).


Both vQmod and OCMOD are meant to be used for the same purpose and both have their pros and cons (feel free to check this developer discussion thread on OpenCart forums). The choice is yours, though. We at MultiMerch still use vQmod – mostly because there are quite a bit of modifications in MultiMerch Marketplace. If you're starting something from scratch, you may as well try OCMOD first since it's part of OpenCart. You can always switch later!

+ mature, stable and robust system – original version released in 2010
+ clear documentation
+ simple modification syntax and deployment
- not part of OpenCart core – needs to be installed separately

+ part of OpenCart core – no additional installation needed
+ modification installer integrated into OpenCart
+ "execute during installation" scripts
- a few features missing compared to vQmod
- relatively new system with no clear development roadmap


Martin Boze

About the authorMartin Boze is the Founder of MultiMerch Marketplace. I also love skydiving, motorcycles and space. And other cool things.


打印 】 
上一篇:已解决:指定的 CGI 应用程序由于未返回完整的一组 HTTP 头而产生错误行为force-cgi-redirect
  >> 相关文章
  ecshop2.7.3没有反序列化unserialize造成​报错Warning: Illegal string offset free_money admin/order.php
  jquery input 自动获取焦点DOM对象和jquery对象的问题
会员 客服 充值 工单





请拨总机 010-57180806

咨询售后问题建议 提交工单