Page 1 of 1

Opencart Workflow Query

Posted: Tue Jan 31, 2017 4:36 pm
by sean1123
Hi All,

I am starting to learn opencart. I am looking at the code and am wondering how was the vouchur code passed from cart to checkout page. Can anyone enlighten me ?

Thanks.

Code: Select all

?php
class ControllerCheckoutCheckout extends Controller {
	public function index() {
		// Validate cart has products and has stock.
		if ((!$this->cart->hasProducts() && empty($this->session->data['vouchers'])) || (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout'))) {
			$this->response->redirect($this->url->link('checkout/cart'));
		}

Re: Opencart Workflow Query

Posted: Wed Feb 01, 2017 2:55 pm
by knowband.plugins
When you apply a voucher code, it gets validated and then is saved in the session. Once it is saved in session, you can get it on all pages with following code.

Code: Select all

$this->session->data['vouchers']