Search code examples
phpopencartocmod

error code not found in ocmod opencart v2


I am trying to replace all accurences of the lines of code in file using ocmod on opencart v2.0. This is my modification:

 <file path="admin/view/template/sale/order_form.tpl">
    <operation>

    <search ><![CDATA[
   if (option['type'] == 'select' || option['type'] == 'radio' || option['type'] == 'image') {
                    html += '<input type="hidden" name="product[' + i + '][option][' + option['product_option_id'] + ']" value="' + option['product_option_value_id'] + '" />';
                  }
]]></search>
    <add position="replace"><![CDATA[
 if (option['type'] == 'select' || option['type'] == 'radio' || option['type'] == 'image'||option['type']=='input_qty') {
                    html += '<input type="hidden" name="product[' + i + '][option][' + option['product_option_id'] + ']" value="' + option['product_option_value_id'] + '" />';
                  }
]]></add>
    </operation>






  </file>

Only problem is that in ocmoderror.log it says that line is not found. Dispite that in IDE I can see this line of code. What could cause this? And this is what I am seeing in ocmoderror.log

FILE: admin/view/template/sale/order_form.tpl
CODE: if (option['type'] == 'select' || option['type'] == 'radio' || option['type'] == 'image') {
NOT FOUND!

Solution

  • do not leave empty spaces in search tags begin and the end of the string and copy exactly the same code which is in core file. should be like:

    <search><![CDATA[if (option['type'] == 'select' || option['type'] == 'radio' || option['type'] == 'image') {
                        html += '<input type="hidden" name="product[' + i + '][option][' + option['product_option_id'] + ']" value="' + option['product_option_value_id'] + '" />';
                      }]]></search>
    

    Try...