Post by ADD Creative » Mon Jun 27, 2022 3:24 am

You can use replace.

Code: Select all

<file path="admin/model/catalog/product.php">
	<operation>
		<search>
			<![CDATA[mpn = '" . $this->db->escape($data['mpn']) . "',]]>
		</search>
		<add position="replace">
			<![CDATA[mpn = '" . $this->db->escape($data['mpn']) . "', cost = '" . $this->db->escape($data['cost']) . "',]]>
		</add>
	</operation>
</file>

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by Majnoon » Mon Jun 27, 2022 8:54 pm

Thanks and how do we deal with

Code: Select all

<div class="form-group">
Since we can't search multiple lines in OCMOD
but i want to place my code after MPN

Code: Select all

<div class="form-group">
                <label class="col-sm-2 control-label" for="input-mpn"><span data-toggle="tooltip" title="{{ help_mpn }}">{{ entry_mpn }}</span></label>
                <div class="col-sm-10">
                  <input type="text" name="mpn" value="{{ mpn }}" placeholder="{{ entry_mpn }}" id="input-mpn" class="form-control"/>
                </div>
              </div>
???

Code: Select all

<file path="admin/view/template/catalog/product_form.twig">
		<operation error="log" info="">
			<search><![CDATA[ <div class="tab-pane" id="tab-data"> ]]></search>
            <add position="before"><![CDATA[ <div class="form-group">
                <label class="col-sm-2 control-label" for="input-cost"><span data-toggle="tooltip" title="{{ help_cost }}">{{ entry_cost }}</span></label>
                <div class="col-sm-10">
                  <input type="text" name="cost" value="{{ cost }}" placeholder="{{ entry_cost }}" id="input-cost" class="form-control"/>
                </div>
              </div>
]]></add>
	  	</operation>
      
  </file>

Active Member

Posts

Joined
Fri Feb 05, 2021 8:29 pm

Post by ADD Creative » Tue Jun 28, 2022 12:52 am

If there is not a unique line. Either use the index attribute on the search to select the correct search line. Or use a unique line to search for and use the offset attribute on the add to add your code in the correct position.

See the examples at the link below. Also look at the vQmod documentation.
https://github.com/opencart/opencart/wi ... ion-System

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 264 guests