protected function _validateBuyRequest(Varien_Object $buyRequest, $product, $processMode) { $isStrictProcessMode = true; if (method_exists(get_parent_class($this), '_isStrictProcessMode')) { $isStrictProcessMode = $this->_isStrictProcessMode($processMode); } if (!$buyRequest->getAwGcRecipientName() && $isStrictProcessMode) { Mage::throwException(Mage::helper('aw_giftcard')->__('Please specify recipient name.')); return false; } if (!$buyRequest->getAwGcSenderName() && $isStrictProcessMode) { Mage::throwException(Mage::helper('aw_giftcard')->__('Please specify sender name.')); return false; } if ($this->isTypeVirtual($product) || $this->isTypeCombined($product)) { if (!$buyRequest->getAwGcRecipientEmail() && $isStrictProcessMode) { Mage::throwException(Mage::helper('aw_giftcard')->__('Please specify recipient email.')); return false; } if (!$buyRequest->getAwGcSenderEmail() && $isStrictProcessMode) { Mage::throwException(Mage::helper('aw_giftcard')->__('Please specify sender email.')); return false; } } if (!$buyRequest->getAwGcSendVia() && $isStrictProcessMode) { Mage::throwException(Mage::helper('aw_giftcard')->__('Please specify gift card sending medium.')); return false; } if ($buyRequest->getAwGcSendVia() == "post") { if (!$buyRequest->getAwGcAddress1()) { Mage::throwException(Mage::helper('aw_giftcard')->__('Please specify address line 1.')); return false; } /*if(!$buyRequest->getAwGcAddress2()) { Mage::throwException( Mage::helper('aw_giftcard')->__('Please specify address line 2.') ); return false; }*/ if (!$buyRequest->getAwGcCity()) { Mage::throwException(Mage::helper('aw_giftcard')->__('Please specify city.')); return false; } if (!$buyRequest->getAwGcCountry()) { Mage::throwException(Mage::helper('aw_giftcard')->__('Please specify country.')); return false; } if (!$buyRequest->getAwGcState()) { Mage::throwException(Mage::helper('aw_giftcard')->__('Please specify state.')); return false; } if (!$buyRequest->getAwGcZip()) { Mage::throwException(Mage::helper('aw_giftcard')->__('Please specify zip.')); return false; } if (!$buyRequest->getAwGcTelephone()) { Mage::throwException(Mage::helper('aw_giftcard')->__('Please specify telephone.')); return false; } } return true; }