prestashop-在AdminStats中显示订单状态

时间:2018-08-09 14:06:33

标签: prestashop admin status

我希望状态顺序显示在AdminStats上。我创建了文件override / controllers / admin / AdminStatsController.php:

<?php // Check order status in Stats Dashboard BO class AdminStatsController extends AdminStatsControllerCore {
    public function __construct() {
        parent::__construct();
        $this->fields_list['order_statuses'] = array('title' => $this->l('Order Status');            
    }
}

但是当我进入AdminStats时,会显示一个空白页面(请参见下图)。

有什么建议吗?

enter image description here

1 个答案:

答案 0 :(得分:0)

编辑:这不是针对所问问题的解决方案。

我会做完全一样的事情。我做了这样的事情,但它是AdminOrdersController,但几乎是一样的。在这里,

// override/controllers/admin/AdminStatsController.php
<?php
public function __construct() {
    parent::__construct();
    $this->fields_list = array_merge($this->fields_list, [
       'order_statuses' => [
            'title' => $this->l('Order Status'),
            'align' => 'text-center',
            'callback' => 'orderStatusFunction', // yes, a callback to get a piece of UI back, a button maybe
            'orderby' => false, // or true, anything you'd like
            'search' => false,
            'remove_onclick' => true,
       ]
    ]);
  }
}

现在回调

<?php
public function orderStatusFunction($row_number, $row_data) // row_data like date, order, customer, etc
{
    /* do stuff with data and assign to your template */
    $view = _PS_MODULE_DIR_ . 'path/to/view/file/view.tpl';
    $html = $this->context->smarty->createTemplate($view, $this->context->smarty)->fetch();
    return $html;
}

让我知道您是否有任何困惑,或者没有解决问题。