/** * Check if the module is valid or not. * Returning false here will exclude the module from checkout page * Can be used for tests against cart conditions * * @return boolean */ public function check() { $blnCheckAffected = $this->checkAffected(); $blnCheckCode = $this->checkCode(); if (!$blnCheckAffected) { Yii::log(get_class($this) . ' Shipping not shown due to product restrictions', 'info', 'application.' . __CLASS__ . "." . __FUNCTION__); } if (!$blnCheckCode) { Yii::log(get_class($this) . ' Shipping not shown due to promo code on shipper', 'info', 'application.' . __CLASS__ . "." . __FUNCTION__); } if ($blnCheckAffected && $blnCheckCode) { if (!parent::check()) { Yii::log(get_class($this) . ' Shipping not shown due to geographic restrictions', 'info', 'application.' . __CLASS__ . "." . __FUNCTION__); return false; } else { return true; } } else { return false; } }
/** * We use this function to know if the payment method is allowed to be * used. * * @return bool True if we can display the payment method. False * otherwise. */ public function isDisplayable() { $allowAdvancedPayments = CPropertyValue::ensureBoolean(Yii::app()->params['ALLOW_ADVANCED_PAY_METHODS']); if ($allowAdvancedPayments === false && $this->advancedMode === true) { return false; } return parent::isDisplayable(); }
public function init() { parent::init(); Yii::import('ext.wsaccesswarning.models.*'); }