After upgrade from 2.3.4 to 2.3.5 got compilation error with module
-
14-04-2021 - |
문제
I am trying couple of hours to figure out what is wrong with this constructor and have no idea
namespace Aitoc\ProductFileAttachments\Block\Product;
use Aitoc\ProductFileAttachments\Model\ResourceModel\Attachments\CollectionFactory as AttachmentsCollectionFactory;
use Aitoc\ProductFileAttachments\Helper\Data;
use Aitoc\ProductFileAttachments\Model\ResourceModel\Icons\CollectionFactory as IconsCollectionFactory;
use Aitoc\ProductFileAttachments\Model\ResourceModel\Order\CollectionFactory as OrderCollectionFactory;
use Magento\CatalogWidget\Block\Product\ProductsList;
use Magento\Catalog\Block\Product\Context;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
use Magento\Catalog\Model\Product\Visibility;
use Magento\Framework\App\Http\Context as ContextHttp;
use Magento\Rule\Model\Condition\Sql\Builder;
use Magento\CatalogWidget\Model\Rule;
use Magento\Widget\Helper\Conditions;
use Magento\Customer\Model\SessionFactory;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Registry;
use Magento\Store\Model\StoreManagerInterface;
use Aitoc\ProductFileAttachments\Model\ResourceModel\AttachmentAttributes\Collection as AttachmentAttributesCollection;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;
class Attachments extends ProductsList
{
/**
* Global setting
*/
const DISPLAY_IF_ORDERED = 'product_file_attachments/general_settings/display_if_ordered';
/**
* @var AttachmentsCollectionFactory
*/
private $attachmentsCollectionFactory;
/**
* @var Data
*/
private $helper;
/**
* @var SessionFactory
*/
private $customerSessionFactory;
/**
* @var ResourceConnection
*/
private $resource;
/**
* @var OrderCollectionFactory
*/
private $orderCollectionFactory;
/**
* @var IconsCollectionFactory
*/
private $iconsCollectionFactory;
/**
* @var StoreManagerInterface
*/
private $storeManager;
/**
* @var Registry
*/
private $registry;
/**
* @var AttachmentAttributesCollection
*/
private $attachmentAttributesCollection;
/**
* @var ScopeConfigInterface
*/
private $scopeConfig;
/**
* Product collection factory
*
* @var \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory
*/
protected $productCollectionFactory;
/**
* @param Context $context
* @param CollectionFactory $productCollectionFactory
* @param Visibility $catalogProductVisibility
* @param ContextHttp $httpContext
* @param Builder $sqlBuilder
* @param Rule $rule
* @param Conditions $conditionsHelper
* @param attachmentAttributesCollection $attachmentAttributesCollection
* @param AttachmentsCollectionFactory $attachmentsCollectionFactory
* @param SessionFactory $customerSessionFactory
* @param OrderCollectionFactory $orderCollectionFactory
* @param ResourceConnection $resource
* @param IconsCollectionFactory $iconsCollectionFactory
* @param Data $helper
* @param ScopeConfigInterface $scopeConfig
* @param array $data
*/
public function __construct(
Context $context,
CollectionFactory $productCollectionFactory,
Visibility $catalogProductVisibility,
ContextHttp $httpContext,
Builder $sqlBuilder,
Rule $rule,
Conditions $conditionsHelper,
AttachmentAttributesCollection $attachmentAttributesCollection,
AttachmentsCollectionFactory $attachmentsCollectionFactory,
SessionFactory $customerSessionFactory,
OrderCollectionFactory $orderCollectionFactory,
ResourceConnection $resource,
IconsCollectionFactory $iconsCollectionFactory,
Data $helper,
ScopeConfigInterface $scopeConfig,
array $data = []
) {
$this->attachmentsCollectionFactory = $attachmentsCollectionFactory;
$this->registry = $context->getRegistry();
$this->helper = $helper;
$this->attachmentAttributesCollection = $attachmentAttributesCollection;
$this->customerSessionFactory = $customerSessionFactory;
$this->orderCollectionFactory = $orderCollectionFactory;
$this->resource = $resource;
$this->iconsCollectionFactory = $iconsCollectionFactory;
$this->storeManager = $context->getStoreManager();
$this->scopeConfig = $scopeConfig;
$this->productCollectionFactory = $productCollectionFactory;
parent::__construct($context, $productCollectionFactory, $catalogProductVisibility, $httpContext, $sqlBuilder, $rule, $conditionsHelper, $data);
}
/**
* Disable attachment block cache
*/
protected function _construct()
{
$this->addData(
[
'cache_lifetime' => false,
'cache_tags' => ['Attachments'],
]
);
}
/**
* @return array
*/
public function createCollection()
{
$currentProduct = $this->registry->registry('product');
$storeId = $this->storeManager->getStore()->getStoreId();
if ($currentProduct) {
$productId = $currentProduct->getId();
$attachmentsCollection = $this->attachmentsCollectionFactory->create();
$attachmentsCollection->addFieldToFilter('product_id', $productId);
$attachmentsArray = [];
foreach ($attachmentsCollection as $attachmentItem) {
$attachmentId = $attachmentItem->getId();
$attachmentAttributesCollection = $this->attachmentAttributesCollection;
$attachmentAttributesCollection->clear()->getSelect()->reset(\Zend_Db_Select::WHERE);
$attachmentAttributesCollection->addFieldToFilter('file_id', $attachmentId);
if ($storeId != '0') {
$attachmentAttributesCollection->addFieldToFilter('store_id', ['eq' => $storeId]);
if (count($attachmentAttributesCollection->getAllIds()) == 0) {
$attachmentAttributesCollection->clear()->getSelect()->reset(\Zend_Db_Select::WHERE);
$attachmentAttributesCollection->addFieldToFilter('file_id', $attachmentId);
$attachmentAttributesCollection->addFieldToFilter('store_id', ['eq' => '0']);
}
} else {
$attachmentAttributesCollection->addFieldToFilter('store_id', ['eq' => '0']);
}
foreach ($attachmentAttributesCollection as $item) {
$attributeId = $item->getId();
$itemVisible = $item->getVisible();
$itemIsOrdered = $item->getIsOrdered();
$itemExpansion = pathinfo($attachmentItem->getFile());
if (array_key_exists('extension', $itemExpansion)) {
$itemExpansion = $itemExpansion['extension'];
} else {
$itemExpansion = 'link';
}
if ($itemVisible) {
$iconItem = $this->getIconByExpansion($itemExpansion);
$attachmentsArray = $this->checkVisibility($iconItem, $item, $itemIsOrdered, $productId, $attachmentsArray, $attachmentId, $attributeId);
}
}
}
return $attachmentsArray;
}
}
/**
* @param int $productId
* @param int $currentCustomerId
* @return bool
*/
public function isProductOrdered($productId, $currentCustomerId)
{
$salesOrdersCollection = $this->orderCollectionFactory->create();
$salesOrdersCollection->isOrdered();
$salesOrdersCollection->addFieldToFilter('product_id', $productId)
->addFieldToFilter('customer_id', $currentCustomerId);
return (bool)$salesOrdersCollection->load()->count();
}
/**
* @param array $iconItem
* @param AttachmentsCollectionFactory $item
* @param bool $itemIsOrdered
* @param int $productId
* @param array $attachmentsArray
* @return array
*/
public function checkVisibility($iconItem, $item, $itemIsOrdered, $productId, $attachmentsArray, $attachmentId, $attributeId)
{
$needCustomerGroupIds = $this->helper->getCustomerGroupValidation($attributeId);
$customerSession = $this->customerSessionFactory->create();
if ($customerSession->isLoggedIn()) {
$currentCustomerGroup = $customerSession->getCustomer()->getGroupId();
$currentCustomerId = $customerSession->getCustomer()->getId();
} else {
$currentCustomerGroup = '0';
$currentCustomerId = '0';
}
if (count($needCustomerGroupIds) && in_array($currentCustomerGroup, $needCustomerGroupIds)) {
$globalIsOrdered = $this->scopeConfig->getValue(self::DISPLAY_IF_ORDERED, ScopeInterface::SCOPE_STORE) ?: [];
if ($itemIsOrdered || $globalIsOrdered) {
$isOrdered = $this->isProductOrdered($productId, $currentCustomerId);
if ($isOrdered) {
$attachmentsArray[$attachmentId] = $item->getData();
}
} else {
$attachmentsArray[$attachmentId] = $item->getData();
}
}
if (array_key_exists($attachmentId, $attachmentsArray)) {
$attachmentsArray[$attachmentId]['icon'] = $iconItem;
}
return $attachmentsArray;
}
/**
* @param string $itemExpansion
* @return string
*/
public function getIconByExpansion($itemExpansion)
{
$iconsCollection = $this->iconsCollectionFactory->create();
$iconsCollection->addFieldToFilter('expansion', $itemExpansion);
$iconsItems = $iconsCollection->getItems();
if ($iconsItems) {
foreach ($iconsItems as $iconItem) {
$iconItem = $iconItem->getFile();
}
} else {
$iconItem = '';
}
$iconsCollection->clear()->getSelect()->reset(\Zend_Db_Select::WHERE);
return $iconItem;
}
}
The class it is extending: vendor/magento/module-catalog-widget/Block/Product/ProductsList.php
namespace Magento\CatalogWidget\Block\Product;
use Magento\Catalog\Api\CategoryRepositoryInterface;
use Magento\Catalog\Block\Product\AbstractProduct;
use Magento\Catalog\Block\Product\Widget\Html\Pager;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Visibility;
use Magento\Catalog\Model\ResourceModel\Product\Collection;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
use Magento\Catalog\Pricing\Price\FinalPrice;
use Magento\CatalogWidget\Model\Rule;
use Magento\Framework\App\ActionInterface;
use Magento\Framework\App\Http\Context;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\Serialize\Serializer\Json;
use Magento\Framework\Url\EncoderInterface;
use Magento\Framework\View\LayoutFactory;
use Magento\Framework\View\LayoutInterface;
use Magento\Rule\Model\Condition\Combine;
use Magento\Rule\Model\Condition\Sql\Builder;
use Magento\Widget\Block\BlockInterface;
use Magento\Widget\Helper\Conditions;
/**
* Catalog Products List widget block
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
class ProductsList extends AbstractProduct implements BlockInterface, IdentityInterface
{
/**
* Default value for products count that will be shown
*/
const DEFAULT_PRODUCTS_COUNT = 10;
/**
* Name of request parameter for page number value
*
* @deprecated @see $this->getData('page_var_name')
*/
const PAGE_VAR_NAME = 'np';
/**
* Default value for products per page
*/
const DEFAULT_PRODUCTS_PER_PAGE = 5;
/**
* Default value whether show pager or not
*/
const DEFAULT_SHOW_PAGER = false;
/**
* Instance of pager block
*
* @var Pager
*/
protected $pager;
/**
* @var Context
*/
protected $httpContext;
/**
* Catalog product visibility
*
* @var Visibility
*/
protected $catalogProductVisibility;
/**
* Product collection factory
*
* @var CollectionFactory
*/
protected $productCollectionFactory;
/**
* @var Builder
*/
protected $sqlBuilder;
/**
* @var Rule
*/
protected $rule;
/**
* @var Conditions
*/
protected $conditionsHelper;
/**
* @var PriceCurrencyInterface
*/
private $priceCurrency;
/**
* Json Serializer Instance
*
* @var Json
*/
private $json;
/**
* @var LayoutFactory
*/
private $layoutFactory;
/**
* @var EncoderInterface|null
*/
private $urlEncoder;
/**
* @var \Magento\Framework\View\Element\RendererList
*/
private $rendererListBlock;
/**
* @var CategoryRepositoryInterface
*/
private $categoryRepository;
/**
* @param \Magento\Catalog\Block\Product\Context $context
* @param CollectionFactory $productCollectionFactory
* @param Visibility $catalogProductVisibility
* @param Context $httpContext
* @param Builder $sqlBuilder
* @param Rule $rule
* @param Conditions $conditionsHelper
* @param CategoryRepositoryInterface $categoryRepository
* @param array $data
* @param Json|null $json
* @param LayoutFactory|null $layoutFactory
* @param EncoderInterface|null $urlEncoder
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
\Magento\Catalog\Block\Product\Context $context,
CollectionFactory $productCollectionFactory,
Visibility $catalogProductVisibility,
Context $httpContext,
Builder $sqlBuilder,
Rule $rule,
Conditions $conditionsHelper,
CategoryRepositoryInterface $categoryRepository,
array $data = [],
Json $json = null,
LayoutFactory $layoutFactory = null,
EncoderInterface $urlEncoder = null
) {
$this->productCollectionFactory = $productCollectionFactory;
$this->catalogProductVisibility = $catalogProductVisibility;
$this->httpContext = $httpContext;
$this->sqlBuilder = $sqlBuilder;
$this->rule = $rule;
$this->conditionsHelper = $conditionsHelper;
$this->json = $json ?: ObjectManager::getInstance()->get(Json::class);
$this->layoutFactory = $layoutFactory ?: ObjectManager::getInstance()->get(LayoutFactory::class);
$this->urlEncoder = $urlEncoder ?: ObjectManager::getInstance()->get(EncoderInterface::class);
$this->categoryRepository = $categoryRepository;
parent::__construct(
$context,
$data
);
}
/**
* Internal constructor, that is called from real constructor
*
* @return void
*/
protected function _construct()
{
parent::_construct();
$this->addColumnCountLayoutDepend('empty', 6)
->addColumnCountLayoutDepend('1column', 5)
->addColumnCountLayoutDepend('2columns-left', 4)
->addColumnCountLayoutDepend('2columns-right', 4)
->addColumnCountLayoutDepend('3columns', 3);
$this->addData(
[
'cache_lifetime' => 86400,
'cache_tags' => [
Product::CACHE_TAG,
],
]
);
}
/**
* Get key pieces for caching block content
*
* @return array
* @SuppressWarnings(PHPMD.RequestAwareBlockMethod)
* @throws NoSuchEntityException
*/
public function getCacheKeyInfo()
{
$conditions = $this->getData('conditions')
? $this->getData('conditions')
: $this->getData('conditions_encoded');
return [
'CATALOG_PRODUCTS_LIST_WIDGET',
$this->getPriceCurrency()->getCurrency()->getCode(),
$this->_storeManager->getStore()->getId(),
$this->_design->getDesignTheme()->getId(),
$this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP),
(int)$this->getRequest()->getParam($this->getData('page_var_name'), 1),
$this->getProductsPerPage(),
$this->getProductsCount(),
$conditions,
$this->json->serialize($this->getRequest()->getParams()),
$this->getTemplate(),
$this->getTitle()
];
}
/**
* @inheritdoc
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function getProductPriceHtml(
Product $product,
$priceType = null,
$renderZone = \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST,
array $arguments = []
) {
if (!isset($arguments['zone'])) {
$arguments['zone'] = $renderZone;
}
$arguments['price_id'] = isset($arguments['price_id'])
? $arguments['price_id']
: 'old-price-' . $product->getId() . '-' . $priceType;
$arguments['include_container'] = isset($arguments['include_container'])
? $arguments['include_container']
: true;
$arguments['display_minimal_price'] = isset($arguments['display_minimal_price'])
? $arguments['display_minimal_price']
: true;
/** @var \Magento\Framework\Pricing\Render $priceRender */
$priceRender = $this->getLayout()->getBlock('product.price.render.default');
if (!$priceRender) {
$priceRender = $this->getLayout()->createBlock(
\Magento\Framework\Pricing\Render::class,
'product.price.render.default',
['data' => ['price_render_handle' => 'catalog_product_prices']]
);
}
$price = $priceRender->render(
FinalPrice::PRICE_CODE,
$product,
$arguments
);
return $price;
}
/**
* @inheritdoc
*/
protected function getDetailsRendererList()
{
if (empty($this->rendererListBlock)) {
/** @var $layout LayoutInterface */
$layout = $this->layoutFactory->create(['cacheable' => false]);
$layout->getUpdate()->addHandle('catalog_widget_product_list')->load();
$layout->generateXml();
$layout->generateElements();
$this->rendererListBlock = $layout->getBlock('category.product.type.widget.details.renderers');
}
return $this->rendererListBlock;
}
/**
* Get post parameters.
*
* @param Product $product
* @return array
*/
public function getAddToCartPostParams(Product $product)
{
$url = $this->getAddToCartUrl($product);
return [
'action' => $url,
'data' => [
'product' => $product->getEntityId(),
ActionInterface::PARAM_NAME_URL_ENCODED => $this->urlEncoder->encode($url),
]
];
}
/**
* @inheritdoc
*/
protected function _beforeToHtml()
{
$this->setProductCollection($this->createCollection());
return parent::_beforeToHtml();
}
/**
* Prepare and return product collection
*
* @return Collection
* @SuppressWarnings(PHPMD.RequestAwareBlockMethod)
* @throws LocalizedException
*/
public function createCollection()
{
/** @var $collection Collection */
$collection = $this->productCollectionFactory->create();
if ($this->getData('store_id') !== null) {
$collection->setStoreId($this->getData('store_id'));
}
$collection->setVisibility($this->catalogProductVisibility->getVisibleInCatalogIds());
$collection = $this->_addProductAttributesAndPrices($collection)
->addStoreFilter()
->addAttributeToSort('created_at', 'desc')
->setPageSize($this->getPageSize())
->setCurPage($this->getRequest()->getParam($this->getData('page_var_name'), 1));
$conditions = $this->getConditions();
$conditions->collectValidatedAttributes($collection);
$this->sqlBuilder->attachConditionToCollection($collection, $conditions);
/**
* Prevent retrieval of duplicate records. This may occur when multiselect product attribute matches
* several allowed values from condition simultaneously
*/
$collection->distinct(true);
return $collection;
}
/**
* Update conditions if the category is an anchor category
*
* @param array $condition
* @return array
*/
private function updateAnchorCategoryConditions(array $condition): array
{
if (array_key_exists('value', $condition)) {
$categoryId = $condition['value'];
try {
$category = $this->categoryRepository->get($categoryId, $this->_storeManager->getStore()->getId());
} catch (NoSuchEntityException $e) {
return $condition;
}
$children = $category->getIsAnchor() ? $category->getChildren(true) : [];
if ($children) {
$children = explode(',', $children);
$condition['operator'] = "()";
$condition['value'] = array_merge([$categoryId], $children);
}
}
return $condition;
}
/**
* Get conditions
*
* @return Combine
*/
protected function getConditions()
{
$conditions = $this->getData('conditions_encoded')
? $this->getData('conditions_encoded')
: $this->getData('conditions');
if ($conditions) {
$conditions = $this->conditionsHelper->decode($conditions);
}
foreach ($conditions as $key => $condition) {
if (!empty($condition['attribute'])) {
if (in_array($condition['attribute'], ['special_from_date', 'special_to_date'])) {
$conditions[$key]['value'] = date('Y-m-d H:i:s', strtotime($condition['value']));
}
if ($condition['attribute'] == 'category_ids') {
$conditions[$key] = $this->updateAnchorCategoryConditions($condition);
}
}
}
$this->rule->loadPost(['conditions' => $conditions]);
return $this->rule->getConditions();
}
/**
* Retrieve how many products should be displayed
*
* @return int
*/
public function getProductsCount()
{
if ($this->hasData('products_count')) {
return $this->getData('products_count');
}
if (null === $this->getData('products_count')) {
$this->setData('products_count', self::DEFAULT_PRODUCTS_COUNT);
}
return $this->getData('products_count');
}
/**
* Retrieve how many products should be displayed
*
* @return int
*/
public function getProductsPerPage()
{
if (!$this->hasData('products_per_page')) {
$this->setData('products_per_page', self::DEFAULT_PRODUCTS_PER_PAGE);
}
return $this->getData('products_per_page');
}
/**
* Return flag whether pager need to be shown or not
*
* @return bool
*/
public function showPager()
{
if (!$this->hasData('show_pager')) {
$this->setData('show_pager', self::DEFAULT_SHOW_PAGER);
}
return (bool)$this->getData('show_pager');
}
/**
* Retrieve how many products should be displayed on page
*
* @return int
*/
protected function getPageSize()
{
return $this->showPager() ? $this->getProductsPerPage() : $this->getProductsCount();
}
/**
* Render pagination HTML
*
* @return string
* @throws LocalizedException
*/
public function getPagerHtml()
{
if ($this->showPager() && $this->getProductCollection()->getSize() > $this->getProductsPerPage()) {
if (!$this->pager) {
$this->pager = $this->getLayout()->createBlock(
Pager::class,
$this->getWidgetPagerBlockName()
);
$this->pager->setUseContainer(true)
->setShowAmounts(true)
->setShowPerPage(false)
->setPageVarName($this->getData('page_var_name'))
->setLimit($this->getProductsPerPage())
->setTotalLimit($this->getProductsCount())
->setCollection($this->getProductCollection());
}
if ($this->pager instanceof \Magento\Framework\View\Element\AbstractBlock) {
return $this->pager->toHtml();
}
}
return '';
}
/**
* Return identifiers for produced content
*
* @return array
*/
public function getIdentities()
{
$identities = [];
if ($this->getProductCollection()) {
foreach ($this->getProductCollection() as $product) {
if ($product instanceof IdentityInterface) {
$identities += $product->getIdentities();
}
}
}
return $identities ?: [Product::CACHE_TAG];
}
/**
* Get value of widgets' title parameter
*
* @return mixed|string
*/
public function getTitle()
{
return $this->getData('title');
}
/**
* Get currency of product
*
* @return PriceCurrencyInterface
* @deprecated 100.2.0
*/
private function getPriceCurrency()
{
if ($this->priceCurrency === null) {
$this->priceCurrency = ObjectManager::getInstance()
->get(PriceCurrencyInterface::class);
}
return $this->priceCurrency;
}
/**
* @inheritdoc
*/
public function getAddToCartUrl($product, $additional = [])
{
$requestingPageUrl = $this->getRequest()->getParam('requesting_page_url');
if (!empty($requestingPageUrl)) {
$additional['useUencPlaceholder'] = true;
$url = parent::getAddToCartUrl($product, $additional);
return str_replace('%25uenc%25', $this->urlEncoder->encode($requestingPageUrl), $url);
}
return parent::getAddToCartUrl($product, $additional);
}
/**
* Get widget block name
*
* @return string
*/
private function getWidgetPagerBlockName()
{
$pageName = $this->getData('page_var_name');
$pagerBlockName = 'widget.products.list.pager';
if (!$pageName) {
return $pagerBlockName;
}
return $pagerBlockName . '.' . $pageName;
}
}
Every time I try to compile I get:
Interception cache generation... 6/8 [=====================>------] 75% 1 min 544.0 MiBErrors during compilation:
Aitoc\ProductFileAttachments\Block\Product\Attachments
Incompatible argument type: Required type: \Magento\Catalog\Api\CategoryRepositoryInterface. Actual type: array; File: html/app/code/Aitoc/ProductFileAttachments/Block/Product/Attachments.php
Total Errors Count: 1
해결책
Please Change __constractor()
in the file Aitoc\ProductFileAttachments\Block\Product\Attachments.php
From:
public function __construct(
Context $context,
CollectionFactory $productCollectionFactory,
Visibility $catalogProductVisibility,
ContextHttp $httpContext,
Builder $sqlBuilder,
Rule $rule,
Conditions $conditionsHelper,
AttachmentAttributesCollection $attachmentAttributesCollection,
AttachmentsCollectionFactory $attachmentsCollectionFactory,
SessionFactory $customerSessionFactory,
OrderCollectionFactory $orderCollectionFactory,
ResourceConnection $resource,
IconsCollectionFactory $iconsCollectionFactory,
Data $helper,
ScopeConfigInterface $scopeConfig,
array $data = []
) {
$this->attachmentsCollectionFactory = $attachmentsCollectionFactory;
$this->registry = $context->getRegistry();
$this->helper = $helper;
$this->attachmentAttributesCollection = $attachmentAttributesCollection;
$this->customerSessionFactory = $customerSessionFactory;
$this->orderCollectionFactory = $orderCollectionFactory;
$this->resource = $resource;
$this->iconsCollectionFactory = $iconsCollectionFactory;
$this->storeManager = $context->getStoreManager();
$this->scopeConfig = $scopeConfig;
$this->productCollectionFactory = $productCollectionFactory;
parent::__construct($context, $productCollectionFactory, $catalogProductVisibility, $httpContext, $sqlBuilder, $rule, $conditionsHelper, $data);
}
To:
public function __construct(
Context $context,
CollectionFactory $productCollectionFactory,
Visibility $catalogProductVisibility,
ContextHttp $httpContext,
Builder $sqlBuilder,
Rule $rule,
Conditions $conditionsHelper,
AttachmentAttributesCollection $attachmentAttributesCollection,
AttachmentsCollectionFactory $attachmentsCollectionFactory,
SessionFactory $customerSessionFactory,
OrderCollectionFactory $orderCollectionFactory,
ResourceConnection $resource,
IconsCollectionFactory $iconsCollectionFactory,
Data $helper,
ScopeConfigInterface $scopeConfig,
array $data = [],
\Magento\Catalog\Api\CategoryRepositoryInterface $categoryRepository
) {
$this->attachmentsCollectionFactory = $attachmentsCollectionFactory;
$this->registry = $context->getRegistry();
$this->helper = $helper;
$this->attachmentAttributesCollection = $attachmentAttributesCollection;
$this->customerSessionFactory = $customerSessionFactory;
$this->orderCollectionFactory = $orderCollectionFactory;
$this->resource = $resource;
$this->iconsCollectionFactory = $iconsCollectionFactory;
$this->storeManager = $context->getStoreManager();
$this->scopeConfig = $scopeConfig;
$this->productCollectionFactory = $productCollectionFactory;
parent::__construct($context, $productCollectionFactory, $catalogProductVisibility, $httpContext, $sqlBuilder, $rule, $conditionsHelper, $categoryRepository, $data);
}
After this Change please Compile. I thing it will be solved your problem.
다른 팁
Edit function __construct()
in file Aitoc/ProductFileAttachments/Block/Product/Attachments.php
.
__construct(
....
){
....
parent::__construct(
$context,
$data
);
}
제휴하지 않습니다 magento.stackexchange