Search code examples
javascriptphpopencartocmod

.js file modification not working with ocmod opencart


<file path="catalog/view/javascript/common.js">
<operation>
  <search><![CDATA['add': function(product_id, quantity) {]]></search>
  <add position="replace">
    <![CDATA['add': function(product_id, m, quantity) {
        alert('ok');
        quantity = m*quantity;
    ]]>
  </add>
</operation>

This is my xml also I do not get error in ocmod.log, please help


Solution

  • You can't modify client side files with ocmod or vqmod:

    css & js files - These files are rendered at the browser level, not at the server level, so vQmod has no effect on these. You can, however, create new files and use vQmod to alter the tpl files to point to these new css/js files. Or you can put <style> and <script> tags directly into the tpl file using vQmod.

    About vQmod: https://github.com/vqmod/vqmod/wiki/About-vQmod