/ Gists / Workaround
On gists

Workaround

AW

selection-workaround.php Raw #

<?php

	public function filterAllowedPayments(&$payments)
	{
		// pokud je v kosiku la degustacion nelze platit kartou
		if ($this->isLDBBInBasket() && isset($payments[2])) {
			// $payments->where('NOT id', 2);
			unset($payments[2]);
		}

		// pokud je v kosiku merche, neumoznime platbu kartou pri prevzeti
		if ($this->isMerchInBasket() && isset($payments[4])) {
			// $payments->where('NOT id', 4);
			unset($payments[4]);
		}

		if (!$this->isLDBBInBasket() && isset($payments[4])) {
			unset($payments[4]);
		}

	}

	public function filterAllowedTransports(&$transports)
	{
		// pokud v kosiku neni merche, nelze vyzvednout v ambi kancelari
		if (!$this->isMerchInBasket() && isset($transports[2047])) {
			// $transports->where('NOT id', 2047);
			unset($transports[2047]);
		}
	}

usage.php Raw #

<?php

.
.
.

	$this->modelWorkaround->filterAllowedPayments($this->template->paymentTypes); // reference
	$this->modelWorkaround->filterAllowedTransports($this->template->transportTypes); // reference
	
.
.
.