registry = $registry; parent::__construct($context, $data); } /** * Produce and return block's html output * * @return string */ protected function _toHtml() { /** @var PricingRender $priceRender */ $priceRender = $this->getLayout()->getBlock($this->getPriceRender()); if ($priceRender instanceof PricingRender) { $product = $this->getProduct(); if ($product instanceof SaleableInterface) { $arguments = $this->getData(); $arguments['render_block'] = $this; return $priceRender->render($this->getPriceTypeCode(), $product, $arguments); } } return parent::_toHtml(); } /** * Returns saleable item instance * * @return Product */ protected function getProduct() { $parentBlock = $this->getParentBlock(); $product = $parentBlock && $parentBlock->getProductItem() ? $parentBlock->getProductItem() : $this->registry->registry('product'); return $product; } }