Hello everyone,
I try to edit the "sort by" select in my site and I want to obtain theese 4 options:
1) From relevance (and it's ok, I modify the position in Catalog-Products)
2) from the most recent to the oldest
3) from the oldest to the most recent
4) by popularity
I found the file Ps_FacetedsearchProductSearchProvider.php in modules\ps_facetedsearch\src\Ps_FacetedsearchProductSearchProvider.php
and I obtained the first 3 of 4 options that i need. I modify the code at line 117 and there is the result:
private function getAvailableSortOrders()
{
return [
(new SortOrder('product', 'position', 'asc'))->setLabel(
$this->module->getTranslator()->trans('Relevance', array(), 'Modules.Facetedsearch.Shop')
),
(new SortOrder('product', 'date_add', 'desc'))->setLabel(
$this->module->getTranslator()->trans('Da più recente a meno recente', array(), 'Shop.Theme.Catalog')
),
(new SortOrder('product', 'date_add', 'asc'))->setLabel(
$this->module->getTranslator()->trans('Da meno recente a più recente', array(), 'Shop.Theme.Catalog')
),
];
}
I don't know what to write for the last option = BY POPULARITY
Anyone can help me? Thanks!
P.S: Sorry for my bad english, I'm an italian guy