Пример #1
0
 /**
  * Returns basket object filled up with discount, delivery, wrapping and all other info
  *
  * @param bool $blStockCheck perform stock check or not (default true)
  *
  * @return oxBasket
  */
 protected function _getOrderBasket($blStockCheck = true)
 {
     $this->_oOrderBasket = oxNew("oxBasket");
     $this->_oOrderBasket->enableSaveToDataBase(false);
     //setting recalculation mode
     $this->_oOrderBasket->setCalculationModeNetto($this->isNettoMode());
     // setting stock check mode
     $this->_oOrderBasket->setStockCheckMode($blStockCheck);
     // setting virtual basket user
     $this->_oOrderBasket->setBasketUser($this->getOrderUser());
     // transferring order id
     $this->_oOrderBasket->setOrderId($this->getId());
     // setting basket currency order uses
     $aCurrencies = $this->getConfig()->getCurrencyArray();
     foreach ($aCurrencies as $oCur) {
         if ($oCur->name == $this->oxorder__oxcurrency->value) {
             $oBasketCur = $oCur;
             break;
         }
     }
     // setting currency
     $this->_oOrderBasket->setBasketCurrency($oBasketCur);
     // set basket card id and message
     $this->_oOrderBasket->setCardId($this->oxorder__oxcardid->value);
     $this->_oOrderBasket->setCardMessage($this->oxorder__oxcardtext->value);
     if ($this->_blReloadDiscount) {
         $oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC);
         // disabling availability check
         $this->_oOrderBasket->setSkipVouchersChecking(true);
         // add previously used vouchers
         $sQ = 'select oxid from oxvouchers where oxorderid = ' . $oDb->quote($this->getId());
         $aVouchers = $oDb->getAll($sQ);
         foreach ($aVouchers as $aVoucher) {
             $this->_oOrderBasket->addVoucher($aVoucher['oxid']);
         }
     } else {
         $this->_oOrderBasket->setDiscountCalcMode(false);
         $this->_oOrderBasket->setVoucherDiscount($this->oxorder__oxvoucherdiscount->value);
         $this->_oOrderBasket->setTotalDiscount($this->oxorder__oxdiscount->value);
     }
     // must be kept old delivery?
     if (!$this->_blReloadDelivery) {
         $this->_oOrderBasket->setDeliveryPrice($this->getOrderDeliveryPrice());
     } else {
         //  set shipping
         $this->_oOrderBasket->setShipping($this->oxorder__oxdeltype->value);
         $this->_oOrderBasket->setDeliveryPrice(null);
     }
     //set basket payment
     $this->_oOrderBasket->setPayment($this->oxorder__oxpaymenttype->value);
     return $this->_oOrderBasket;
 }