by mona wrote: ↑Tue Oct 19, 2021 12:14 am
To understand what is happening you have to understand what it is supposed to do.
LOCATE - this file
FIND - some code
REPLACE - use this code instead
So basically it has found he file but it has not found the code
Why? Well usually because you have another mod that has already located the same file and the same code and replaced it already.
This is not always the case, but you can check by :-
Locating the file in your system/modifications folder (the rest of the directory will be exactly as the ocmod path) - is it there? has that code been changed?
Straightlight already answered what you should do if you are unable to resolve that yourself. I just thought I would add why it might be and not to assume that it is a developers “fault” as such .. this is part of the reason that some people here would like to move towards events.
However each system has its own pluses and minuses and ocmod is a great system, as was vqmod .. again vqmod was / is better in some ways - ocmods advantage - removing the files on uninstall - but neither check for duplicated files (files used by more than one extension) on uninstall. Nothing is perfect.
Hi, Thanks for your Real answer.
as you mentioned, yes I did my ocmod "correctly" as I can see and there's no other mod using the file in question.
That's my reason of question that maybe some of you found the same kind of issues when using ocmod, In other instances, I have had to just add a comment bellow/after the code I want to replace - modify or add, and this tent to work and do the job, but in other instances, it seems that it cannot find the code needed and throw the error even though the line exists and the file is not being used or replaced by other instance.
Here's the code to avoid misunderstanding
This method doesn't work
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<name>Ship</name>
<id>ship</id>
<version>3.0.0</version>
<link>http://</link>
<author>Ship</author>
<code>ship</code>
<file path="admin/view/template/sale/order_info.twig">
<operation>
<!-- add history add tracking number and courier var -->
<search>
<![CDATA[data: 'order_status_id=' + encodeURIComponent($('select[name=\'order_status_id\']').val()) + '¬ify=' + ($('input[name=\'notify\']').prop('checked') ? 1 : 0) + '&override=' + ($('input[name=\'override\']').prop('checked') ? 1 : 0) + '&append=' + ($('input[name=\'append\']').prop('checked') ? 1 : 0) + '&comment=' + encodeURIComponent($('textarea[name=\'comment\']').val()),]]></search>
<add position="replace"><![CDATA[
data: 'order_status_id=' + encodeURIComponent($('select[name=\'order_status_id\']').val()) + '¬ify=' + ($('input[name=\'notify\']').prop('checked') ? 1 : 0) + '&override=' + ($('input[name=\'override\']').prop('checked') ? 1 : 0) + '&append=' + ($('input[name=\'append\']').prop('checked') ? 1 : 0) + '&comment=' + encodeURIComponent($('textarea[name=\'comment\']').val()) + '&tracking_number=' + encodeURIComponent($('input[name=\'tracking_number\']').val()) + '&courier_slug=' + encodeURIComponent($('select[name=\'courier_slug\']').val()),
]]></add>
</operation>
</file>
</modification>
This method works
and here's the code after doing an alteration in the original Opencart file "../order_info.twig" adding a double forward bar
before
after
Here's the code to avoid misunderstanding
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<name>Ship</name>
<id>ship</id>
<version>3.0.0</version>
<link>http://</link>
<author>Ship</author>
<code>ship</code>
<file path="admin/view/template/sale/order_info.twig">
<operation>
<!-- add history add tracking number and courier var -->
<search>
<![CDATA[//data: 'order_status_id=' + encodeURIComponent($('select[name=\'order_status_id\']').val()) + '¬ify=' + ($('input[name=\'notify\']').prop('checked') ? 1 : 0) + '&override=' + ($('input[name=\'override\']').prop('checked') ? 1 : 0) + '&append=' + ($('input[name=\'append\']').prop('checked') ? 1 : 0) + '&comment=' + encodeURIComponent($('textarea[name=\'comment\']').val()),]]></search>
<add position="replace"><![CDATA[
data: 'order_status_id=' + encodeURIComponent($('select[name=\'order_status_id\']').val()) + '¬ify=' + ($('input[name=\'notify\']').prop('checked') ? 1 : 0) + '&override=' + ($('input[name=\'override\']').prop('checked') ? 1 : 0) + '&append=' + ($('input[name=\'append\']').prop('checked') ? 1 : 0) + '&comment=' + encodeURIComponent($('textarea[name=\'comment\']').val()) + '&tracking_number=' + encodeURIComponent($('input[name=\'tracking_number\']').val()) + '&courier_slug=' + encodeURIComponent($('select[name=\'courier_slug\']').val()),
]]></add>
</operation>
</file>
</modification>
Thanks again and looking forward for your support on this matter