Beispiel #1
0
 /**
  * Checks if delivery set used for current order is available and active.
  * Throws exception if not available
  *
  * @param oxbasket $oBasket basket object
  *
  * @return null
  */
 public function validateDelivery($oBasket)
 {
     // proceed with no delivery
     // used for other countries
     if ($oBasket->getPaymentId() == 'oxempty') {
         return;
     }
     // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
     $masterDb = oxDb::getMaster();
     $oDelSet = oxNew("oxdeliveryset");
     $sTable = $oDelSet->getViewName();
     $sQ = "select 1 from {$sTable} where {$sTable}.oxid=" . $masterDb->quote($oBasket->getShippingId()) . " and " . $oDelSet->getSqlActiveSnippet();
     // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
     if (!$masterDb->getOne($sQ)) {
         // throwing exception
         return self::ORDER_STATE_INVALIDDELIVERY;
     }
 }
 /**
  * Checks if delivery set used for current order is available and active.
  * Throws exception if not available
  *
  * @param oxbasket $oBasket basket object
  *
  * @return int
  */
 public function validateDelivery($oBasket)
 {
     if ($oBasket->getPaymentId() == 'oxidpaypal') {
         $sShippingId = $oBasket->getShippingId();
         $dBasketPrice = $oBasket->getPrice()->getBruttoPrice();
         $oUser = oxNew('oxUser');
         if (!$oUser->loadUserPayPalUser()) {
             $oUser = $this->getUser();
         }
         $iValidState = null;
         if (!$this->_isPayPalPaymentValid($oUser, $dBasketPrice, $sShippingId)) {
             $iValidState = self::ORDER_STATE_INVALIDDELIVERY;
         }
     } else {
         $iValidState = parent::validateDelivery($oBasket);
     }
     return $iValidState;
 }
Beispiel #3
0
 /**
  * Checks if delivery set used for current order is available and active.
  * Throws exception if not available
  *
  * @param oxbasket $oBasket basket object
  *
  * @return null
  */
 public function validateDelivery($oBasket)
 {
     // proceed with no delivery
     // used for other countries
     if ($oBasket->getPaymentId() == 'oxempty') {
         return;
     }
     $oDb = oxDb::getDb();
     $oDelSet = oxNew("oxdeliveryset");
     $sTable = $oDelSet->getViewName();
     $sQ = "select 1 from {$sTable} where {$sTable}.oxid=" . $oDb->quote($oBasket->getShippingId()) . " and " . $oDelSet->getSqlActiveSnippet();
     if (!$oDb->getOne($sQ, false, false)) {
         // throwing exception
         return self::ORDER_STATE_INVALIDDELIVERY;
     }
 }