A
A
Alex2019-05-31 12:44:08
1C-Bitrix
Alex, 2019-05-31 12:44:08

Find out coupons entered by the user in Bitrix?

There is a nexttype template on Bitrix. But the order page has been completely rewritten. Tell me how you can find out the list of coupons on the order page that were applied in the basket.
And I would also like to know how they can be applied on the order page.
What I figured out is this

\Bitrix\Sale\DiscountCouponsManager::add(123456789);
- adds a coupon, but as I understand it, nowhere does it state that this user has applied a coupon to this basket
\Bitrix\Sale\DiscountCouponsManager::get();- gets a list of coupons applied just now by the add function. But the fact that someone previously applied does not display.
I've read a lot of posts and I'm completely confused.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tgarl, 2019-05-31
@tgarl

I get a list of coupons before ordering like this:

$basket  = \Bitrix\Sale\Basket::loadItemsForFUser(
   \CSaleBasket::GetBasketUserID(),
    "s1" 
);
 $order  = Bitrix\Sale\Order::create( "s1" , \Bitrix\Sale\Fuser::getId());
 $order ->setPersonTypeId( 1 );
 $order ->setBasket( $basket );
 $discounts  =  $order ->getDiscount();
 $res  =  $discounts ->getApplyResult();
 foreach($res['COUPON_LIST'] as $cupo_n=>$ar_r){
...
тут проводим манипуляцую с купоном
...
}

Approximately as necessary, I showed, then start from your task.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question