For some reason, ocmod incorrectly handles opencart 2.3. So here's what I do in install.xml:

<file path="catalog/view/theme/*/template/checkout/shipping_method.tpl"> <operation> <search position="before"><![CDATA[<?php foreach ($shipping_method['quote'] as $quote) { ?>]]></search> <add><![CDATA[ <?php if($shipping_method['code'] == "onedel"):?> <?php echo $onedel_content;?> <?php endif;?> ]]></add> </operation> </file> 

I specify position before (with after the same result), I end up with my content in the modified file, but the search line is deleted.

Here is the source:

 <?php if (!$shipping_method['error']) { ?> <?php foreach ($shipping_method['quote'] as $quote) { ?> <div class="radio"> 

but after the modification:

 <?php if (!$shipping_method['error']) { ?> <?php if($shipping_method['code'] == "onedel"):?> <?php echo $onedel_content;?> <?php endif;?> <div class="radio"> 

I do not understand why the desired string is deleted. There are also replacements in install.xml with position = "before", everything is ok. On the docks I read about the offset parameter in the add tag, I added it - it did not help. Ideas have ended ... What is the reason for this behavior? There are no errors in the extension-modification logs.

  • No more modifier with this string works? - Alexander Semikashev
  • Not. Moreover, no changes occur to this file shipping_method.tpl anymore. - askuzenkov
  • After adding a modifier, the cache was updated and "update modifiers" was followed? - Alexander Semikashev

1 answer 1

You did not write correctly.

 <file path="catalog/view/theme/*/template/checkout/shipping_method.tpl"> <operation> <search><![CDATA[<?php foreach ($shipping_method['quote'] as $quote) { ?>]]></search> <add position="before"><![CDATA[ <?php if($shipping_method['code'] == "onedel"):?> <?php echo $onedel_content;?> <?php endif;?> ]]></add> </operation> </file> 

Search - <search trim="true|flase" index="0|1|2...">

Syntax add - <add position="before|after|replace" trim="true|flase" offset="0|1|2..">

  • for sure! it. Thank you very much. - askuzenkov