Пример #1
0
 /**
  * Returns base basket price for payment cost calculations. Price depends on
  * payment setup (payment administration)
  *
  * @param oxBasket $oBasket oxBasket object
  *
  * @return double
  */
 public function getBaseBasketPriceForPaymentCostCalc($oBasket)
 {
     $dBasketPrice = 0;
     $iRules = $this->oxpayments__oxaddsumrules->value;
     // products brutto price
     if (!$iRules || $iRules & self::PAYMENT_ADDSUMRULE_ALLGOODS) {
         $dBasketPrice += $oBasket->getProductsPrice()->getSum($oBasket->isCalculationModeNetto());
     }
     // discounts
     if ((!$iRules || $iRules & self::PAYMENT_ADDSUMRULE_DISCOUNTS) && ($oCosts = $oBasket->getTotalDiscount())) {
         $dBasketPrice -= $oCosts->getPrice();
     }
     // vouchers
     if (!$iRules || $iRules & self::PAYMENT_ADDSUMRULE_VOUCHERS) {
         $dBasketPrice -= $oBasket->getVoucherDiscValue();
     }
     // delivery
     if ((!$iRules || $iRules & self::PAYMENT_ADDSUMRULE_SHIPCOSTS) && ($oCosts = $oBasket->getCosts('oxdelivery'))) {
         if ($oBasket->isCalculationModeNetto()) {
             $dBasketPrice += $oCosts->getNettoPrice();
         } else {
             $dBasketPrice += $oCosts->getBruttoPrice();
         }
     }
     // wrapping
     if ($iRules & self::PAYMENT_ADDSUMRULE_GIFTS && ($oCosts = $oBasket->getCosts('oxwrapping'))) {
         if ($oBasket->isCalculationModeNetto()) {
             $dBasketPrice += $oCosts->getNettoPrice();
         } else {
             $dBasketPrice += $oCosts->getBruttoPrice();
         }
     }
     // gift card
     if ($iRules & self::PAYMENT_ADDSUMRULE_GIFTS && ($oCosts = $oBasket->getCosts('oxgiftcard'))) {
         if ($oBasket->isCalculationModeNetto()) {
             $dBasketPrice += $oCosts->getNettoPrice();
         } else {
             $dBasketPrice += $oCosts->getBruttoPrice();
         }
     }
     return $dBasketPrice;
 }
Пример #2
0
 /**
  * Assigns Trusted Shops Protection product id and costs
  *
  * @param oxBasket $oBasket basket object
  */
 protected function _setTsProtection(oxBasket $oBasket)
 {
     // protection price
     if ($oTsProtectionCost = $oBasket->getCosts('oxtsprotection')) {
         $this->oxorder__oxtsprotectcosts = new oxField($oTsProtectionCost->getBruttoPrice(), oxField::T_RAW);
     }
     // protection protduct id
     $this->oxorder__oxtsprotectid = new oxField($oBasket->getTsProductId(), oxField::T_RAW);
 }