HASNAT
HASNAT

Reputation: 133

What to Order Status in Opencart My Account page

Thanks for anyone who helps or points me in the right direction.

I want to show Order Status in opencart user (My Account) page. It will show status by status ID. My Pending Status ID:1 and I want to show only Pending Status. Other status will not appear.

<a href="#"><?php echo $order_statuses['order_status_id']; ?></a>

I put this at account.tpl but result error. Please help me.

Maybe need to modify

*english/account/account.php

controller/account/account.php

template/module/account.tpl*

My Open cart Version 1.5.6.3 with custom Theme.

Upvotes: 1

Views: 1039

Answers (1)

Tanmoy
Tanmoy

Reputation: 1035

In account.php you have add this.

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

        foreach ($results as $result) {
            $product_total = $this->model_account_order->getTotalOrderProductsByOrderId($result['order_id']);
            $voucher_total = $this->model_account_order->getTotalOrderVouchersByOrderId($result['order_id']);
            $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')
            );
        }

In account.tpl add this code

<div id="resent_order" class="recent_order">
                <a style="float:right; margin-bottom:15px;" href="<?php echo $manage_order; ?>" class="button">Manage your 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 recent orders.</li><?php }  ?>


                </ul>

            </div>

Upvotes: 2

Related Questions