A
A
Apostol632019-06-17 21:04:53
1C-Bitrix
Apostol63, 2019-06-17 21:04:53

How to get priority from the cart rule?

How to get priority from the cart rule? By the rule, you can create coupons. 2 hours poking around in the documentation, but found nothing. And in the information of the coupon (if you get through get()), no

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Panteleev, 2019-06-24
@s_panteleev

I don't quite understand what you want to get, but try this:

if (\Bitrix\Main\Loader::includeModule('sale')) {
    $order = \Bitrix\Sale\Order::load($orderId);
    $appliedDiscount = $order->getDiscount()->getApplyResult(true);

    $discounts = [];
    foreach ($appliedDiscount['DISCOUNT_LIST'] as $discount) {
        $discounts[] = $discount['REAL_DISCOUNT_ID'];

        // Информация о примененной скидке
        echo '<pre style="color: red;">', print_r($discount, true), '</pre>';
    }

    $appliedList = Bitrix\Sale\Internals\DiscountTable::getList([
        'filter' => ['=ID' => $discounts]
    ])->fetchAll();

    // Подробная информация о скидке
    echo '<pre style="color: red;">', print_r($appliedList, true), '</pre>';
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question