PriceBox.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\Msrp\Pricing\Render;
  8. use Magento\Catalog\Model\Product;
  9. use Magento\Framework\Json\Helper\Data;
  10. use Magento\Framework\Math\Random;
  11. use Magento\Framework\Pricing\Price\PriceInterface;
  12. use Magento\Framework\Pricing\Render\RendererPool;
  13. use Magento\Framework\View\Element\Template\Context;
  14. use Magento\Msrp\Pricing\MsrpPriceCalculatorInterface;
  15. /**
  16. * MSRP price box render.
  17. */
  18. class PriceBox extends \Magento\Catalog\Pricing\Render\PriceBox
  19. {
  20. /**
  21. * @var MsrpPriceCalculatorInterface
  22. */
  23. private $msrpPriceCalculator;
  24. /**
  25. * Constructor
  26. *
  27. * @param Context $context
  28. * @param Product $saleableItem
  29. * @param PriceInterface $price
  30. * @param RendererPool $rendererPool
  31. * @param Data $jsonHelper
  32. * @param Random $mathRandom
  33. * @param MsrpPriceCalculatorInterface $msrpPriceCalculator
  34. */
  35. public function __construct(
  36. Context $context,
  37. Product $saleableItem,
  38. PriceInterface $price,
  39. RendererPool $rendererPool,
  40. Data $jsonHelper,
  41. Random $mathRandom,
  42. MsrpPriceCalculatorInterface $msrpPriceCalculator
  43. ) {
  44. $this->msrpPriceCalculator = $msrpPriceCalculator;
  45. parent::__construct($context, $saleableItem, $price, $rendererPool, $jsonHelper, $mathRandom);
  46. }
  47. /**
  48. * Return MSRP price calculator.
  49. *
  50. * @return MsrpPriceCalculatorInterface
  51. */
  52. public function getMsrpPriceCalculator(): MsrpPriceCalculatorInterface
  53. {
  54. return $this->msrpPriceCalculator;
  55. }
  56. }