C
C
chelkaz2018-08-08 14:20:45
1C-Bitrix
chelkaz, 2018-08-08 14:20:45

How to find items with price "from" in property type "Money" - Money?

Elements have property type "Money"
Bitrix infoblocks have property type "Money"
It stores the value in VALUE => "1500|RUB"
That is, numbers, then separator | and then currency
How to select, for example, all items whose price is less than 1000 and the currency is RUB ?
5b6ad1db91baa361024957.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Nikolaev, 2018-08-08
@gromdron

It is possible, but terribly inconvenient (non-optimal):

\Bitrix\Main\Loader::IncludeModule('iblock');

$filter = [
   'IBLOCK_ID' => '2',
   [
      'LOGIC' => 'AND',
      [
         '>PROPERTY_PRICE' => '100',
      ],
      [
         'PROPERTY_PRICE' => '%|RUB',
      ]
   ]
];

$resElements = \CIblockElement::getList([], $filter, false, false, ['ID','IBLOCK_ID','PROPERTY_PRICE']);

while( $element = $resElements->fetch() )
{
   var_dump($element);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question