我在OpenCart 2的VQmod中的第一个mod正在工作,但代码被插入错误的地方。我可能错过了一些简单的东西,但它使我非常困惑。代码应该插入到<td>
中,在当前内容&关闭前的</td>
。但相反,代码出现在</td>
这里是mod:请注意搜索结束与关闭?>
php标签(&在原代码中关闭</td>
之前)
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id>customize orders page</id>
<version>1.0</version>
<vqmver>2.X</vqmver>
<author>PaulR</author>
<file name="admin/view/template/sale/order_list.tpl">
<operation info="add the card/delivery country text">
<search position="after"><![CDATA[<td class="text-left"><?php echo $order['customer']; ?>]]></search>
<add><![CDATA[<?php
$tf_style1=($order['payment_country']==$order['shipping_country']?"font-size: x-small;":"font-size: x-small; color: red;");
echo "<br /><span style='"".$tf_style1."'">".$order['payment_country']." / ".$order['shipping_country']."</span>";
?>]]></add>
</operation>
</file>
</modification>
浏览器的结果如下:你可以看到我的内容出现在</td>
<td class="text-left">Paul R</td>
<br /><span style="font-size: x-small; color: red;">United Kingdom / United States</span>
下面是原始文件中的代码片段:
<td class="text-right"><?php echo $order['order_id']; ?></td>
<td class="text-left"><?php echo $order['customer']; ?></td>
<td class="text-left"><?php echo $order['status']; ?></td>
我的修改旨在替换整行代码。
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id>customize orders page</id>
<version>1.0</version>
<vqmver>2.X</vqmver>
<author>PaulR</author>
<file name="admin/view/template/sale/order_list.tpl">
<operation info="add the card/delivery country text">
<search position="replace"><![CDATA[<td class="text-left"><?php echo $order['customer']; ?></td>]]></search>
<add><![CDATA[
<td class="text-left"><?php echo $order['customer'];
$tf_style1=($order['payment_country']==$order['shipping_country']?"font-size: x-small;":"font-size: x-small; color: red;");
echo "<br /><span style='"".$tf_style1."'">".$order['payment_country']." / ".$order['shipping_country']."</span>";
?></td>
]]></add>
</operation>
</file>
</modification>