![]() 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/old/vendor/magento/module-reports/Block/Product/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Reports\Block\Product; use \Magento\Framework\DataObject\IdentityInterface; /** * Reports Recently Viewed Products Block * * @author Magento Core Team <[email protected]> * @deprecated 100.2.0 */ class Viewed extends AbstractProduct implements IdentityInterface { /** * Config path to recently viewed product count */ const XML_PATH_RECENTLY_VIEWED_COUNT = 'catalog/recently_products/viewed_count'; /** * Viewed Product Index type * * @var string */ protected $_indexType = \Magento\Reports\Model\Product\Index\Factory::TYPE_VIEWED; /** * Retrieve page size (count) * * @return int */ public function getPageSize() { if ($this->hasData('page_size')) { return $this->getData('page_size'); } return $this->_scopeConfig->getValue( self::XML_PATH_RECENTLY_VIEWED_COUNT, \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } /** * Added predefined ids support * * @return int */ public function getCount() { $ids = $this->getProductIds(); if (!empty($ids)) { return count($ids); } return parent::getCount(); } /** * Prepare to html check has viewed products * * @return string */ protected function _toHtml() { $this->setRecentlyViewedProducts($this->getItemsCollection()); return parent::_toHtml(); } /** * Return identifiers for produced content * * @return array */ public function getIdentities() { $identities = []; foreach ($this->getItemsCollection() as $item) { $identities[] = $item->getIdentities(); } return array_merge([], ...$identities); } }