Answer the question
In order to leave comments, you need to log in
How to sort elements?
Bitrix has sorting shows - the average number of impressions (number of impressions / duration of the show), i.e. in fact, popular products are displayed above.
How to limit this popularity in time, so that the first products are popular not for all time, but for the last 30 days? And then we display the products in any other order....
Well, in principle - how to limit sorting??
For example, show only 10 new products first, then any other sorting, and at the end other new items...
i.e. Restrictions on number or on the period are necessary.
Answer the question
In order to leave comments, you need to log in
Here, according to your link, Tanyukha writes:
this is exactly where the array is formed, just for sorting, where did the word filtering come from ???
$sortField = 'ID'; // поле сортировки по умолчанию
$sortOrder = 'ASC'; // направление сортировки по умолчанию
if (
isset($_GET["sort"]) && isset($_GET["method"]) && (
$_GET["sort"] == "name" ||
$_GET["sort"] == "catalog_PRICE_3" ||
$_GET["sort"] == "property_PRODUCT_TYPE" ||
$_GET["sort"] == "timestamp_x")){
$sortField = $_GET["sort"];
$sortOrder = $_GET["method"];
}
"ELEMENT_SORT_FIELD" => $sortField,
"ELEMENT_SORT_ORDER" => $sortOrder,
no way, if it's scary to write sql queries or create new tables
https://bxapi.ru/src/?module_id=iblock&name=CIBloc...
function GetShowedFunction()
{
return " IfNULL(BE.SHOW_COUNTER/((UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(BE.SHOW_COUNTER_START)+0.1)/60/60),0) ";
}
You take a blank of a custom complex component in the materials of exam No. 2 and write your logic for generating an array of a list of goods in it.
Most likely you will have to write your functionality of the average number of impressions for the last 30 days in your module and store the impression values in your database tables.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question