/** * @return string */ protected function _toHtml() { $result = parent::_toHtml(); try { /** @var MsrpPrice $msrpPriceType */ $msrpPriceType = $this->getSaleableItem()->getPriceInfo()->getPrice('msrp_price'); } catch (\InvalidArgumentException $e) { $this->_logger->logException($e); return $this->wrapResult($result); } //Renders MAP price in case it is enabled if ($msrpPriceType->canApplyMsrp($this->getSaleableItem())) { /** @var BasePriceBox $msrpBlock */ $msrpBlock = $this->rendererPool->createPriceRender(MsrpPrice::PRICE_CODE, $this->getSaleableItem(), ['real_price_html' => $result]); $result = $msrpBlock->toHtml(); } return $this->wrapResult($result); }
/** * @return string */ protected function _toHtml() { if (!$this->getSaleableItem() || $this->getSaleableItem()->getCanShowPrice() === false) { return ''; } $result = parent::_toHtml(); try { /** @var MsrpPrice $msrpPriceType */ $msrpPriceType = $this->getSaleableItem()->getPriceInfo()->getPrice('msrp_price'); } catch (\InvalidArgumentException $e) { $this->_logger->critical($e); return $this->wrapResult($result); } //Renders MSRP in case it is enabled $product = $this->getSaleableItem(); if ($msrpPriceType->canApplyMsrp($product) && $msrpPriceType->isMinimalPriceLessMsrp($product)) { /** @var BasePriceBox $msrpBlock */ $msrpBlock = $this->rendererPool->createPriceRender(MsrpPrice::PRICE_CODE, $this->getSaleableItem(), ['real_price_html' => $result, 'zone' => $this->getZone()]); $result = $msrpBlock->toHtml(); } return $this->wrapResult($result); }