Answer the question
In order to leave comments, you need to log in
How to display a coupon in the public part of the 1s-Bitrix website?
Good afternoon.
Tell me, please, how can I withdraw a coupon to an authorized buyer on the 1s-Bitrix website, which component needs to be modified for this, where to create the necessary template for this?
Help, please, with this question. It seems like you need to use DiscountCouponsManager but I can't find the right example to solve my question.
Answer the question
In order to leave comments, you need to log in
if you have 1 coupon, then why invent something? Just display the coupon code when the conditions you need are met.
You can generally generate a new coupon for each new user and only then display it. for example like this:
$coupon = DiscountCouponTable::generateCoupon(true);
//$activeFrom = new \Bitrix\Main\Type\DateTime;
//$activeTo = clone $activeFrom;
$addDb = DiscountCouponTable::add(array(
'DISCOUNT_ID' => $saleDiscountId,//ID скидки
//'ACTIVE_FROM' => $activeFrom,
//'ACTIVE_TO' => $activeTo->add('+365 days'),
'COUPON' => $coupon,
'TYPE' => \Bitrix\Sale\Internals\DiscountCouponTable::TYPE_ONE_ORDER,
'MAX_USE' => 1,
'USER_ID' => $USER->GetID(),
'DESCRIPTION' => 'описание купона',
));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question