Bitrix-D7  20.0.0
Класс Discount
Граф наследования:Discount:
DiscountBase

Открытые члены

 enableCheckingPrediction ()
 Enables prediction checking instead real condition. Подробнее...
 
 disableCheckingPrediction ()
 Disables prediction checking instead real condition. Подробнее...
 
 setCalculateShipments (Shipment $shipment=null)
 Set calculate shipments. Подробнее...
 
 getShipmentsIds ()
 Return shipment id list for existing order. Подробнее...
 
 createClone (\SplObjectStorage $cloneEntity)
 Clone entity. Подробнее...
 
 setApplyResult ($applyResult)
 Change applied discount list. Подробнее...
 
 getApplyResult ($extMode=false)
 Return discount list description. Подробнее...
 
 getShowPrices ()
 Returns show prices for public components. Подробнее...
 
 save ()
 Save discount result. Подробнее...
 
 setBasketItemBasePrice ($code, $price, $currency)
 Set base price for basket item. Подробнее...
 
 setBasketBasePrice ($basket)
 Set base price for all basket items. Подробнее...
 
 getBasketItemBasePrice ($code)
 Get base price for basket item. Подробнее...
 
 setBasketItemDiscounts ($code, $discountList)
 Set product discounts for basket item. Подробнее...
 
 setBasketItemData ($code, $providerData)
 Set various basket item data. Подробнее...
 
 clearBasketItemData ($code)
 Clear basket item data. Подробнее...
 
 saveExternalLastApplyblock (BasketItem $basketItem, $orderDiscountId)
 
- Открытые члены унаследованные от DiscountBase
 __destruct ()
 
 isClone ()
 Returns true if discount entity is cloned. Подробнее...
 
 setOrderRefresh ($state)
 Set full refresh status from edit order form. Подробнее...
 
 isOrderRefresh ()
 Returns full refresh status value. Подробнее...
 
 isOrderNew ()
 Returns new order flag value. Подробнее...
 
 setUseMode ($useMode)
 Set calculate mode. Подробнее...
 
 getUseMode ()
 Return calculate mode. Подробнее...
 
 setExecuteModuleFilter (array $moduleList)
 Sets list of execute module which will be used to filter discount. Подробнее...
 
 calculate ()
 Calculate discounts. Подробнее...
 
 verify ()
 Verifies discounts before order save. Подробнее...
 
 isValidState ()
 
 getOrder ()
 Return order. Подробнее...
 
 isOrderExists ()
 Return flag is order exists. Подробнее...
 

Открытые статические члены

static loadByFuser ($fuser, $site)
 Get discount by fuser and site. Подробнее...
 
static getRegistryType ()
 Return parent entity type. Подробнее...
 
static loadByBasket (Basket $basket)
 Get discount by basket. Подробнее...
 
static load (Order $order)
 Get discount by order. Подробнее...
 
- Открытые статические члены унаследованные от DiscountBase
static buildFromOrder (OrderBase $order)
 Builds discounts from order. Подробнее...
 
static buildFromBasket (BasketBase $basket, Context\BaseContext $context)
 Builds discounts from basket. Подробнее...
 
static setOrder (BasketBase $basket)
 Get discount by order basket. Подробнее...
 
static getApplyModeList ($extendedMode=false)
 Return apply mode list. Подробнее...
 
static getApplyMode ()
 Returns current sale discount apply mode. Подробнее...
 
static getEmptyApplyBlock ()
 Return empty apply block. Подробнее...
 
static calculateDiscountPercent ($basePrice, $discount)
 Calculate discount percent for public components. Подробнее...
 

Защищенные члены

 getOrderConfig ()
 Returns order configuration for save to database. Подробнее...
 
 getExecuteFieldList ()
 Return field list for eval. Подробнее...
 
 getConditionField ()
 Return field with discount condition code. Подробнее...
 
 normalizeDiscountResult ()
 Round and correct discount calculation results. Подробнее...
 
 getApplyPrices ()
 Fill prices in apply results. Подробнее...
 
 remakingDiscountResult ()
 Change result format. Подробнее...
 
 getApplyDeliveryPrice ()
 Returns delivery price data. Подробнее...
 
 getApplyDeliveryList ()
 Get discount delivery list and delivery list. Подробнее...
 
 fillEmptyDiscountResult ()
 Fill empty discount result list. Подробнее...
 
 fillDiscountResult ()
 Fill result order data. Подробнее...
 
 resetPrices ()
 Fill prices from base prices. Подробнее...
 
 resetDeliveryPrices ()
 Fill delivery price from base price. Подробнее...
 
 loadOrderData ()
 Load order information. Подробнее...
 
 fillEmptyOrderData ()
 Fill empty order data. Подробнее...
 
 loadBasket ()
 Get basket data from owner entity. Подробнее...
 
 loadDefaultOrderConfig ()
 Load default order config for order. Подробнее...
 
 applyLoadedOrderConfig (array $data)
 
 isShipmentExists ()
 Return is exists discount shipment. Подробнее...
 
 fillShipmentData ()
 Fill data from shipment. Подробнее...
 
 loadShipment ()
 Load shipment. Подробнее...
 
 initInstanceFromOrder ()
 Initial instance data after set order. Подробнее...
 
 getEntitySaveIdentifier (array $entity)
 Returns data for save to database. Подробнее...
 
 fillCompatibleOrderFields ()
 Fill order fields for deprecated discount classes. Подробнее...
 
 getBasketCurrency ($basketCode)
 Return basket item currency. Подробнее...
 
- Защищенные члены унаследованные от DiscountBase
 __construct ()
 
 setNewOrder ()
 Set new order flag. Подробнее...
 
 isLoaded ()
 Returns true if the data for calculations is loaded. Подробнее...
 
 setValidState ($value)
 
 initInstanceData ()
 Initial instance data. Подробнее...
 
 stopCalculate ()
 Return is allow discount calculate. Подробнее...
 
 useOnlySaleDiscounts ()
 Return true, if only sale discounts is allowed. Подробнее...
 
 getBasket ()
 Return current basket. Подробнее...
 
 isBasketExist ()
 Return exists basket. Подробнее...
 
 isBasketNotEmpty ()
 Returns the existence of a non-empty basket. Подробнее...
 
 initUseMode ()
 Initialization of the discount calculation mode. Подробнее...
 
 getBasketItemFields (BasketItemBase $basketItem)
 Returns array with basket item field values. Подробнее...
 
 loadOrderConfig ()
 Load order config for exists order. Подробнее...
 
 getModuleSettings ()
 Returns the current module settings required for calculating discounts. Подробнее...
 
 validateLoadedOrderConfig ($config)
 Validate loaded order config. Подробнее...
 
 loadOrderDiscounts ()
 Load discounts for exists order. Подробнее...
 
 loadBasketStoredData ()
 Load basket stored data for order. Подробнее...
 
 getBasketItemValue ($code, $field)
 Return basket item data value from provider. Подробнее...
 
 getBasketItemValueList ($code, array $fields)
 Return basket item data from provider. Подробнее...
 
 calculateFull ()
 Calculate discount by new order. Подробнее...
 
 calculateApply ()
 Calculate discount by exist order. Подробнее...
 
 calculateMixed ()
 Calculate discount by exist order with new items. Подробнее...
 
 saveFull ()
 Save discount result for new order. Подробнее...
 
 saveBasketStoredData (array $basketCodeList)
 Save basket items stored data. Подробнее...
 
 saveApply ()
 Save discount result for exist order. Подробнее...
 
 saveMixed ()
 Save discount result for mixed order. Подробнее...
 
 saveCoupons ()
 Save coupons for order. Подробнее...
 
 saveLastApplyBlock ()
 Save result last apply block discount. Подробнее...
 
 normalizeNewResultRows (array &$rows)
 Fill common system fields for new discount results. Подробнее...
 
 checkDiscountConditions ()
 Check duscount conditions. Подробнее...
 
 applySaleDiscount ()
 Apply discount rules. Подробнее...
 
 checkBasketDiscounts ()
 Check product discount list for basket items. Подробнее...
 
 calculateFullBasketDiscount ()
 Apply basket discount in new order. Подробнее...
 
 calculateApplyBasketDiscount ()
 Apply basket discount in exist order. Подробнее...
 
 calculateApplyDiscountBlock ()
 Calculate discount block for existing order. Подробнее...
 
 calculateApplyAdditionalCoupons ()
 Applyed additional coupons. Подробнее...
 
 calculateFullSaleDiscountResult ()
 Calculate step discount result by new order. Подробнее...
 
 tryToRevertApplyStatusInBlocks (array $stepResult)
 Tries to revert apply status of discounts. Подробнее...
 
 revertApplyBlockForBasketItem ($basketItemId)
 Reverts apply flag in blocks for basket items which has for example cumulative discount which cancels previous discounts on item. Подробнее...
 
 calculateApplySaleDiscountResult ()
 Calculate step discount result by exist order. Подробнее...
 
 getRoundMode ()
 Return order round apply mode. Подробнее...
 
 isRoundMode ($mode)
 Return true, if selected check round apply mode. Подробнее...
 
 loadRoundConfig ()
 Load round apply config for exist order. Подробнее...
 
 setRoundIndex ($entity, array $index)
 Set discount index for use round. Подробнее...
 
 getRoundIndex ($entity, $applyCounter=null)
 Return index data for use round. Подробнее...
 
 roundFullBasketPrices ()
 Round prices. Подробнее...
 
 roundApplyBasketPrices ()
 Round prices. Подробнее...
 
 roundChangedBasketPrices ()
 Round only changed prices. Подробнее...
 
 roundFullBasketPriceByIndex (array $index)
 Round prices in sale discount mode for new order. Подробнее...
 
 roundApplyBasketPricesByIndex (array $index)
 Round prices in sale discount mode for exist order. Подробнее...
 
 convertDiscount ($discount)
 Convert discount for saving in order. Подробнее...
 
 convertCoupon ($coupon, $discount)
 Convert coupon for saving in order. Подробнее...
 
 correctStepResult (&$stepResult, $discount)
 Correct data for exotic coupon. Подробнее...
 
 setDiscountStoredActionData ($orderDiscountId, array $data)
 Fill additional discount data. Подробнее...
 
 getDiscountStoredActionData ($orderDiscountId)
 Returns stored action data for discount. Подробнее...
 
 isBasketApplyResultExist ()
 Return true, if exist apply result from form for basket. Подробнее...
 
 getApplyDiscounts ()
 Returns discount and coupon list. Подробнее...
 
 getBasketTables ()
 Create correspondence between basket ids and basket codes. Подробнее...
 
 isCustomPriceByCode ($code)
 Returns exist custom price for basket item code. Подробнее...
 
 isInSetByCode ($code)
 Returns check item in set for basket item code. Подробнее...
 
 isNewBasketItemByCode ($code)
 Returns check new basket item for basket item code. Подробнее...
 
 isFreezedBasketItemByCode ($code)
 Returns true, if allowed apply discounts to basket item. Подробнее...
 
 isBasketItemChanged ($code)
 Return true if ordered basket item changed (change PRODUCT_ID). Подробнее...
 
 isExistBasketItem ($code)
 Return true, if basket item exists. Подробнее...
 
 isOrderChanged ()
 Returns true, if changed children order entities. Подробнее...
 
 isMixedBasket ()
 Returns exist new item in basket. Подробнее...
 
 isOrderedBasketChanged ()
 Return true if basket saved order changed (change PRODUCT_ID). Подробнее...
 
 getBasketCodes ($full=true)
 Returns basket codes for calculate. Подробнее...
 
 getAllowedBasketCodeList ()
 
 mergeDiscountActionResult ($index, $stepResult)
 Merge discount actions result with old data. Подробнее...
 
 clearCurrentApplyBlock ()
 Internal. Подробнее...
 
 fillEmptyCurrentStep ()
 Internal. Подробнее...
 
 fillCurrentStep ($data)
 Internal. Подробнее...
 
 extendOrderData ()
 Extend order data for discounts. Подробнее...
 
 modifyOrderData (&$newData)
 Modify order data from handlers. Подробнее...
 
 resetOrderState ()
 Set order parameters to their original state before the start of calculations. Подробнее...
 
 resetBasketPrices ()
 Fill basket prices from base prices. Подробнее...
 
 resetDiscountAppliedFlag ()
 Reset flag of applying discounts for basket items. Подробнее...
 
 executeDiscountList ()
 Execute sale discount list. Подробнее...
 
 fillBasketLastDiscount ()
 Fill last discount flag for basket items. Подробнее...
 
 isBasketLastDiscount ()
 Check last discount flag for basket items. Подробнее...
 
 clearAdditionalCoupons (array $coupons)
 Clear coupons from already used discounts. Подробнее...
 
 getAdditionalCoupons (array $filter=array())
 Return additional coupons for exist order. Подробнее...
 
 calculateApplyBasketAdditionalCoupons (array $applyCoupons)
 Calculate additional basket coupons. Подробнее...
 
 calculateApplySaleAdditionalCoupons (array $applyCoupons)
 Calculate additional sale coupons. Подробнее...
 
 getStatusApplyBasketDiscount ($basketCode, $orderDiscountId, $orderCouponId)
 Return apply status for basket discount. Подробнее...
 
 getSiteId ()
 Return site id for calculate. Подробнее...
 
 getCurrency ()
 Return order currency for calculate. Подробнее...
 
 getSiteCurrency ()
 Return site currency. Подробнее...
 
 loadDiscountByUserGroups (array $filter=array())
 Load from database discount id for user groups. Подробнее...
 
 loadDiscountModules (array $modules)
 Load discount modules. Подробнее...
 
 loadDiscountList ()
 Load sale discount from database. Подробнее...
 
 getOrderDiscountClassName ()
 Returns current order discount class name. Подробнее...
 
 getDiscountCouponClassName ()
 Returns current discount coupons manager class name. Подробнее...
 
 getShipmentClassName ()
 Return current shipment class name. Подробнее...
 

Защищенные статические члены

static getInstanceIndexByFuser ($fuser, $site)
 Return instance index for fuser. Подробнее...
 
static getStepResult (array $order)
 Returns result after one discount. Подробнее...
 
- Защищенные статические члены унаследованные от DiscountBase
static isCustomPrice (array $item)
 Returns exist custom price for basket item. Подробнее...
 
static isInSet (array $item)
 Returns check item in set for basket item. Подробнее...
 
static isNewBasketItem (array $item)
 Returns check new basket item for basket item. Подробнее...
 
static isFreezedBasketItem (array $item)
 Returns true, if allowed apply discounts to basket item. Подробнее...
 
static formatDescription ($descr)
 Return formatted discount description. Подробнее...
 
static instanceExists ($index)
 Returns true, if instance exist. Подробнее...
 
static getInstance ($index)
 Returns discount instance. Подробнее...
 
static migrateInstance ($oldIndex, $newIndex)
 
static removeInstance ($index)
 
static getInstanceIndexByOrder (OrderBase $order)
 Return instance index for order. Подробнее...
 
static getInstanceIndexByBasket (BasketBase $basket, Context\BaseContext $context=null)
 Return instance index for basket. Подробнее...
 
static getExecuteFieldName ($fieldName)
 Return field name for save eval result. Подробнее...
 
static getOrderPropertyCodes ()
 Return order property codes for translate to order fields. Подробнее...
 
static recursiveMerge (&$dest, $src)
 Added keys from source array to destination array. Подробнее...
 

Защищенные данные

 $shipment = null
 
 $shipmentIds = array()
 
 $enableCheckingPrediction = false
 
- Защищенные данные унаследованные от DiscountBase
 $isClone = false
 
 $orderRefresh = false
 
 $newOrder = null
 
 $useMode = null
 
 $context
 
 $order = null
 
 $executeModuleFilter = array('all', 'sale', 'catalog')
 
 $loadedModules = array()
 
 $discountIds = null
 
 $saleDiscountCache = array()
 
 $saleDiscountCacheKey = ''
 
 $basket = null
 
 $orderData = null
 
 $valid = true
 
 $saleOptions = array()
 
 $basketDiscountList = array()
 
 $basketItemsData = array()
 
 $discountsCache = array()
 
 $couponsCache = array()
 
 $discountResult = array()
 
 $discountResultCounter = 0
 
 $applyResult = array()
 
 $discountStoredActionData = array()
 
 $entityList = array()
 
 $entityResultCache = array()
 
 $currentStep = array()
 
 $forwardBasketTable = array()
 
 $reverseBasketTable = array()
 
 $roundApplyMode = self::ROUND_MODE_FINAL_PRICE
 
 $roundApplyConfig = array()
 
 $fullDiscountList = array()
 

Дополнительные унаследованные члены

- Поля данных унаследованные от DiscountBase
const EVENT_EXTEND_ORDER_DATA = 'onExtendOrderData'
 
const USE_MODE_FULL = 0x00001
 
const USE_MODE_APPLY = 0x0002
 
const USE_MODE_MIXED = 0x0004
 
const USE_MODE_COUPONS = 0x0008
 
const EXECUTE_FIELD_PREFIX = 'EXECUTE_'
 
const ERROR_ID = 'BX_SALE_DISCOUNT'
 
const APPLY_MODE_ADD = 0x0001
 
const APPLY_MODE_DISABLE = 0x0002
 
const APPLY_MODE_LAST = 0x0004
 
const APPLY_MODE_FULL_DISABLE = 0x0008
 
const APPLY_MODE_FULL_LAST = 0x0010
 
const ROUND_MODE_BASKET_DISCOUNT = 0x0001
 
const ROUND_MODE_SALE_DISCOUNT = 0x0002
 
const ROUND_MODE_FINAL_PRICE = 0x0004
 
const ENTITY_BASKET_ITEM = 'BASKET_ITEM'
 
const ENTITY_DELIVERY = 'DELIVERY'
 
const ENTITY_ORDER = 'ORDER'
 

Подробное описание

См. определение в файле sale/lib/discount.php строка 17

Методы

◆ applyLoadedOrderConfig()

applyLoadedOrderConfig ( array  $data)
protected
Аргументы
array$dataOrder settings from database.
Возвращает
void

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 660

661  {
662  parent::applyLoadedOrderConfig($data);
663 
664  if (isset($data['OLD_ORDER']))
665  $this->setValidState(false);
666 
667  /** @var Order $order */
668  $order = $this->getOrder();
669  if (!empty($data['DELIVERY']))
670  {
671  $delivery = $data['DELIVERY'];
672  $this->orderData['DELIVERY_ID'] = $delivery['DELIVERY_ID'];
673  if (isset($delivery['CUSTOM_PRICE_DELIVERY']))
674  $this->orderData['CUSTOM_PRICE_DELIVERY'] = $delivery['CUSTOM_PRICE_DELIVERY'];
675  if (isset($delivery['SHIPMENT_ID']))
676  {
677  $delivery['SHIPMENT_ID'] = (int)$delivery['SHIPMENT_ID'];
678  if ($delivery['SHIPMENT_ID'] > 0)
679  {
680  $this->shipmentIds[] = $delivery['SHIPMENT_ID'];
681  /** @var ShipmentCollection $orderShipmentList */
682  $orderShipmentList = $order->getShipmentCollection();
683  $this->shipment = $orderShipmentList->getItemById($delivery['SHIPMENT_ID']);
684  if (empty($this->shipment))
685  {
686  $this->shipment = null;
687  $this->shipmentIds = array();
688  }
689  }
690  }
691  unset($delivery);
692  }
693 
694  $this->fillCompatibleOrderFields();
695  }

◆ clearBasketItemData()

clearBasketItemData (   $code)

Clear basket item data.

Уст.:
Аргументы
int | string$codeBasket code.
Возвращает
void

См. определение в файле sale/lib/discount.php строка 912

912 {}

◆ createClone()

createClone ( \SplObjectStorage  $cloneEntity)

Clone entity.

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 104

105  {
106  /** @var Discount $discountClone */
107  $discountClone = parent::createClone($cloneEntity);
108 
109  if ($this->isShipmentExists())
110  {
111  if ($cloneEntity->contains($this->shipment))
112  $discountClone->shipment = $cloneEntity[$this->shipment];
113  }
114 
115  return $discountClone;
116  }

◆ disableCheckingPrediction()

disableCheckingPrediction ( )

Disables prediction checking instead real condition.

Возвращает
void

См. определение в файле sale/lib/discount.php строка 44

45  {
46  $this->enableCheckingPrediction = false;
47  }

◆ enableCheckingPrediction()

enableCheckingPrediction ( )

Enables prediction checking instead real condition.

Возвращает
void

См. определение в файле sale/lib/discount.php строка 32

33  {
34  $this->enableCheckingPrediction = true;
35  $this->saleOptions = array(
36  'APPLY_MODE' => $this::APPLY_MODE_ADD,
37  );
38  }

◆ fillCompatibleOrderFields()

fillCompatibleOrderFields ( )
protected

Fill order fields for deprecated discount classes.

Возвращает
void

См. определение в файле sale/lib/discount.php строка 844

845  {
846  $this->orderData['USE_BASE_PRICE'] = $this->saleOptions['USE_BASE_PRICE'];
847  }

◆ fillDiscountResult()

fillDiscountResult ( )
protected

Fill result order data.

Возвращает
array

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 471

472  {
473  $result = parent::fillDiscountResult();
474 
475  $orderKeys = ['PRICE_DELIVERY', 'PRICE_DELIVERY_DIFF'];
476  foreach ($orderKeys as $key)
477  {
478  if (isset($this->orderData[$key]))
479  $result[$key] = $this->orderData[$key];
480  }
481  unset($key, $orderKeys);
482  if (isset($result['PRICE_DELIVERY_DIFF']))
483  {
484  $result['DISCOUNT_PRICE'] = $result['PRICE_DELIVERY_DIFF'];
485  unset($result['PRICE_DELIVERY_DIFF']);
486  }
487 
488  $shipmentClassName = $this->getShipmentClassName();
489  $result['SHIPMENT'] = null;
490  if ($this->shipment instanceof $shipmentClassName)
491  $result['SHIPMENT'] = $this->shipment->getShipmentCode();
492  unset($shipmentClassName);
493 
494  return $result;
495  }

◆ fillEmptyDiscountResult()

fillEmptyDiscountResult ( )
protected

Fill empty discount result list.

Возвращает
void

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 459

460  {
461  parent::fillEmptyDiscountResult();
462  $this->discountResult['DELIVERY_LIST'] = [];
463  $this->discountResult['SHIPMENT_LIST'] = [];
464  }

◆ fillEmptyOrderData()

fillEmptyOrderData ( )
protected

Fill empty order data.

Возвращает
void

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 553

554  {
555  parent::fillEmptyOrderData();
556  $this->orderData += [
557  'BASE_PRICE_DELIVERY' => 0,
558  'PRICE_DELIVERY' => 0,
559  'PRICE_DELIVERY_DIFF' => 0,
560  'DELIVERY_ID' => 0,
561  'CUSTOM_PRICE_DELIVERY' => 'N',
562  'SHIPMENT_CODE' => 0,
563  'SHIPMENT_ID' => 0,
564  'PAY_SYSTEM_ID' => 0
565  ];
566 
567  if ($this->isOrderExists())
568  {
569  /** @var Order $order */
570  $order = $this->getOrder();
571 
572  $this->orderData['PAY_SYSTEM_ID'] = null;
573  $paymentCollection = $order->getPaymentCollection();
574  /** @var Payment $payment */
575  foreach ($paymentCollection as $payment)
576  {
577  if ($payment->isInner())
578  continue;
579  if (!isset($this->orderData['PAY_SYSTEM_ID']))
580  {
581  $this->orderData['PAY_SYSTEM_ID'] = (int)$payment->getPaymentSystemId();
582  break;
583  }
584  }
585  unset($payment, $paymentCollection);
586  if (!isset($this->orderData['PAY_SYSTEM_ID']))
587  $this->orderData['PAY_SYSTEM_ID'] = 0;
588 
589  unset($order);
590  }
591  }

◆ fillShipmentData()

fillShipmentData ( )
protected

Fill data from shipment.

Возвращает
void

См. определение в файле sale/lib/discount.php строка 713

714  {
715  if (!$this->isShipmentExists())
716  return;
717 
718  $this->orderData['DELIVERY_ID'] = $this->shipment->getDeliveryId();
719  $this->orderData['CUSTOM_PRICE_DELIVERY'] = ($this->shipment->isCustomPrice() ? 'Y' : 'N');
720  $this->orderData['BASE_PRICE_DELIVERY'] = $this->shipment->getField('BASE_PRICE_DELIVERY');
721  $this->orderData['PRICE_DELIVERY'] = $this->shipment->getPrice();
722  $this->orderData['PRICE_DELIVERY_DIFF'] = $this->shipment->getField('DISCOUNT_PRICE');
723  $this->orderData['SHIPMENT_CODE'] = $this->shipment->getShipmentCode();
724  $this->orderData['SHIPMENT_ID'] = (int)$this->shipment->getId();
725  }

◆ getApplyDeliveryList()

getApplyDeliveryList ( )
protected

Get discount delivery list and delivery list.

Возвращает
array

См. определение в файле sale/lib/discount.php строка 418

419  {
420  $result = array();
421 
422  $delivery = array();
423  if (!empty($this->discountResult['APPLY_BLOCKS']))
424  {
425  foreach ($this->discountResult['APPLY_BLOCKS'] as $counter => $applyBlock)
426  {
427  if (!empty($applyBlock['ORDER']))
428  {
429  foreach ($applyBlock['ORDER'] as $discount)
430  {
431  if (empty($discount['RESULT']['DELIVERY']))
432  continue;
433  $id = $discount['RESULT']['DELIVERY']['DELIVERY_ID'];
434  $delivery[$id] = $id;
435  }
436  unset($id, $discount);
437  }
438  }
439  unset($counter, $applyBlock);
440  }
441  $result['DELIVERY_LIST'] = (empty($delivery) ? array() : array_values($delivery));
442  unset($delivery);
443 
444  $shipmentClassName = $this->getShipmentClassName();
445  $shipment = [];
446  if ($this->shipment instanceof $shipmentClassName)
447  $shipment[] = $this->shipment->getShipmentCode();
448  $result['SHIPMENT_LIST'] = $shipment;
449  unset($shipment);
450 
451  return $result;
452  }

◆ getApplyDeliveryPrice()

getApplyDeliveryPrice ( )
protected

Returns delivery price data.

Возвращает
array

См. определение в файле sale/lib/discount.php строка 404

405  {
406  return array(
407  'BASE_PRICE' => $this->orderData['BASE_PRICE_DELIVERY'],
408  'PRICE' => $this->orderData['PRICE_DELIVERY'],
409  'DISCOUNT' => $this->orderData['PRICE_DELIVERY_DIFF']
410  );
411  }

◆ getApplyPrices()

getApplyPrices ( )
protected

Fill prices in apply results.

Возвращает
void

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 355

356  {
357  parent::getApplyPrices();
358  $this->discountResult['PRICES']['DELIVERY'] = $this->getApplyDeliveryPrice();
359  }

◆ getApplyResult()

getApplyResult (   $extMode = false)

Return discount list description.

Аргументы
bool$extModeExtended mode.
Возвращает
array

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 150

151  {
152  if (Compatible\DiscountCompatibility::isUsed())
154 
155  $extMode = ($extMode === true);
156 
157  $result = parent::getApplyResult($extMode);
158  $result = $this->getApplyDeliveryList() + $result;
159 
160  $result['CONVERTED_ORDER'] = (!$this->isValidState() ? 'Y' : 'N');
161 
162  if (!$extMode)
163  {
164  /* for compatibility only */
165  if (isset($this->discountResult['APPLY_BLOCKS'][0]['BASKET']))
166  $result['BASKET'] = $this->discountResult['APPLY_BLOCKS'][0]['BASKET'];
167  if (isset($this->discountResult['APPLY_BLOCKS'][0]['ORDER']))
168  $result['ORDER'] = $this->discountResult['APPLY_BLOCKS'][0]['ORDER'];
169  }
170  return $result;
171  }

◆ getBasketCurrency()

getBasketCurrency (   $basketCode)
protected

Return basket item currency.

Уст.:
Аргументы
string | int$basketCodeBasket item code.
Возвращает
string|null

См. определение в файле sale/lib/discount.php строка 982

983  {
984  return $this->getCurrency();
985  }

◆ getBasketItemBasePrice()

getBasketItemBasePrice (   $code)

Get base price for basket item.

Уст.:
Аргументы
int | string$codeBasket code.
Возвращает
float|null

См. определение в файле sale/lib/discount.php строка 880

881  {
882  return (isset($this->orderData[$code]) ? $this->orderData[$code]['BASE_PRICE'] : null);
883  }

◆ getConditionField()

getConditionField ( )
protected

Return field with discount condition code.

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 290

291  {
292  if (!$this->enableCheckingPrediction)
293  return parent::getConditionField();
294  return 'PREDICTIONS_APP';
295  }

◆ getEntitySaveIdentifier()

getEntitySaveIdentifier ( array  $entity)
protected

Returns data for save to database.

Аргументы
array$entity
Возвращает
array|null

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 805

806  {
807  $result = null;
808 
809  switch ($entity['ENTITY_TYPE'])
810  {
812  $result = [
813  'ENTITY_TYPE' => self::ENTITY_DELIVERY,
814  'ENTITY_ID' => (int)$entity['ENTITY_CODE'],
815  'ENTITY_VALUE' => (string)$entity['ENTITY_CODE']
816  ];
817  break;
818  default:
819  $result = parent::getEntitySaveIdentifier($entity);
820  break;
821  }
822 
823  return $result;
824  }

◆ getExecuteFieldList()

getExecuteFieldList ( )
protected

Return field list for eval.

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 276

277  {
278  if (!$this->enableCheckingPrediction)
279  return parent::getExecuteFieldList();
280  return ['PREDICTIONS_APP', 'APPLICATION'];
281  }

◆ getInstanceIndexByFuser()

static getInstanceIndexByFuser (   $fuser,
  $site 
)
staticprotected

Return instance index for fuser.

См. определение в файле sale/lib/discount.php строка 264

265  {
266  return '0|'.$fuser.'|'.$site;
267  }

◆ getOrderConfig()

getOrderConfig ( )
protected

Returns order configuration for save to database.

Возвращает
array

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 239

240  {
241  $shipmentClassName = $this->getShipmentClassName();
242  $config = parent::getOrderConfig();
243  $config['DELIVERY'] = [
244  'DELIVERY_ID' => $this->orderData['DELIVERY_ID'],
245  'CUSTOM_PRICE_DELIVERY' => $this->orderData['CUSTOM_PRICE_DELIVERY'],
246  'SHIPMENT_ID' => 0
247  ];
248  if ($this->shipment instanceof $shipmentClassName)
249  $config['DELIVERY']['SHIPMENT_ID'] = $this->shipment->getId();
250  unset($shipmentClassName);
251  return $config;
252  }

◆ getRegistryType()

static getRegistryType ( )
static

Return parent entity type.

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 70

71  {
73  }

◆ getShipmentsIds()

getShipmentsIds ( )

Return shipment id list for existing order.

Возвращает
array

См. определение в файле sale/lib/discount.php строка 91

92  {
93  return $this->shipmentIds;
94  }

◆ getShowPrices()

getShowPrices ( )

Returns show prices for public components.

Возвращает
array

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 178

179  {
180  $result = parent::getShowPrices();
181  $result['DELIVERY'] = $this->getApplyDeliveryPrice();
182 
183  return $result;
184  }

◆ getStepResult()

static getStepResult ( array  $order)
staticprotected

Returns result after one discount.

Аргументы
array$orderOrder current data.
Возвращает
array

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 303

304  {
305  $result = parent::getStepResult($order);;
306  $stepResult = &$order['DISCOUNT_RESULT'];
307  if (!empty($stepResult['DELIVERY']) && is_array($stepResult['DELIVERY']))
308  {
309  $result['DELIVERY'] = array(
310  'APPLY' => 'Y',
311  'DELIVERY_ID' => (isset($order['DELIVERY_ID']) ? $order['DELIVERY_ID'] : false),
312  'SHIPMENT_CODE' => (isset($order['SHIPMENT_CODE']) ? $order['SHIPMENT_CODE'] : false),
313  'DESCR' => Discount\Formatter::formatList($stepResult['DELIVERY']),
314  'DESCR_DATA' => $stepResult['DELIVERY'],
315  'ACTION_BLOCK_LIST' => array_keys($stepResult['DELIVERY'])
316  );
317  if (is_array($result['DELIVERY']['DESCR']))
318  $result['DELIVERY']['DESCR'] = implode(', ', $result['DELIVERY']['DESCR']);
319  }
320  unset($stepResult);
321 
322  return $result;
323  }

◆ initInstanceFromOrder()

initInstanceFromOrder ( )
protected

Initial instance data after set order.

Возвращает
void

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 790

791  {
792  parent::initInstanceFromOrder();
793  $this->loadShipment();
794  $this->fillShipmentData();
795  }

◆ isShipmentExists()

isShipmentExists ( )
protected

Return is exists discount shipment.

Возвращает
bool

См. определение в файле sale/lib/discount.php строка 702

703  {
704  $shipmentClassName = $this->getShipmentClassName();
705  return ($this->shipment instanceof $shipmentClassName);
706  }

◆ load()

static load ( Order  $order)
static

Get discount by order.

Уст.:
deprecated sinse sale 17.0.11
См. также
Discount::buildFromOrder
Аргументы
Order$orderOrder object.
Возвращает
Discount|DiscountBase

См. определение в файле sale/lib/discount.php строка 941

942  {
943  return static::buildFromOrder($order);
944  }

◆ loadBasket()

loadBasket ( )
protected

Get basket data from owner entity.

Возвращает
Result
Исключения
Main

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 599

600  {
601  $result = parent::loadBasket();
602  if (!$result->isSuccess())
603  return $result;
604 
605  if ($this->isBasketNotEmpty())
606  {
607  /** @var Basket $basket */
608  $basket = $this->getBasket();
609  /** @var BasketItem $basketItem */
610  foreach ($basket as $basketItem)
611  {
612  if (
613  !$basketItem->canBuy()
614  || !$basketItem->isBundleParent()
615  )
616  continue;
617 
618  $bundle = $basketItem->getBundleCollection();
619  if ($bundle->count() == 0)
620  {
621  $result->addError(new Main\Entity\EntityError(
622  Loc::getMessage('BX_SALE_DISCOUNT_ERR_BASKET_BUNDLE_EMPTY'),
623  self::ERROR_ID
624  ));
625  break;
626  }
627  /** @var BasketItem $bundleItem */
628  foreach ($bundle as $bundleItem)
629  {
630  $item = $this->getBasketItemFields($bundleItem);
631  $item['IN_SET'] = 'Y';
632  $this->orderData['BASKET_ITEMS'][$bundleItem->getBasketCode()] = $item;
633  }
634  unset($item, $bundle, $bundleItem);
635  }
636  unset($basketItem);
637  }
638 
639  return $result;
640  }

◆ loadByBasket()

static loadByBasket ( Basket  $basket)
static

Get discount by basket.

Уст.:
deprecated sinse sale 17.0.11
См. также
Discount::buildFromBasket
Аргументы
Basket$basketBasket object.
Возвращает
Discount|DiscountBase|null

См. определение в файле sale/lib/discount.php строка 923

924  {
925  $order = $basket->getOrder();
926  if ($order instanceof Order)
927  return static::buildFromOrder($order);
928 
929  return self::buildFromBasket($basket, new Context\Fuser($basket->getFUserId(true)));
930  }

◆ loadByFuser()

static loadByFuser (   $fuser,
  $site 
)
static

Get discount by fuser and site.

Аргументы
string | int$fuserFuser id.
string$siteSite id.
Возвращает
null|Discount|DiscountBase

См. определение в файле sale/lib/discount.php строка 56

57  {
58  $instanceIndex = static::getInstanceIndexByFuser((int)$fuser, (string)$site);
59  if (!static::instanceExists($instanceIndex))
60  return null;
61  return static::getInstance($instanceIndex);
62  }

◆ loadDefaultOrderConfig()

loadDefaultOrderConfig ( )
protected

Load default order config for order.

Возвращает
void

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 647

648  {
649  parent::loadDefaultOrderConfig();
650 
651  $this->shipment = null;
652 
653  $this->fillCompatibleOrderFields();
654  }

◆ loadOrderData()

loadOrderData ( )
protected

Load order information.

Возвращает
Result

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 526

527  {
528  $result = parent::loadOrderData();
529  if (!$result->isSuccess())
530  return $result;
531 
532  if (!$this->isShipmentExists())
533  {
534  $this->shipmentIds = [];
535  $shipmentResult = $this->loadShipment();
536  if (!$shipmentResult->isSuccess())
537  {
538  $result->addErrors($shipmentResult->getErrors());
539  return $result;
540  }
541  unset($shipmentResult);
542  }
543  $this->fillShipmentData();
544 
545  return $result;
546  }

◆ loadShipment()

loadShipment ( )
protected

Load shipment.

Возвращает
Result

См. определение в файле sale/lib/discount.php строка 732

733  {
734  $result = new Result;
735  if (!$this->isOrderExists())
736  return $result;
737  if (!$this->isShipmentExists())
738  {
739  $loadDelivery = false;
740  /** @var Order $order */
741  $order = $this->getOrder();
742  /** @var ShipmentCollection $orderShipmentList */
743  $orderShipmentList = $order->getShipmentCollection();
744  /** @var Shipment $shipment */
745  if ($this->isOrderNew())
746  {
747  foreach ($orderShipmentList as $shipment)
748  {
749  if ($shipment->isSystem())
750  continue;
751 
752  if (!$loadDelivery)
753  {
754  $this->shipment = $shipment;
755  $loadDelivery = true;
756  break;
757  }
758  }
759  }
760  else
761  {
762  $shipmentId = false;
763  foreach ($orderShipmentList as $shipment)
764  {
765  if ($shipment->isSystem())
766  continue;
767 
768  $currentShipmentId = (int)$shipment->getId();
769  if ($shipmentId === false || $shipmentId > $currentShipmentId)
770  $shipmentId = $currentShipmentId;
771  }
772  unset($currentShipmentId, $shipment);
773  if (!empty($shipmentId))
774  {
775  $this->shipment = $orderShipmentList->getItemById($shipmentId);
776  $loadDelivery = true;
777  }
778  unset($shipmentId);
779  }
780  unset($loadDelivery);
781  }
782  return $result;
783  }

◆ normalizeDiscountResult()

normalizeDiscountResult ( )
protected

Round and correct discount calculation results.

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 331

332  {
333  parent::normalizeDiscountResult();
334 
335  $customPrice = isset($this->orderData['CUSTOM_PRICE_DELIVERY']) && $this->orderData['CUSTOM_PRICE_DELIVERY'] == 'Y';
336  $this->orderData['PRICE_DELIVERY_DIFF'] = (!$customPrice
337  ? PriceMaths::roundPrecision($this->orderData['PRICE_DELIVERY_DIFF'])
338  : 0
339  );
340  if (!$customPrice)
341  {
342  if ($this->orderData['PRICE_DELIVERY_DIFF'] > 0)
343  $this->orderData['PRICE_DELIVERY'] = $this->orderData['BASE_PRICE_DELIVERY'] - $this->orderData['PRICE_DELIVERY_DIFF'];
344  else
345  $this->orderData['PRICE_DELIVERY'] = PriceMaths::roundPrecision($this->orderData['PRICE_DELIVERY']);
346  }
347  unset($customPrice);
348  }

◆ remakingDiscountResult()

remakingDiscountResult ( )
protected

Change result format.

Возвращает
void

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 366

367  {
368  parent::remakingDiscountResult();
369 
370  $delivery = [];
371  if (!empty($this->discountResult['APPLY_BLOCKS']))
372  {
373  foreach ($this->discountResult['APPLY_BLOCKS'] as $counter => $applyBlock)
374  {
375  if (!empty($applyBlock['ORDER']))
376  {
377  foreach ($applyBlock['ORDER'] as $discount)
378  {
379  if (!empty($discount['RESULT']['DELIVERY']))
380  {
381  $delivery[] = [
382  'DISCOUNT_ID' => $discount['DISCOUNT_ID'],
383  'COUPON_ID' => $discount['COUPON_ID'],
384  'DELIVERY_ID' => $discount['RESULT']['DELIVERY']['DELIVERY_ID'],
385  'APPLY' => $discount['RESULT']['DELIVERY']['APPLY'],
386  'DESCR' => $discount['RESULT']['DELIVERY']['DESCR']
387  ];
388  }
389  }
390  unset($discount);
391  }
392  }
393  unset($counter, $applyBlock);
394  }
395  $this->discountResult['RESULT']['DELIVERY'] = $delivery;
396  unset($delivery);
397  }

◆ resetDeliveryPrices()

resetDeliveryPrices ( )
protected

Fill delivery price from base price.

Возвращает
void

См. определение в файле sale/lib/discount.php строка 513

514  {
515  if ($this->orderData['CUSTOM_PRICE_DELIVERY'] !== 'N')
516  return;
517  $this->orderData['PRICE_DELIVERY'] = $this->orderData['BASE_PRICE_DELIVERY'];
518  $this->orderData['PRICE_DELIVERY_DIFF'] = 0;
519  }

◆ resetPrices()

resetPrices ( )
protected

Fill prices from base prices.

Возвращает
void

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 502

503  {
504  parent::resetPrices();
505  $this->resetDeliveryPrices();
506  }

◆ save()

save ( )

Save discount result.

Возвращает
Result

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 191

192  {
193  $result = new Result;
194  if (!$this->isOrderExists() || !$this->isBasketNotEmpty())
195  return $result;
196 
197  if ($this->isUsedDiscountCompatibility())
198  {
199  if (Compatible\DiscountCompatibility::isRepeatSave())
200  return $result;
201  $compatibleResult = Compatible\DiscountCompatibility::getResult();
202  if ($compatibleResult === false)
203  return $result;
204  if (empty($compatibleResult))
205  return $result;
206 
207  $this->setUseMode($compatibleResult['CALCULATE']['USE_MODE']);
208  $this->newOrder = $compatibleResult['CALCULATE']['NEW_ORDER'];
209  $this->discountsCache = $compatibleResult['DISCOUNT_LIST'];
210  $this->couponsCache = $compatibleResult['COUPONS_LIST'];
211  $this->discountResult = $compatibleResult['DISCOUNT_RESULT'];
212  $this->forwardBasketTable = $compatibleResult['FORWARD_BASKET_TABLE'];
213  $this->reverseBasketTable = $compatibleResult['REVERSE_BASKET_TABLE'];
214  if ($this->isOrderNew())
215  {
216  $shipmentResult = $this->loadShipment();
217  if (!$shipmentResult->isSuccess())
218  {
219  $result->addErrors($shipmentResult->getErrors());
220  unset($shipmentResult);
221  return $result;
222  }
223  unset($shipmentResult);
224  $this->fillShipmentData();
225  }
226  unset($compatibleResult);
227  }
228 
229  $result = parent::save();
230 
231  return $result;
232  }

◆ saveExternalLastApplyblock()

saveExternalLastApplyblock ( BasketItem  $basketItem,
  $orderDiscountId 
)
Уст.:
Аргументы
BasketItem$basketItem
int$orderDiscountId
Возвращает
void
Исключения

См. определение в файле sale/lib/discount.php строка 954

955  {
956  /** @var Basket $basket */
957  $basket = $basketItem->getCollection();
958  $this->order = $basket->getOrder();
959 
960  $this->loadOrderData();
961 
962  $listItems[$basketItem->getBasketCode()] = array('APPLY'=>'Y', 'ACTION_BLOCK_LIST'=>array(), 'DESCR_DATA'=>array(), 'DESCR'=>array());
963 
964  $this->discountsCache[$orderDiscountId]['MODULE_ID'] = 'sale';
965  $applyBlock = &$this->discountResult['APPLY_BLOCKS'][$this->discountResultCounter];
966  $applyBlock['ORDER'][] = array(
967  'DISCOUNT_ID' => $orderDiscountId,
968  'COUPON_ID' => 0,
969  'RESULT' => array('BASKET' => $listItems)
970  );
971 
972  $this->saveLastApplyBlock();
973  }

◆ setApplyResult()

setApplyResult (   $applyResult)

Change applied discount list.

Аргументы
array$applyResultChange apply result.
Возвращает
void

Переопределяет метод предка DiscountBase.

См. определение в файле sale/lib/discount.php строка 126

127  {
128  parent::setApplyResult($applyResult);
129 
130  if (!empty($this->applyResult['DISCOUNT_LIST']))
131  {
132  if (!empty($this->applyResult['DELIVERY']) && is_array($this->applyResult['DELIVERY']))
133  {
134  foreach ($this->applyResult['DELIVERY'] as $orderDiscountId => $apply)
135  {
136  if ($apply == 'Y')
137  $this->applyResult['DISCOUNT_LIST'][$orderDiscountId] = 'Y';
138  }
139  unset($apply, $orderDiscountId);
140  }
141  }
142  }

◆ setBasketBasePrice()

setBasketBasePrice (   $basket)

Set base price for all basket items.

Уст.:
Аргументы
array$basketBasket.
Возвращает
void

См. определение в файле sale/lib/discount.php строка 871

871 {}

◆ setBasketItemBasePrice()

setBasketItemBasePrice (   $code,
  $price,
  $currency 
)

Set base price for basket item.

Уст.:
Аргументы
int | string$codeBasket code.
float$pricePrice.
string$currencyCurrency.
Возвращает
void

См. определение в файле sale/lib/discount.php строка 862

862 {}

◆ setBasketItemData()

setBasketItemData (   $code,
  $providerData 
)

Set various basket item data.

Уст.:
Аргументы
int | string$codeBasket code.
array$providerDataProduct data from provider.
Возвращает
void

См. определение в файле sale/lib/discount.php строка 903

903 {}

◆ setBasketItemDiscounts()

setBasketItemDiscounts (   $code,
  $discountList 
)

Set product discounts for basket item.

Уст.:
Аргументы
int | string$codeBasket code.
array$discountListDiscount list.
Возвращает
void

См. определение в файле sale/lib/discount.php строка 893

893 {}

◆ setCalculateShipments()

setCalculateShipments ( Shipment  $shipment = null)

Set calculate shipments.

Аргументы
Shipment$shipmentCurrent shipment.
Возвращает
void

См. определение в файле sale/lib/discount.php строка 81

82  {
83  $this->shipment = $shipment;
84  }

Поля

◆ $enableCheckingPrediction

$enableCheckingPrediction = false
protected

См. определение в файле sale/lib/discount.php строка 26

◆ $shipment

null Shipment $shipment = null
protected

См. определение в файле sale/lib/discount.php строка 21

◆ $shipmentIds

$shipmentIds = array()
protected

См. определение в файле sale/lib/discount.php строка 23


Объявления и описания членов класса находятся в файле:
Bitrix\Sale\DiscountBase\isValidState
isValidState()
Definition: discountbase.php:697
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Returns translation by message code.
Definition: loc.php:29
Bitrix\Sale\DiscountBase\$applyResult
$applyResult
Definition: discountbase.php:115
Bitrix\Sale\Discount\fillCompatibleOrderFields
fillCompatibleOrderFields()
Fill order fields for deprecated discount classes.
Definition: sale/lib/discount.php:844
Bitrix\Sale\DiscountBase\getBasketItemFields
getBasketItemFields(BasketItemBase $basketItem)
Returns array with basket item field values.
Definition: discountbase.php:978
Bitrix\Forum\Internals\getInstance
static getInstance($object)
Definition: forum/lib/internals/entityfabric.php:43
Bitrix\Sale\Discount\Formatter\formatList
static formatList(array $actionList)
Format discount result.
Definition: sale/lib/discount/formatter.php:347
Bitrix\Sale\DiscountBase\buildFromBasket
static buildFromBasket(BasketBase $basket, Context\BaseContext $context)
Builds discounts from basket.
Definition: discountbase.php:288
Bitrix\Sale\Registry\REGISTRY_TYPE_ORDER
const REGISTRY_TYPE_ORDER
Definition: sale/lib/registry.php:16
Bitrix\Sale\DiscountBase\saveLastApplyBlock
saveLastApplyBlock()
Save result last apply block discount.
Definition: discountbase.php:1963
Bitrix\Sale\DiscountBase\getBasket
getBasket()
Return current basket.
Definition: discountbase.php:774
Bitrix\Sale\Discount\$shipment
$shipment
Definition: sale/lib/discount.php:21
Bitrix\Sale\DiscountBase\getOrder
getOrder()
Return order.
Definition: discountbase.php:5241
Bitrix\Sale\Discount\getApplyDeliveryPrice
getApplyDeliveryPrice()
Returns delivery price data.
Definition: sale/lib/discount.php:404
Bitrix\Sale\Discount\loadShipment
loadShipment()
Load shipment.
Definition: sale/lib/discount.php:732
Bitrix\Sale\DiscountBase\setValidState
setValidState($value)
Definition: discountbase.php:702
Bitrix\Sale\DiscountBase\$order
$order
Definition: discountbase.php:63
Bitrix\Sale\Discount\isShipmentExists
isShipmentExists()
Return is exists discount shipment.
Definition: sale/lib/discount.php:702
Bitrix\Sale\DiscountBase\$discountResultCounter
$discountResultCounter
Definition: discountbase.php:113
Bitrix\Sale\DiscountBase\$basket
$basket
Definition: discountbase.php:84
Bitrix\Sale\DiscountBase\getCurrency
getCurrency()
Return order currency for calculate.
Definition: discountbase.php:5277
Bitrix\Sale\DiscountBase\setUseMode
setUseMode($useMode)
Set calculate mode.
Definition: discountbase.php:354
Bitrix\Sale\Discount\getApplyDeliveryList
getApplyDeliveryList()
Get discount delivery list and delivery list.
Definition: sale/lib/discount.php:418
Bitrix\Sale\Compatible\DiscountCompatibility\isRepeatSave
static isRepeatSave()
Return repeat save flag (for old components only).
Definition: discountcompatibility.php:234
Bitrix\Sale\Compatible\DiscountCompatibility\getResult
static getResult()
Return discount result for old api.
Definition: discountcompatibility.php:915
Bitrix\Sale\Discount\$shipmentIds
$shipmentIds
Definition: sale/lib/discount.php:23
Bitrix\Sale\Discount\loadOrderData
loadOrderData()
Load order information.
Definition: sale/lib/discount.php:526
Bitrix\Sale\Discount\enableCheckingPrediction
enableCheckingPrediction()
Enables prediction checking instead real condition.
Definition: sale/lib/discount.php:32
Bitrix\Sale\DiscountBase\isOrderExists
isOrderExists()
Return flag is order exists.
Definition: discountbase.php:5251
Bitrix\Sale\DiscountBase\ENTITY_DELIVERY
const ENTITY_DELIVERY
Definition: discountbase.php:43
Bitrix\Sale\Discount\fillShipmentData
fillShipmentData()
Fill data from shipment.
Definition: sale/lib/discount.php:713
Bitrix\Sale\DiscountBase\isBasketNotEmpty
isBasketNotEmpty()
Returns the existence of a non-empty basket.
Definition: discountbase.php:800
Bitrix\Sale\DiscountBase\isOrderNew
isOrderNew()
Returns new order flag value.
Definition: discountbase.php:226
Bitrix\Sale\DiscountBase\getShipmentClassName
getShipmentClassName()
Return current shipment class name.
Definition: discountbase.php:5562
Bitrix\Sale\PriceMaths\roundPrecision
static roundPrecision($value)
Definition: pricemaths.php:17
Bitrix\Sale\Discount\resetDeliveryPrices
resetDeliveryPrices()
Fill delivery price from base price.
Definition: sale/lib/discount.php:513
Bitrix\Sale\Compatible\DiscountCompatibility\getApplyResult
static getApplyResult($extMode=false)
Return discount list description.
Definition: discountcompatibility.php:883
Bitrix\Sale\Compatible\DiscountCompatibility\isUsed
static isUsed()
Check used compatible calculate.
Definition: discountcompatibility.php:360