Post by skydatabg » Thu Jun 21, 2018 7:53 pm

Hello,

I just want to make two different success page variants depending on the order status.

I'm planning to edit the language file for the success page. So I will add new message like the older one.

If the order status is "pending" the success page must use the first message.

If the order status is "canceled" the success page must use the second one.

My OpenCart version is 3.0.2

I'm working in /catalog/controller/checkout/success.php line 47

Code: Select all

		
if ($this->customer->isLogged()) {
	$data['text_message'] = sprintf($this->language->get('text_customer'), $this->url->link('account/account', '', true), $this->url->link('account/order', '', true), $this->url->link('account/download', '', true), $this->url->link('information/contact'));
} else {
	$data['text_message'] = sprintf($this->language->get('text_guest'), $this->url->link('information/contact'));
}

First I need to catch the order status through PHP, then I need to edit code shown above.

Please help me to do that.

Thanks

Newbie

Posts

Joined
Tue Feb 06, 2018 4:03 pm

Post by straightlight » Thu Jun 21, 2018 10:42 pm

In the success.php file, above the unset commands, you could imply:

Code: Select all

if (!empty($this->session->data['order_id'])) {
    $this->load->model('checkout/order');
    
    $order_complete_statuses = $this->config->get('config_complete_status');
    
    $order_processing_statuses = $this->config->get('config_processing_status');
    
    $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
    
    if (in_array($order_info['order_status_id'], $order_complete_statuses)) {
        
    } elseif (in_array($order_info['order_status_id'], $order_processing_statuses)) {
        
    } elseif (!empty($order_info['order_status_id']) && $order_info['order_status_id'] == $this->config->get('config_order_status_id')) {
    
    } elseif (!empty($order_info['order_status_id']) && $order_info['order_status_id'] == $this->config->get('config_fraud_status_id')) {
    
    } elseif (!empty($order_info['order_status_id']) && $order_info['order_status_id'] == $this->config->get('config_return_status_id')) {
    
    }
}
All the conditional IF statements with the core's store settings regarding the order statuses IDs you could use with your code above.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 49 guests