How to sort a product list widget using the price attribute in ascending or descending order?
Add plugin code in etc/frontend/di.xml:
Create plugin “ProductsListPlugin” and add below code in it
getSelect()->reset(\Zend_Db_Select::ORDER);
$result->addAttributeToSort('price', 'ASC'); // Or DESC for descending order
return $result;
}
}
March 15, 2023 | View: 623