将商店名称添加到OpenCart 2管理员订单列表页面

时间:2017-07-24 15:19:20

标签: php opencart opencart2.x opencart-module vqmod

我正在尝试在OpenCart的订单列表中添加商店名称。我看到了这个post并尝试修改它以显示商店名称,但它不起作用。它只显示没有结果,所以现在没有订单显示。

这是我的代码:

       <modification>
  <id><![CDATA[Show Store Name]]></id>
    <version>1</version>
    <vqmver>2.X</vqmver>
<author>author</author>

<file name="admin/view/template/sale/order_list.tpl">

    <operation>
        <search position="after"><![CDATA[
        <a href="<?php echo $sort_order; ?>"><?php echo $column_order_id; ?></a>
        ]]></search>
        <add><![CDATA[
        <!-- custom -->
                <td class="text-left">
                    <?php echo $text_store_name; ?></a>
                </td>

        <!-- custom -->
        ]]></add>
    </operation>
    <operation>
        <search position="after"><![CDATA[
        <td class="text-right"><?php echo $order['order_id']; ?></td>
        ]]></search>
        <add><![CDATA[
        <td class="text-left"><?php if(!empty($order['column_store'])){echo "CU".$order['column_store'];} else{echo "  ";} ?></td>
        ]]></add>
    </operation>

</file>

</modification>

1 个答案:

答案 0 :(得分:0)

我怀疑您遇到的问题是在2.3.0.2中,getOrders()中的admin/model/sale/order.php函数不会*查询getOrder()函数的方式确实。当我将字段store_name添加到$sql中的getOrders()查询时,显示商店有效。

我没有写过vqMod,我刚刚修改了admin/view/template/sale/order_list.tpladmin/model/sale/order.phpadmin/controller/sale/order.php,如下所示:

view/template/sale/order_list.tpl :(显然你应该修改语言文件而不是硬编码;这只是一个POC)

103,107d102
< <!-- bof mod -->
<                   <td class="text-right">
<                      Store Name
<                   </td>
< <!-- eof mod -->
147d141
<                   <td class="text-left"><?php echo $order['store_name']; ?></td>

admin/model/sale/order.php

173c173
<       $sql = "SELECT store_name, o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS order_status, o.shipping_code, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";
---
>       $sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS order_status, o.shipping_code, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";

admin/controller/sale/order.php

214d213
<               'store_name'      => $result['store_name'],