Answer the question
In order to leave comments, you need to log in
How to fit orders by product properties?
Products have properties: brands, type...
How can I get a list of orders that have products with the property brand = ..., or type = shoes?
You can filter by product name like this
$parameters = [
'filter' => [
'BASKET.NAME' => "%".$_REQUEST['CODE']."%"
]
];
$dbRes = \Bitrix\Sale\Order::getList($parameters);
В BASKET не передаются эти свойства.
Answer the question
In order to leave comments, you need to log in
use Bitrix\Main\ORM\Fields\Relations\Reference;
use Bitrix\Main\ORM\Query\Join;
use Bitrix\Iblock\ElementPropertyTable;
\Bitrix\Main\Loader::includeModule('sale');
$propertyId = 1;
$result = \Bitrix\Sale\Order::getList([
'filter' => ['PROPERTIES.IBLOCK_PROPERTY_ID' => $propertyId, '!PROPERTIES.VALUE' => false],
'select' => ['ID'],
'runtime' => [
new Reference(
'PROPERTIES', ElementPropertyTable::class,
Join::on('this.BASKET.PRODUCT_ID', 'ref.IBLOCK_ELEMENT_ID')
)
]
])->fetchAll();
print_r($result);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question