예제 #1
0
파일: Create.php 프로젝트: shabirm/avatax
 /**
  * Overrides the parent to validate the shipping address.
  *
  * @param array $address
  * @return $this
  * @throws OnePica_AvaTax_Exception
  */
 public function setShippingAddress($address)
 {
     parent::setShippingAddress($address);
     if ($this->getQuote()->getIsVirtual()) {
         return $this;
     }
     if (Mage::helper('avatax')->isAvataxEnabled()) {
         if (!Mage::app()->getFrontController()->getRequest()->getParam('isAjax')) {
             $result = $this->getShippingAddress()->validate();
             if ($result !== true) {
                 $storeId = $this->_session->getStore()->getId();
                 if (Mage::helper('avatax')->fullStopOnError($storeId)) {
                     foreach ($result as $error) {
                         $this->getSession()->addError($error);
                     }
                     throw new OnePica_AvaTax_Exception(implode('<br />', $result));
                 }
             } elseif ($this->getShippingAddress()->getAddressNormalized() && !$this->_messageAdded) {
                 Mage::getSingleton('avatax/session')->addNotice(Mage::helper('avatax')->__('The shipping address has been modified during the validation process. Please confirm the address below is accurate.'));
                 $this->_messageAdded = true;
                 // only add the message once
             }
         }
     }
     return $this;
 }
예제 #2
0
파일: Create.php 프로젝트: onepica/avatax
 /**
  * Overrides the parent to validate the shipping address.
  *
  * @param array $address
  * @return $this
  */
 public function setShippingAddress($address)
 {
     parent::setShippingAddress($address);
     if ($this->getQuote()->getIsVirtual()) {
         return $this;
     }
     if (!$this->_isAjaxRequest()) {
         $this->_validateShippingAddress();
     }
     return $this;
 }
예제 #3
0
 public function setShippingAddress($address)
 {
     parent::setShippingAddress($address);
     if (!Mage::app()->getFrontController()->getRequest()->getParam('isAjax')) {
         $result = $this->getShippingAddress()->validate();
         if ($result !== true) {
             $storeId = $this->_session->getStore()->getId();
             if (Mage::helper('advanced')->fullStopOnError($storeId)) {
                 foreach ($result as $error) {
                     $this->getSession()->addError($error);
                 }
                 Mage::throwException('');
             }
         } else {
             if ($this->getShippingAddress()->getAddressNormalized() && !$this->_messageAdded) {
                 Mage::getSingleton('advanced/session')->addNotice(Mage::helper('advanced')->__('The shipping address has been modified during the validation process.  Please confirm the address below is accurate.'));
                 $this->_messageAdded = true;
                 // only add the message once
             }
         }
     }
     return $this;
 }