Нашел в исходниках пресет, который позволяет получать товары и разделы для конкретной скидки, очень необходимый функционал, если знаете другой способ, прошу поделиться
public function getDiscount($id)
{
Loader::includeModule('sale');
require ($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/sale/handlers/discountpreset/simpleproduct.php");
$arDiscounts = [];
$arProductDiscounts = \Bitrix\Sale\Internals\DiscountTable::getList([
'filter' => [
'ID' => $id,
],
'select' => [
"*"
]
]) -> fetch();
$discountObj = new Sale\Handlers\DiscountPreset\SimpleProduct();
$discount = $discountObj->generateState($arProductDiscounts);
$arDiscounts['PRODUCTS'] = $discount['discount_product']; // товары
$arDiscounts['TYPE'] = $discount['discount_type'];
$arDiscounts['GROUPS'] = $discount['discount_section'];
$arDiscounts['VALUE'] = $discount['discount_value'];
return $arDiscounts;
}
|