Post by sean1123 » Tue Jan 31, 2017 4:36 pm

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'));
		}

Newbie

Posts

Joined
Mon Jan 30, 2017 11:33 pm

Post by knowband.plugins » Wed Feb 01, 2017 2:55 pm

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']

Regards,
Knowband Team

Opencart Plugins: Knowband Store
Email: support@knowband.com


User avatar
Active Member

Posts

Joined
Thu Aug 04, 2016 2:56 pm

Who is online

Users browsing this forum: No registered users and 22 guests