![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/app/code/Smartwave/Porto/Block/ |
<?php namespace Smartwave\Porto\Block; class RickSnippet extends \Magento\Framework\View\Element\Template { protected $_coreRegistry; protected $_imageBuilder; protected $_reviewSummaryFactory; public function __construct(\Magento\Catalog\Block\Product\Context $productContext, \Magento\Review\Model\Review\SummaryFactory $reviewSummaryFactory, \Magento\Framework\View\Element\Template\Context $context, array $data = []) { $this->_coreRegistry = $productContext->getRegistry(); $this->_reviewSummaryFactory = $reviewSummaryFactory; $this->_imageBuilder = $productContext->getImageBuilder(); parent::__construct($context, $data); } public function getProduct() { return $this->_coreRegistry->registry('product'); } public function getImage($product, $imageId, $attributes = []) { return $this->_imageBuilder->setProduct($product) ->setImageId($imageId) ->setAttributes($attributes) ->create(); } public function getReviewSummary() { $storeId = $this->_storeManager->getStore()->getId(); $reviewSummary = $this->_reviewSummaryFactory->create(); $reviewSummary->setData('store_id', $storeId); $summaryModel = $reviewSummary->load($this->getProduct()->getId()); return $summaryModel; } public function getCurrencyCode() { return $this->_storeManager->getStore()->getCurrentCurrencyCode(); } }