用户帐户 opencart 中的用户通知

Notification for user in user account opencart

感谢任何帮助我或为我指明正确方向的人。

我想在用户登录后在他们的“我的帐户”页面上显示待处理通知。只有当他们的任何订单状态为待处理时,才会显示此通知。从管理员更改任何其他状态后将删除该通知。

此通知将显示为:

您的订单编号: 订单状态: 和 [自定义按钮 Url]

如果有多个订单则将显示多个订单ID。 我的 Open cart 版本 1.5.6.3 带有自定义主题。

    $this->load->model('account/order');
    $results = $this->model_account_order->getOrders();

    foreach ($results as $result) {
        $product_total = $this->model_account_order->getTotalOrderProductsByOrderId($result['order_id']);
        $voucher_total = $this->model_account_order->getTotalOrderVouchersByOrderId($result['order_id']);
        if( $result['status'] =! 5){ // 5 order status means its completed
            $this->data['orders'][] = array(
            'order_id'   => $result['order_id'],
            'name'       => $result['firstname'] . ' ' . $result['lastname'],
            'status'     => $result['status'],
            'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
            'products'   => ($product_total + $voucher_total),
            'total'      => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
            'href'       => $this->url->link('account/order/info', 'order_id=' . $result['order_id'], 'SSL'),
            'reorder'    => $this->url->link('account/order', 'order_id=' . $result['order_id'], 'SSL')
            );  
        }

    }

在account.tpl中添加这段代码

      <div id="resent_order" class="recent_order">
            <a style="float:right; margin-bottom:15px;" href="<?php echo $manage_order; ?>" class="button">Pending orders</a>
<h4>Recent Order</h4>
                <ul style="clear:both;">
                <?php if( isset($orders) && count($orders > 0 ) ){ 

                   foreach ($orders as $order) { ?>
                    <li>
                    <div><strong>Order:#</strong><?php echo $order['order_id']; ?></div>
                    <div><strong>Date:</strong> <?php echo $order['date_added']; ?></div>
                    <div><strong>Amount:</strong> <?php echo $order['total']; ?></div>
                    <div><strong>Status:</strong> <?php echo $order['status']; ?></div>
                    <div class="editPan"><a class="" title="Edit" href="<?php echo $order['href']; ?>">Edit</a></div>
                    </li>

                <?php }   ?>

                <?php }else{?> <li>You have no pending orders.</li><?php }  ?>


                </ul>

            </div>