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 Jun 21, 2023 at 5:03
  • Can you please add a Magento version? 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.