L
L
lexstile2018-07-24 08:47:25
1C-Bitrix
lexstile, 2018-07-24 08:47:25

How to make a filter by comparing the current date with the date from the add. properties?

$date = time();
$arFilter = array('PROPERTY_SEMINAR_STATUS' => 45,'ROPERTY_SEMINAR_END'=>?); 
$APPLICATION->IncludeComponent(
  "bitrix:news.list",
  "obuchenie",
  Array(
    "IBLOCK_ID" => "24",
    "PROPERTY_CODE" => Array(0=>"SEMINAR_START",1=>"SEMINAR_END",2=>"SEMINAR_CITY",3=>"SEMINAR_PLACE",4=>"SEMINAR_STATUS"),
    "SORT_BY1" => "ACTIVE_FROM",
    "SORT_BY2" => "SORT",
    "SORT_ORDER1" => "DESC",
    "SORT_ORDER2" => "ASC",
    "FILTER_NAME" => "arFilter",
    "CACHE_FILTER" => "Y"
  )
);

It is necessary to select only those elements where SEMINAR_END was less than the current date, how to implement this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Nikolaev, 2018-07-24
@lexstile

According to documentation :
The filter values ​​are a single value or an array of values. To exclude empty values, you must use false.
Optional. By default, entries are not filtered.
Note 1: (by setting the filter for the "Date/Time" type property): the Date/Time type property is stored as a string with a date in the YYYY-MM-DD HH:MI:SS format. Accordingly, sorting by the value of such a property will work correctly, but the value for filtering is formed like this: $cat_filter[">"."PROPERTY_available"] = date("Ymd");
Note 2: When using the filter check type "><" for null-terminated integers, you must use the field type number or the delimiter "," for decimal values ​​(for example, 20000.00).
">PROPERTY_SEMINAR_END" => date('Y-m-d)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question