38 if (self::$existCouponsManager ===
null)
52 $clearFields[] =
'CREATED_BY';
54 foreach ($clearFields as &$fieldName)
56 if (array_key_exists($fieldName,
$arFields))
59 unset($fieldName, $clearFields);
76 if (self::$existCouponsManager)
79 if (!empty($existCoupon))
81 if ($existCoupon[
'MODULE'] !=
'catalog' || $currentId != $existCoupon[
'ID'])
91 'select' =>
array(
'ID',
'COUPON'),
96 if ($currentId != (
int)$existCoupon[
'ID'])
108 $arFields[
"ONE_TIME"] = self::TYPE_ONE_TIME;
116 $intUserID = (int)
$USER->GetID();
117 $strDateFunction =
$DB->GetNowFunction();
118 $arFields[
'~TIMESTAMP_X'] = $strDateFunction;
121 if (!array_key_exists(
'MODIFIED_BY',
$arFields) || intval(
$arFields[
"MODIFIED_BY"]) <= 0)
126 $arFields[
'~DATE_CREATE'] = $strDateFunction;
129 if (!array_key_exists(
'CREATED_BY',
$arFields) || intval(
$arFields[
"CREATED_BY"]) <= 0)
163 if (self::$existCouponsManager ===
null)
166 if (self::$existCouponsManager)
176 $coupon = trim((
string)$coupon);
181 if (!$session->isAccessible())
186 if (!isset($session[
'CATALOG_USER_COUPONS']) || !is_array($session[
'CATALOG_USER_COUPONS']))
187 $session[
'CATALOG_USER_COUPONS'] =
array();
190 'select' =>
array(
'ID',
'COUPON'),
191 'filter' =>
array(
'=COUPON' => $coupon,
'=ACTIVE' =>
'Y')
195 if (!in_array($existCoupon[
'COUPON'], $session[
'CATALOG_USER_COUPONS']))
196 $session[
'CATALOG_USER_COUPONS'][] = $existCoupon[
'COUPON'];
209 if (self::$existCouponsManager ===
null)
212 if (self::$existCouponsManager)
223 if (!$session->isAccessible())
228 if (!isset($session[
'CATALOG_USER_COUPONS']) || !is_array($session[
'CATALOG_USER_COUPONS']))
229 $session[
'CATALOG_USER_COUPONS'] =
array();
230 return $session[
"CATALOG_USER_COUPONS"];
243 if (self::$existCouponsManager ===
null)
245 if (self::$existCouponsManager)
255 $strCoupon = trim((
string)$strCoupon);
256 if (empty($strCoupon))
260 if (!$session->isAccessible())
265 if (!isset($session[
'CATALOG_USER_COUPONS']) || !is_array($session[
'CATALOG_USER_COUPONS']))
267 $session[
'CATALOG_USER_COUPONS'] =
array();
270 $key = array_search($strCoupon, $session[
'CATALOG_USER_COUPONS']);
273 unset($session[
'CATALOG_USER_COUPONS'][
$key]);
285 if (self::$existCouponsManager ===
null)
288 if (self::$existCouponsManager)
296 if ($session->isAccessible())
298 $session[
'CATALOG_USER_COUPONS'] =
array();
313 $intUserID = (int)$intUserID;
316 if (self::$existCouponsManager ===
null)
318 if (self::$existCouponsManager)
328 $strCoupon = trim((
string)$strCoupon);
329 if (empty($strCoupon))
333 if (!$session->isAccessible())
338 if (!isset($session[
'CATALOG_MANAGE_COUPONS']) || !is_array($session[
'CATALOG_MANAGE_COUPONS']))
339 $session[
'CATALOG_MANAGE_COUPONS'] =
array();
340 if (!isset($session[
'CATALOG_MANAGE_COUPONS'][$intUserID]) || !is_array($session[
'CATALOG_MANAGE_COUPONS'][$intUserID]))
341 $session[
'CATALOG_MANAGE_COUPONS'][$intUserID] =
array();
344 'select' =>
array(
'ID',
'COUPON'),
345 'filter' =>
array(
'=COUPON' => $strCoupon,
'=ACTIVE' =>
'Y')
349 if (!in_array($existCoupon[
'COUPON'], $session[
'CATALOG_MANAGE_COUPONS'][$intUserID]))
350 $session[
'CATALOG_MANAGE_COUPONS'][$intUserID][] = $existCoupon[
'COUPON'];
368 $intUserID = (int)$intUserID;
371 if (self::$existCouponsManager ===
null)
373 if (self::$existCouponsManager)
384 if (!$session->isAccessible())
389 if (!isset($session[
'CATALOG_MANAGE_COUPONS']) || !is_array($session[
'CATALOG_MANAGE_COUPONS']))
390 $session[
'CATALOG_MANAGE_COUPONS'] =
array();
391 if (!isset($session[
'CATALOG_MANAGE_COUPONS'][$intUserID]) || !is_array($session[
'CATALOG_MANAGE_COUPONS'][$intUserID]))
392 $session[
'CATALOG_MANAGE_COUPONS'][$intUserID] =
array();
394 return $session[
'CATALOG_MANAGE_COUPONS'][$intUserID];
410 $intUserID = (int)$intUserID;
413 if (self::$existCouponsManager ===
null)
415 if (self::$existCouponsManager)
426 if (!$session->isAccessible())
431 $strCoupon = trim((
string)$strCoupon);
432 if (empty($strCoupon))
434 if (!isset($session[
'CATALOG_MANAGE_COUPONS']) || !is_array($session[
'CATALOG_MANAGE_COUPONS']))
436 if (!isset($session[
'CATALOG_MANAGE_COUPONS'][$intUserID]) || !is_array($session[
'CATALOG_MANAGE_COUPONS'][$intUserID]))
438 $key = array_search($strCoupon, $session[
'CATALOG_MANAGE_COUPONS'][$intUserID]);
441 unset($session[
'CATALOG_MANAGE_COUPONS'][$intUserID][
$key]);
458 $intUserID = (int)$intUserID;
461 if (self::$existCouponsManager ===
null)
463 if (self::$existCouponsManager)
474 if (!$session->isAccessible())
479 if (!isset($session[
'CATALOG_MANAGE_COUPONS']) || !is_array($session[
'CATALOG_MANAGE_COUPONS']))
480 $session[
'CATALOG_MANAGE_COUPONS'] =
array();
481 $session[
'CATALOG_MANAGE_COUPONS'][$intUserID] =
array();
503 || (is_array($arModules) && in_array(
'catalog', $arModules))
506 if (!empty($arCoupons))
508 if (!is_array($arCoupons))
509 $arCoupons =
array($arCoupons);
510 $intUserID = (int)$intUserID;
512 if (self::$existCouponsManager ===
null)
514 if (self::$existCouponsManager)
518 foreach ($arCoupons as &$coupon)
532 $boolCurrentUser = (
$USER->IsAuthorized() && $intUserID ==
$USER->GetID());
533 foreach ($arCoupons as &$strOneCoupon)
535 if (self::SetCouponByManage($intUserID, $strOneCoupon))
537 if ($boolCurrentUser)
540 unset($strOneCoupon);
544 foreach ($arCoupons as &$strOneCoupon)
550 unset($strOneCoupon);
575 || (is_array($arModules) && in_array(
'catalog', $arModules))
578 if (!empty($arCoupons))
580 if (!is_array($arCoupons))
581 $arCoupons =
array($arCoupons);
582 $intUserID = (int)$intUserID;
584 if (self::$existCouponsManager ===
null)
586 if (self::$existCouponsManager)
590 foreach ($arCoupons as &$coupon)
604 $boolCurrentUser = (
$USER->IsAuthorized() && $intUserID ==
$USER->GetID());
605 foreach ($arCoupons as &$strOneCoupon)
607 if (self::EraseCouponByManage($intUserID, $strOneCoupon))
609 if ($boolCurrentUser)
612 unset($strOneCoupon);
616 foreach ($arCoupons as &$strOneCoupon)
618 if (self::EraseCoupon($strOneCoupon))
621 unset($strOneCoupon);
643 || (is_array($arModules) && in_array(
'catalog', $arModules))
646 $intUserID = (int)$intUserID;
647 if (self::$existCouponsManager ===
null)
649 if (self::$existCouponsManager)
661 $boolCurrentUser = (
$USER->IsAuthorized() && $intUserID ==
$USER->GetID());
663 if ($boolCurrentUser)
689 if (self::$existCouponsManager ===
null)
static getCouponTypes($extendedMode=false)
static deleteByDiscount($discount)
static includeModule($moduleName)
static getMessage($code, $replace=null, $language=null)
static isModuleInstalled($moduleName)
static clear($clearStorage=false)
static get($extMode=true, $filter=[], $show=false, $final=false)
static OnSetCouponList($intUserID, $arCoupons, $arModules)
static initCouponManager()
static GetCouponsByManage($intUserID)
static OnDeleteCouponList($intUserID, $arModules)
static EraseCoupon($strCoupon)
static DeleteByDiscountID($ID, $bAffectDataFile=true)
static CheckFields($ACTION, &$arFields, $ID=0)
static SetCoupon($coupon)
static EraseCouponByManage($intUserID, $strCoupon)
static $existCouponsManager
static GetCoupontTypes($boolFull=false)
static SetCouponByManage($intUserID, $strCoupon)
static ClearCouponsByManage($intUserID)
static OnClearCouponList($intUserID, $arCoupons, $arModules)
static IsExistCoupon($strCoupon)
static $arOneOrderCoupons
if($usePageNavigation) $couponIterator
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key