public function actionConfirmation() { // We should only be in here if someone has chosen a SIM. $this->checkoutForm = MultiCheckoutForm::loadFromSessionOrNew(); $this->layout = '/layouts/checkout-confirmation'; $objCart = Yii::app()->shoppingcart; $error = null; if (isset($_POST['MultiCheckoutForm'])) { $this->checkoutForm->attributes = $_POST['MultiCheckoutForm']; if ($objCart->shipping->isStorePickup) { $this->checkoutForm->setScenario('ConfirmationStorePickup'); } else { $this->checkoutForm->setScenario('ConfirmationSim'); } $isFormValid = $this->checkoutForm->updateCartCustomerId() && $this->checkoutForm->validate(); if ($isFormValid && Yii::app()->shoppingcart->wasCartModified === false) { // our form is valid and the cart items are as we expect, continue self::executeCheckoutProcessInit(); $this->runPaymentSim(); } else { $this->layout = '/layouts/checkout-confirmation'; $this->render('confirmation', array('model' => $this->checkoutForm, 'cart' => $objCart, 'error' => $this->formatErrors(), 'shippingEstimatorOptions' => $this->_getShippingEstimatorOptions(), 'recalculateShippingOnLoad' => Yii::app()->shoppingcart->wasCartModified)); } } else { $orderId = Yii::app()->getRequest()->getQuery('orderId'); $errorNote = Yii::app()->getRequest()->getQuery('errorNote'); if (isset($errorNote) && isset($orderId)) { // Cancelled/Declined simple integration transaction. $objCart = Cart::LoadByIdStr($orderId); if (stripos($errorNote, 'cancel') !== false) { // Cancelled. $translatedErrorNote = Yii::t('checkout', 'You <strong>cancelled</strong> your payment.'); } else { // Declined. $translatedErrorNote = Yii::t('checkout', 'There was an issue with your payment.') . '<br><br><strong>' . $errorNote . '</strong><br><br>'; $translatedErrorNote .= Yii::t('checkout', 'Try re-entering your payment details or contact us at {email} or {phone}', array('{email}' => _xls_get_conf('EMAIL_FROM'), '{phone}' => _xls_get_conf('STORE_PHONE'))); } $this->checkoutForm->addErrors(array('note' => $translatedErrorNote)); } $this->render('confirmation', array('model' => $this->checkoutForm, 'cart' => $objCart, 'shippingEstimatorOptions' => $this->_getShippingEstimatorOptions(), 'error' => $this->formatErrors())); } }