Magento 2 Below code for PLP page Sort By Price Low-High & High-Low working properly in M2.3.6 EE but not in M2.4.5 EE , any solution?

Plumtree/CatalogExtended/etc/di.xml

<?xml version="1.0" ?>

Plumtree/CatalogExtended/Plugin/Catalog/Block/Toolbar.php

namespace Plumtree\CatalogExtended\Plugin\Catalog\Block;

class Toolbar { public function aroundSetCollection( \Magento\Catalog\Block\Product\ProductList\Toolbar $subject, \Closure $proceed, $collection ) { $currentOrder = $subject->getCurrentOrder(); $result = $proceed($collection);

if ($currentOrder) {
    if ($currentOrder == 'high_to_low') {
        $subject->getCollection()->setOrder('price', 'desc');
    } elseif ($currentOrder == 'low_to_high') {
        $subject->getCollection()->setOrder('price', 'asc');
    }
}

return $result;
}}

Plumtree/CatalogExtended/Plugin/Catalog/Model/Config.php

namespace Plumtree\CatalogExtended\Plugin\Catalog\Model;

class Config { public function afterGetAttributeUsedForSortByArray( \Magento\Catalog\Model\Config $catalogConfig, $options ) {

      $options['low_to_high'] = __('Price - Low To High');
      $options['high_to_low'] = __('Price - High To Low');
      $options['position'] = __('Best Sellers');
      $options['name'] = __('Name');

      unset($options['price']);
      return $options;

  }}


from Active questions tagged magento-enterprise - Magento Stack Exchange

Click link to view all answer https://magento.stackexchange.com/questions/366299/magento-2-below-code-for-plp-page-sort-by-price-low-high-high-low-working-prop