vendor/elements/ticket-shop-framework-bundle/src/Ecommerce/PricingManager/PriceInfo.php line 64

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by Elements.at New Media Solutions GmbH
  4.  *
  5.  */
  6. namespace Elements\Bundle\TicketShopFrameworkBundle\Ecommerce\PricingManager;
  7. use Elements\Bundle\TicketShopFrameworkBundle\Ecommerce\PriceSystem\PackagePriceInfo;
  8. use Pimcore\Bundle\EcommerceFrameworkBundle\PriceSystem\PriceInfoInterface;
  9. use Pimcore\Bundle\EcommerceFrameworkBundle\PriceSystem\PriceInterface;
  10. use Pimcore\Bundle\EcommerceFrameworkBundle\Type\Decimal;
  11. class PriceInfo extends \Pimcore\Bundle\EcommerceFrameworkBundle\PricingManager\PriceInfo
  12. {
  13.     /**
  14.      * @var Decimal|null
  15.      */
  16.     protected $baseAmount;
  17.     /**
  18.      * @return PriceInfoInterface
  19.      */
  20.     public function getOriginalPriceInfo(): PriceInfoInterface
  21.     {
  22.         return $this->priceInfo;
  23.     }
  24.     public function getOriginalPrice(): PriceInterface
  25.     {
  26.         if ($this->priceInfo instanceof PackagePriceInfo) {
  27.             return $this->priceInfo->getOriginalPrice();
  28.         }
  29.         return parent::getOriginalPrice();
  30.     }
  31.     /**
  32.      * @return Decimal|null
  33.      */
  34.     public function getBaseAmount(): ?Decimal
  35.     {
  36.         return $this->baseAmount;
  37.     }
  38.     /**
  39.      * @param Decimal $baseAmount
  40.      *
  41.      * @return PriceInfo
  42.      */
  43.     public function setBaseAmount(Decimal $baseAmount): PriceInfo
  44.     {
  45.         $this->baseAmount $baseAmount;
  46.         return $this;
  47.     }
  48.     /**
  49.      * returns base price of product (without subitems prices)
  50.      */
  51.     public function getBasePrice(): ?PriceInterface
  52.     {
  53.         $this->getPrice();
  54.         if ($this->priceInfo instanceof PackagePriceInfo) {
  55.             $price = clone $this->priceInfo->getBaseProductPrice();
  56.         } else {
  57.             $price = clone $this->priceInfo->getPrice();
  58.         }
  59.         if ($price == null) {
  60.             return null;
  61.         }
  62.         $amount $this->getBaseAmount() ?: $this->getAmount();
  63.         $price->setGrossAmount($amounttruetrue);
  64.         return $price;
  65.     }
  66.     public function getRules(bool $forceRecalc false): array
  67.     {
  68.         $rules =  parent::getRules($forceRecalc);
  69.         return $rules;
  70.     }
  71. }