diff --git a/vendor/magento/module-catalog/Model/System/Config/Backend/Rss/Category.php b/vendor/magento/module-catalog/Model/System/Config/Backend/Rss/Category.php new file mode 100644 index 00000000000..0df9da31f80 --- /dev/null +++ b/vendor/magento/module-catalog/Model/System/Config/Backend/Rss/Category.php @@ -0,0 +1,69 @@ +productAttributeRepository = $productAttributeRepository ?? + ObjectManager::getInstance()->get(ProductAttributeRepositoryInterface::class); + } + + /** + * @inheritdoc + */ + public function afterSave() + { + if ($this->isValueChanged() && $this->getValue()) { + $updatedAtAttr = $this->productAttributeRepository->get(ProductInterface::UPDATED_AT); + if (!$updatedAtAttr->getUsedForSortBy()) { + $updatedAtAttr->setUsedForSortBy(true); + $this->productAttributeRepository->save($updatedAtAttr); + } + } + + return parent::afterSave(); + } +} diff --git a/vendor/magento/module-catalog/etc/adminhtml/system.xml b/vendor/magento/module-catalog/etc/adminhtml/system.xml index a1b2202309d..fa6d6df5d9d 100644 --- a/vendor/magento/module-catalog/etc/adminhtml/system.xml +++ b/vendor/magento/module-catalog/etc/adminhtml/system.xml @@ -199,6 +199,7 @@ Magento\Config\Model\Config\Source\Enabledisable + Magento\Catalog\Model\System\Config\Backend\Rss\Category