将运输方法添加到Opencart 2.0.2.0

时间:2015-11-21 21:38:22

标签: php xml opencart opencart2.x

我有这个与Opencart 1.5一起使用的代码,它将运输方法添加到订单列表中,我已将其更改为快递运输上的标记,但我真的不知道我缺少什么使其适用于Opencart 2.0。

<modification>
    <id>Shipmethod</id>
    <version>1.0.</version>
    <vqmver>2.1.x</vqmver>
    <author></author>
    <file name="admin/model/sale/order.php">
        <operation>
            <search position="replace" regex="true"><![CDATA[~SELECT o.order_id,~]]></search>
            <add><![CDATA[SELECT o.order_id, o.shipping_method,]]></add>
        </operation>
    </file>
    <file name="admin/controller/sale/order.php">
        <operation>
            <search position="before"><![CDATA['action'        => $action]]></search>
            <add><![CDATA['shipping_method'  => $result['shipping_method'],]]></add>
        </operation>
    </file>
    <file name="admin/view/template/sale/order_list.tpl">
        <operation>
            <search position="before"><![CDATA[<td class="left"><?php if ($sort == 'o.date_added') { ?>]]></search>
            <add><![CDATA[
              <td style="width:125px">Express Shipping</td>
            ]]></add>
        </operation>
        <operation>
            <search position="before"><![CDATA[<td><input type="text" name="filter_date_added"]]></search>
            <add><![CDATA[<td></td>]]></add>
        </operation>

        <operation>
            <search position="before"><![CDATA[<td class="left"><?php echo $order['date_added']; ?></td>]]></search>
            <add><![CDATA[<td class="left" style="color:red;"><?php if ($order['shipping_method'] === "3. UK Express Delivery") {echo "YES";};?></td>
]]></add>
        </operation>
    </file>
</modification>

任何使其适用于Opencart 2.0的帮助都会很棒:)

1 个答案:

答案 0 :(得分:0)

仅供参考,Opencart v2.0.0.0与1.5.6.4或更低版本略有不同。 所以你必须修改你的vqmod xml文件。您可以查看以下代码

<modification>
<id>Shipmethod</id>
<version>1.0.</version>
<vqmver>2.1.x</vqmver>
<author></author>
<file name="admin/model/sale/order.php">
    <operation>
        <search position="replace" regex="true"><![CDATA[~SELECT o.order_id,~]]></search>
        <add><![CDATA[SELECT o.order_id, o.shipping_method,]]></add>
    </operation>
</file>
<file name="admin/controller/sale/order.php">
    <operation>
        <search position="before"><![CDATA['status'        => $result['status'],]]></search>
        <add><![CDATA['shipping_method'  => $result['shipping_method'],]]></add>
    </operation>
</file>
<file name="admin/view/template/sale/order_list.tpl">
    <operation>
        <search position="before" offset="0"><![CDATA[<td class="text-left"><?php if ($sort == 'status') { ?>]]></search>
        <add><![CDATA[
          <td style="width:125px">Express Shipping</td>
        ]]></add>
    </operation>

    <operation>
        <search position="before"><![CDATA[<td class="text-left"><?php echo $order['status']; ?></td>]]></search>
        <add><![CDATA[<td class="left" style="color:red;"><?php if ($order['shipping_method'] === "Flat Shipping Rate") {echo "YES";};?></td>
]]></add>
    </operation>
</file>