Customer email address to success.tpl in OpenCart

It can be done using the following code;

/catalog/controller/checkout/success.php

$this->load->model(‘account/order’);
$order = $this->model_account_order->getOrder($this->session->data[‘order_id’]);
if($order) {
$this->data[’email’] = $order[’email’];
}

 

In your template /catalog/view/theme/your-theme-name/template/common/success.tpl you need to put

<?php if(!empty($email)) echo $email; ?>

Advertisements