I am trying to learn more about extensions, and how the Extension Installer works. Here is a snippet of an install.xml file that is supposed to add some lines of code to admin/view/template/sale/order_info.twig:
Code: Select all
<file path="admin/view/template/sale/order_info.twig">
<operation error="skip">
<search trim="true"><![CDATA[
{% if shipping_method %}
<tr>
<td><button data-toggle="tooltip" title="{{ text_shipping_method }}" class="btn btn-info btn-xs"><i class="fa fa-truck fa-fw"></i></button></td>
<td>{{ shipping_method }}</td>
</tr>
{% endif %}
]]></search>
<add position="after" trim="true"><![CDATA[
<!-- Added by Extension -->
<tr>
<td><button data-toggle="tooltip" title="Tracking Number" class="btn btn-info btn-xs"><i class="fa fa-plane fa-fw"></i></button></td>
<td><a href="https://tools.usps.com/go/TrackConfirmAction.action?tLabels={{ tracking }}" target="_blank">{{ tracking }}</a></td>
</tr>
<!-- End of addition -->
]]></add>
</operation>
</file>
I have updated numerous other files, and even .twig files, but this is the first time I have had a search that is looking for a snippet of code that is in an "{% if <condition> %} - {% endif %} block. Is the conditional block causing the search to fail? I must put my new code right after this conditional "{% endif %}" because the code after the "{% endif %}" is not unique, so I cannot search for the code after the "{% endif %}" and use an "add position="before" option.
Here is the code for the entire table that I am trying to add a row to. Would appreciate any suggestions:
Code: Select all
<table class="table">
<tbody>
<tr>
<td style="width: 1%;"><button data-toggle="tooltip" title="{{ text_store }}" class="btn btn-info btn-xs"><i class="fa fa-shopping-cart fa-fw"></i></button></td>
<td><a href="{{ store_url }}" target="_blank">{{ store_name }}</a></td>
</tr>
<tr>
<td><button data-toggle="tooltip" title="{{ text_date_added }}" class="btn btn-info btn-xs"><i class="fa fa-calendar fa-fw"></i></button></td>
<td>{{ date_added }}</td>
</tr>
<tr>
<td><button data-toggle="tooltip" title="{{ text_payment_method }}" class="btn btn-info btn-xs"><i class="fa fa-credit-card fa-fw"></i></button></td>
<td>{{ payment_method }}</td>
</tr>
{% if shipping_method %}
<tr>
<td><button data-toggle="tooltip" title="{{ text_shipping_method }}" class="btn btn-info btn-xs"><i class="fa fa-truck fa-fw"></i></button></td>
<td>{{ shipping_method }}</td>
</tr>
{% endif %}
</tbody>
</table>
Thanks!