0

I have successfully overwrite core file: Magento\Sitemap\Model\ResourceModel\Catalog\Product

but getting error in public function getCollection($storeId) for this: $this->scopeConfig->isSetFlag and $this->getConnection() method not found.

When try to overwrite whole file getting this error: Incompatible argument type: Required type: \Magento\Sitemap\Helper\Data. Actual type: string;

Ref: I have overwrite core file as this: magento 2.3 how to override protected function in custom module

Any help will be appreciated. Thanks.

2
  • Please add your file and DI.xml in the question Commented Jun 21, 2023 at 5:03
  • Can you please add a Magento version? Commented Jun 22, 2023 at 7:06

1 Answer 1

1

Update your override file's parent::__construct with below:

parent::__construct($context, $sitemapData, $productResource, $storeManager, $productVisibility, $productStatus, $mediaGalleryResourceModel, $mediaGalleryReadHandler,$mediaConfig, $connectionName, $productModel, $catalogImageHelper, $scopeConfig, $urlBuilder); 

Now run php bin/magento s:d:c

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.