FinalPriceBox.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Bundle\Pricing\Render;
  7. use Magento\Bundle\Pricing\Price\FinalPrice;
  8. use Magento\Catalog\Pricing\Price\CustomOptionPrice;
  9. use Magento\Catalog\Pricing\Render as CatalogRender;
  10. /**
  11. * Class for final_price rendering
  12. */
  13. class FinalPriceBox extends CatalogRender\FinalPriceBox
  14. {
  15. /**
  16. * Check if bundle product has one or more options, or custom options, with different prices
  17. *
  18. * @return bool
  19. */
  20. public function showRangePrice()
  21. {
  22. /** @var FinalPrice $bundlePrice */
  23. $bundlePrice = $this->getPriceType(FinalPrice::PRICE_CODE);
  24. $showRange = $bundlePrice->getMinimalPrice() != $bundlePrice->getMaximalPrice();
  25. if (!$showRange) {
  26. //Check the custom options, if any
  27. /** @var \Magento\Catalog\Pricing\Price\CustomOptionPrice $customOptionPrice */
  28. $customOptionPrice = $this->getPriceType(CustomOptionPrice::PRICE_CODE);
  29. $showRange =
  30. $customOptionPrice->getCustomOptionRange(true) != $customOptionPrice->getCustomOptionRange(false);
  31. }
  32. return $showRange;
  33. }
  34. }