Answer the question
In order to leave comments, you need to log in
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. Answer the question
In order to leave comments, you need to log in
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){
...
тут проводим манипуляцую с купоном
...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question