Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Total.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Msrp\Block;
7 
14 {
18  protected $config;
19 
23  protected $msrp;
24 
31  public function __construct(
32  \Magento\Framework\View\Element\Template\Context $context,
33  \Magento\Msrp\Model\Config $config,
34  \Magento\Msrp\Model\Quote\Msrp $msrp,
35  array $data = []
36  ) {
37  parent::__construct($context, $data);
38  $this->config = $config;
39  $this->msrp = $msrp;
40  }
41 
45  protected function _toHtml()
46  {
48  $originalBlock = $this->getLayout()->getBlock($this->getOriginalBlockName());
49  $quote = $originalBlock->getQuote();
50  if (!$this->msrp->getCanApplyMsrp($quote->getId()) && $this->config->isEnabled()) {
51  $quote->collectTotals();
52  }
53  if ($this->msrp->getCanApplyMsrp($quote->getId())) {
54  $originalBlock->setTemplate('');
55  return parent::_toHtml();
56  } else {
57  return '';
58  }
59  }
60 }
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Msrp\Model\Config $config, \Magento\Msrp\Model\Quote\Msrp $msrp, array $data=[])
Definition: Total.php:31
$quote