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

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

static getReservationPoolItem ($key, BasketItem $item)
 
static getQuantityPoolItem ($key, BasketItem $item)
 
static addQuantityPoolItem ($key, BasketItem $item, $value)
 
static onOrderSave (Order $order)
 
static shipBasketItem (BasketItemBase $basketItem)
 
static shipShipment (Shipment $shipment)
 
static shipProductData ($provider, array $fields, array $storeDataList=array())
 
static getProductAvailableQuantity (Basket $basketCollection, BasketItem $refreshItem=null)
 
static getProductData (BasketItemCollection $basketCollection, array $select=array(), BasketItem $refreshItem=null)
 
static getProductDataByList (array $products, $providerClassName=null, array $select=array(), array $context, array $options=array())
 
static getProductProviderData (array $products, $provider, array $data, array $select=array())
 
static getCatalogData (array $basketProviderList, array $context, array $select=array())
 
static tryShipment (Shipment $shipment)
 
static tryShipmentItemList ($shipmentItemList)
 
static tryReserveShipment (Shipment $shipment)
 
static tryUnreserveShipment (Shipment $shipment)
 
static tryReserveShipmentItem (ShipmentItem $shipmentItem)
 
static tryUnreserveShipmentItem (ShipmentItem $shipmentItem)
 
static reserveProduct ($provider, $productId, $quantity)
 
static reserveShipmentItem (ShipmentItem $shipmentItem, $quantity)
 
static syncReservedQuantity (Shipment $shipment)
 
static reduceProductQuantity (ShipmentCollection $shipmentCollection, array $shipmentReserveList=array())
 reduce in the quantity of product if the reservation is disabled Подробнее...
 
static increaseProductQuantity (ShipmentCollection $shipmentCollection, array $shipmentReserveList=array())
 increase in the quantity of product if the reservation is disabled Подробнее...
 
static getProductStores (BasketItem $basketItem)
 
static getStores ($provider, array $fields)
 
static checkProductBarcode (BasketItem $basketItem, array $params=array())
 
static checkBarcode ($provider, array $barcodeParams)
 
static viewProduct (BasketItem $basketItem)
 
static getViewProduct ($provider, array $fields)
 
static recurringOrderProduct (BasketItem $basketItem)
 
static recurringProduct ($provider, array $fields)
 
static getSetItems (BasketItemBase $basketItem)
 
static getBundleChildItems ($providerName, array $products)
 
static checkAvailableProductQuantity (BasketItemBase $basketItem, $deltaQuantity)
 
static deliverShipment (Shipment $shipment)
 
static deliverProductData ($provider, array $fields)
 
static setUsingTrustData ($value)
 
static isReadTrustData ()
 
static isExistsTrustData ($siteId, $module, $productId)
 
static setTrustData ($siteId, $module, $productId, array $fields)
 
static getTrustData ($siteId, $module, $productId)
 
static resetTrustData ($siteId=null, $module=null, $productId=null)
 
static getUpdatableFields ()
 
static getAvailableQuantity ($providerClass, array $products, array $context)
 
static getAvailableQuantityAndPrice ($providerClass, array $products, array $context)
 
static isNeedShip ($shipmentItemList)
 

Поля данных

const POOL_ACTION_RESERVATION = "RESERVE"
 
const POOL_ACTION_SHIP = "SHIP"
 

Статические открытые данные

static $productData = array()
 

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

static getReservationPool ($key)
 
static resetReservationPool ($key)
 
static setReservationPoolItem ($key, BasketItem $item, $value)
 
static addReservationPoolItem ($key, BasketItem $item, $value)
 
static getQuantityPool ($key)
 
static resetQuantityPool ($key)
 
static setQuantityPoolItem ($key, BasketItem $item, $value)
 
static getBundleIndexFromShipmentItemCollection ($shipmentItemList)
 
static getBasketFromShipmentItemCollection ($shipmentItemList)
 
static getBasketCountFromShipmentItemCollection ($shipmentItemList)
 
static getStoreDataFromShipmentItemCollection ($shipmentItemList)
 
static makeArrayFromBasketCollection (BasketItemCollection $basketCollection, BasketItem $refreshItem=null)
 
static tryReserveBasketItem (BasketItem $basketItem, $quantity)
 
static getProductListFromBasketProviderList ($basketProviderList, array $productList=array())
 
static createProviderBasketMap (array $basketList, array $select=array())
 
static createProviderBasketItemMap (BasketItem $basketItem, array $select=array())
 
static redistributeToProviders (array $basketProviderMap)
 
static refreshMarkers (Order $order)
 
static getPrimaryFields ()
 
static getProductDataRequiredFields ()
 
static getProductDataRequiredPriceFields ()
 
static getPriceFields ()
 

Статические защищенные данные

static $reservationPool = array()
 
static $hitCache = array()
 
static $trustData = array()
 
static $useReadTrustData = false
 
static $quantityPool = array()
 

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

См. определение в файле providerbase.php строка 27

Методы

◆ addQuantityPoolItem()

static addQuantityPoolItem (   $key,
BasketItem  $item,
  $value 
)
static

См. определение в файле providerbase.php строка 159

160  {
162  $pool->add(Internals\PoolQuantity::POOL_QUANTITY_TYPE, $item->getField('PRODUCT_ID'), $value);
163  }

◆ addReservationPoolItem()

static addReservationPoolItem (   $key,
BasketItem  $item,
  $value 
)
staticprotected
Аргументы
$key
BasketItem$item
$value

См. определение в файле providerbase.php строка 101

102  {
104  $pool->add(Internals\PoolQuantity::POOL_RESERVE_TYPE, $item->getField('PRODUCT_ID'), $value);
105  }

◆ checkAvailableProductQuantity()

static checkAvailableProductQuantity ( BasketItemBase  $basketItem,
  $deltaQuantity 
)
static
Аргументы
BasketItemBase$basketItem
$deltaQuantity
Возвращает
Result
Исключения
NotSupportedException
ObjectNotFoundException

См. определение в файле providerbase.php строка 4426

4427  {
4428  global $APPLICATION;
4429 
4430  $result = new Result();
4431 
4432  $resultProductData = array();
4433 
4434  $orderId = null;
4435  $userId = null;
4436  $siteId = null;
4437 
4438  /** @var BasketItemCollection $collection */
4439  $collection = $basketItem->getCollection();
4440 
4441  /** @var Basket $basket */
4442  if (!$basket = $collection->getBasket())
4443  {
4444  throw new ObjectNotFoundException('Entity "Basket" not found');
4445  }
4446 
4447 
4448  if (($order = $basket->getOrder()) !== null)
4449  {
4450  $userId = $order->getUserId();
4451  $siteId = $order->getSiteId();
4452  }
4453 
4454  if ($siteId === null)
4455  {
4456  $siteId = $basket->getSiteId();
4457  }
4458 
4459  $provider = $basketItem->getProvider();
4460 
4461  if (!empty($provider))
4462  {
4463  if (array_key_exists("IBXSaleProductProvider", class_implements($provider)))
4464  {
4465  $needQuantity = $basketItem->getQuantity();
4466  if ($order && $order->getId() > 0)
4467  {
4468  $needQuantity = $deltaQuantity;
4469  }
4470 
4471  $poolQuantity = 0;
4472 
4473  if ($order)
4474  {
4475  $poolQuantity = static::getQuantityPoolItem($order->getInternalId(), $basketItem);
4476  }
4477 
4478  $checkQuantity = $needQuantity - floatval($poolQuantity);
4479 
4480  $data = array(
4481  "PRODUCT_ID" => $basketItem->getProductId(),
4482  "QUANTITY" => $checkQuantity,
4483  "USER_ID" => $userId,
4484  "SITE_ID" => $siteId,
4485  "BASKET_ID" => $basketItem->getId(),
4486  "CHECK_QUANTITY" => "Y",
4487  "AVAILABLE_QUANTITY" => "Y",
4488  'CHECK_PRICE' => 'N',
4489  'CHECK_COUPONS' => 'N',
4490  "SELECT_QUANTITY_TRACE" => "Y",
4491  );
4492 
4493  // TODO: !
4494  if ($deltaQuantity <= 0 || $checkQuantity == 0)
4495  {
4496  $result->setData(array('AVAILABLE_QUANTITY' => $deltaQuantity));
4497  return $result;
4498  }
4499 
4500  $hasTrustData = false;
4501 
4502  $trustData = static::getTrustData($siteId, $basketItem->getField('MODULE'), $basketItem->getField('PRODUCT_ID'));
4503 
4504  if (static::isReadTrustData() === true
4505  && !empty($trustData) && is_array($trustData))
4506  {
4507  $hasTrustData = true;
4508  $resultProductData = $trustData;
4509  $productDataRequiredFields = array_merge(static::getProductDataRequiredFields(), array('AVAILABLE_QUANTITY'));
4510  foreach ($productDataRequiredFields as $requiredField)
4511  {
4512  if (!array_key_exists($requiredField, $resultProductData))
4513  {
4514  $hasTrustData = false;
4515  break;
4516  }
4517  }
4518 
4519  if ($hasTrustData
4520  && roundEx($checkQuantity, SALE_VALUE_PRECISION) > roundEx($resultProductData["AVAILABLE_QUANTITY"], SALE_VALUE_PRECISION))
4521  {
4522  $hasTrustData = false;
4523  }
4524 
4525  }
4526 
4527  if(!$hasTrustData)
4528  {
4529  $APPLICATION->ResetException();
4530  $resultProductData = $provider::GetProductData($data);
4531  $ex = $APPLICATION->GetException();
4532  if ($ex)
4533  {
4534  $result->addWarning( new ResultWarning($ex->GetString(), $ex->GetID()) );
4535  }
4536  }
4537 
4538  }
4539  elseif (class_exists($provider))
4540  {
4541  /** @var SaleProviderBase $providerClass */
4542  $providerClass = new $provider();
4543  if ($providerClass && $providerClass instanceof SaleProviderBase)
4544  {
4545  $productId = $basketItem->getProductId();
4546  $products = array(
4547  $productId => array(
4548  'ITEM_CODE' => $productId,
4549  'BASKET_CODE' => $basketItem->getBasketCode(),
4550  'QUANTITY' => $deltaQuantity,
4551  )
4552  );
4553  $r = $providerClass->getAvailableQuantity($products);
4554  if ($r->isSuccess())
4555  {
4556  $resultData = $r->getData();
4557  if (!empty($resultData['AVAILABLE_QUANTITY_LIST']))
4558  {
4559  $resultProductData = array(
4560  'AVAILABLE_QUANTITY' => reset($resultData['AVAILABLE_QUANTITY_LIST'])
4561  );
4562  }
4563  }
4564  }
4565  }
4566  else
4567  {
4568  $APPLICATION->ResetException();
4569  $resultProductData = \CSaleBasket::ExecuteCallbackFunction(
4570  $basketItem->getField('CALLBACK_FUNC'),
4571  $basketItem->getField('MODULE'),
4572  $basketItem->getProductId(),
4573  $basketItem->getQuantity()
4574  );
4575 
4576  if ($ex = $APPLICATION->GetException())
4577  {
4578  $result->addWarning( new ResultWarning($ex->GetString(), $ex->GetID()) );
4579  }
4580  }
4581  }
4582  else
4583  {
4584  $availableQuantity = $basketItem->getQuantity();
4585  if ($deltaQuantity <= 0)
4586  {
4587  $availableQuantity = $deltaQuantity;
4588  }
4589  $result->setData(array(
4590  'AVAILABLE_QUANTITY' => $availableQuantity
4591  ));
4592  return $result;
4593  }
4594 
4595  $fields = array();
4596 
4597  if (array_key_exists('AVAILABLE_QUANTITY', $resultProductData))
4598  {
4599  $fields['AVAILABLE_QUANTITY'] = $resultProductData['AVAILABLE_QUANTITY'];
4600  }
4601 
4602  if (array_key_exists('QUANTITY_TRACE', $resultProductData))
4603  {
4604  $fields['QUANTITY_TRACE'] = ($resultProductData['QUANTITY_TRACE'] == "Y");
4605  }
4606 
4607  if (!empty($fields))
4608  {
4609  $result->setData($fields);
4610  }
4611 
4612  return $result;
4613  }

◆ checkBarcode()

static checkBarcode (   $provider,
array  $barcodeParams 
)
static

См. определение в файле providerbase.php строка 3957

3958  {
3959  $result = new Result();
3960  if (!array_key_exists("IBXSaleProductProvider", class_implements($provider)))
3961  {
3962  return $result;
3963  }
3964 
3965  $resultData = $provider::checkProductBarcode($barcodeParams);
3966 
3967  $result->setData(
3968  array(
3969  $barcodeParams["PRODUCT_ID"] => $resultData
3970  )
3971  );
3972 
3973  return $result;
3974  }

◆ checkProductBarcode()

static checkProductBarcode ( BasketItem  $basketItem,
array  $params = array() 
)
static
Аргументы
BasketItem$basketItem
array$params
Возвращает
bool
Исключения
ObjectNotFoundException

См. определение в файле providerbase.php строка 3862

3863  {
3864 
3865  $provider = $basketItem->getProvider();
3866  $productId = $basketItem->getProductId();
3867  $data = array(
3868  'BARCODE' => $params['BARCODE'],
3869  'STORE_ID' => $params['STORE_ID'],
3870  'PRODUCT_ID' => $productId
3871  );
3872  $result = false;
3873 
3874  if ($provider && array_key_exists("IBXSaleProductProvider", class_implements($provider)))
3875  {
3876  $r = static::checkBarcode($provider, $data);
3877  if ($r->isSuccess())
3878  {
3879  $resultData = $r->getData();
3880  if (!empty($resultData) && array_key_exists($productId, $resultData))
3881  {
3882  $result = $resultData[$productId];
3883  }
3884  }
3885  }
3886  elseif (class_exists($provider))
3887  {
3888  /** @var Basket $basket */
3889  $basket = $basketItem->getCollection();
3890  if (!$basket)
3891  {
3892  throw new ObjectNotFoundException('Entity "Basket" not found');
3893  }
3894 
3895  $order = $basket->getOrder();
3896 
3897  if ($order)
3898  {
3899  $context = array(
3900  'USER_ID' => $order->getUserId(),
3901  'SITE_ID' => $order->getSiteId(),
3902  'CURRENCY' => $order->getCurrency(),
3903  );
3904  }
3905  else
3906  {
3907  global $USER;
3908  $context = array(
3909  'USER_ID' => $USER->getId(),
3910  'SITE_ID' => SITE_ID,
3911  'CURRENCY' => Currency\CurrencyManager::getBaseCurrency(),
3912  );
3913  }
3914 
3915  $creator = Internals\ProviderCreator::create($context);
3916 
3917  $providerClass = $basketItem->getProviderEntity();
3918  if ($providerClass instanceof SaleProviderBase)
3919  {
3920  $creator->addBasketItemBarcodeData($basketItem, $data);
3921  }
3922 
3923  $r = $creator->checkBarcode();
3924  if ($r->isSuccess())
3925  {
3926  if (!empty($providerClass))
3927  {
3928  $reflect = new \ReflectionClass($provider);
3929  $providerName = $reflect->getName();
3930  }
3931  else
3932  {
3933  $providerName = $basketItem->getCallbackFunction();
3934  }
3935 
3936  $resultData = $r->getData();
3937  if (!empty($resultData) && array_key_exists('BARCODE_CHECK_LIST', $resultData))
3938  {
3939  $resultList = $resultData['BARCODE_CHECK_LIST'];
3940  if (isset($resultList[$providerName]) && isset($resultList[$providerName][$data['BARCODE']]))
3941  {
3942  $result = $resultList[$providerName][$data['BARCODE']];
3943  }
3944  }
3945  }
3946  }
3947  return $result;
3948  }

◆ createProviderBasketItemMap()

static createProviderBasketItemMap ( BasketItem  $basketItem,
array  $select = array() 
)
staticprotected

См. определение в файле providerbase.php строка 5160

5161  {
5162 
5163  $basketProviderData = array(
5164  'BASKET_ITEM' => $basketItem,
5165  'BASKET_ID' => $basketItem->getId(),
5166  'BASKET_CODE' => $basketItem->getBasketCode(),
5167  'PRODUCT_ID' => $basketItem->getProductId(),
5168  'MODULE' => $basketItem->getField('MODULE'),
5169  );
5170 
5171  $provider = $basketItem->getProvider();
5172  $providerClass = $basketItem->getProviderEntity();
5173  if ($provider)
5174  {
5175  if (array_key_exists("IBXSaleProductProvider", class_implements($provider))
5176  || $providerClass instanceof SaleProviderBase)
5177  {
5178  $basketProviderData['PROVIDER'] = $provider;
5179  }
5180  }
5181  elseif (strval($basketItem->getField('CALLBACK_FUNC')) != '')
5182  {
5183  $basketProviderData['CALLBACK_FUNC'] = $basketItem->getField('CALLBACK_FUNC');
5184  }
5185  elseif (strval($basketItem->getField('PAY_CALLBACK_FUNC')) != '' && in_array('PAY_CALLBACK', $select))
5186  {
5187  $basketProviderData['CALLBACK_FUNC'] = $basketItem->getField('PAY_CALLBACK_FUNC');
5188  }
5189 
5190  if (in_array('QUANTITY', $select))
5191  {
5192  $basketProviderData['QUANTITY'] = $basketItem->getQuantity(); // ????
5193  }
5194 
5195  if (in_array('RENEWAL', $select))
5196  {
5197  $basketProviderData['RENEWAL'] = $basketItem->getField('RENEWAL')!== null && $basketItem->getField('RENEWAL') != 'N'? 'Y' : 'N';
5198  }
5199 
5200  if (in_array('RESERVED', $select))
5201  {
5202  $basketProviderData['RESERVED'] = $basketItem->getField('RESERVED');
5203  }
5204 
5205  if (in_array('SITE_ID', $select))
5206  {
5207  $basketProviderData['SITE_ID'] = $basketItem->getField('LID');
5208  }
5209 
5210  if (in_array('ORDER_ID', $select))
5211  {
5212  /** @var Basket $basket */
5213  if (!$basket = $basketItem->getCollection())
5214  {
5215  throw new ObjectNotFoundException('Entity "Basket" not found');
5216  }
5217 
5218  if ($basket->getOrder() && $basket->getOrderId() > 0)
5219  {
5220  $basketProviderData['ORDER_ID'] = $basket->getOrderId();
5221  }
5222 
5223  }
5224 
5225  if (in_array('USER_ID', $select))
5226  {
5227  /** @var Basket $basket */
5228  if (!$basket = $basketItem->getCollection())
5229  {
5230  throw new ObjectNotFoundException('Entity "Basket" not found');
5231  }
5232 
5233  if ($order = $basket->getOrder())
5234  {
5235  $userId = $order->getUserId();
5236 
5237  if ($userId === null)
5238  {
5239  $userId = \CSaleUser::GetUserID($basket->getFUserId());
5240  }
5241 
5242  if ($userId > 0)
5243  {
5244  $basketProviderData['USER_ID'] = $userId;
5245  }
5246  }
5247 
5248  }
5249 
5250  if (in_array('PAID', $select))
5251  {
5252  /** @var Basket $basket */
5253  if (!$basket = $basketItem->getCollection())
5254  {
5255  throw new ObjectNotFoundException('Entity "Basket" not found');
5256  }
5257 
5258  if ($basket->getOrder() && $basket->getOrderId() > 0)
5259  {
5260  $order = $basket->getOrder();
5261  $basketProviderData['PAID'] = $order->isPaid();
5262  }
5263 
5264  }
5265 
5266  if (in_array('ALLOW_DELIVERY', $select))
5267  {
5268  /** @var Basket $basket */
5269  if (!$basket = $basketItem->getCollection())
5270  {
5271  throw new ObjectNotFoundException('Entity "Basket" not found');
5272  }
5273 
5274  if ($basket->getOrder() && $basket->getOrderId() > 0)
5275  {
5276  /** @var Order $order */
5277  $order = $basket->getOrder();
5278 
5279  /** @var ShipmentCollection $shipmentCollection */
5280  if ($shipmentCollection = $order->getShipmentCollection())
5281  {
5282  $basketProviderData['ALLOW_DELIVERY'] = $shipmentCollection->isAllowDelivery();
5283  }
5284  }
5285 
5286  }
5287 
5288  return $basketProviderData;
5289  }

◆ createProviderBasketMap()

static createProviderBasketMap ( array  $basketList,
array  $select = array() 
)
staticprotected
Аргументы
array$basketList
array$select
Возвращает
array
Исключения
ObjectNotFoundException

См. определение в файле providerbase.php строка 5127

5128  {
5129  $basketProviderMap = array();
5130 
5131  /**
5132  * @var string $basketKey
5133  * @var BasketItem $basketItem
5134  */
5135  foreach($basketList as $basketIndex => $basketItemDat)
5136  {
5137  if (is_array($basketItemDat) && isset($basketItemDat['BASKET_ITEM']))
5138  {
5139  $basketItem = $basketItemDat['BASKET_ITEM'];
5140  }
5141  else
5142  {
5143  $basketItem = $basketItemDat;
5144  }
5145 
5146  $basketProviderData = static::createProviderBasketItemMap($basketItem, $select);
5147  if (!$basketProviderData)
5148  {
5149  continue;
5150  }
5151 
5152  $basketProviderMap[$basketIndex] = $basketProviderData;
5153 
5154  }
5155 
5156  return $basketProviderMap;
5157  }

◆ deliverProductData()

static deliverProductData (   $provider,
array  $fields 
)
static
Аргументы
$provider
array$fields
Возвращает
Result

См. определение в файле providerbase.php строка 5071

5072  {
5073  global $APPLICATION;
5074 
5075  $result = new Result();
5076  $APPLICATION->ResetException();
5077  $resultProductData = false;
5078 
5079  if ($provider && array_key_exists("IBXSaleProductProvider", class_implements($provider)))
5080  {
5081  $resultProductData = $provider::DeliverProduct($fields);
5082  }
5083  else
5084  {
5085  $resultProductData = \CSaleBasket::ExecuteCallbackFunction(
5086  $fields['CALLBACK_FUNC'],
5087  $fields['MODULE'],
5088  $fields['PRODUCT_ID'],
5089  $fields['USER_ID'],
5090  $fields["ALLOW_DELIVERY"],
5091  $fields['ORDER_ID'],
5092  $fields["QUANTITY"]
5093  );
5094 
5095  if (!empty($resultProductData) && is_array($resultProductData))
5096  {
5097  $resultProductData['ORDER_ID'] = $fields['ORDER_ID'];
5098  }
5099 
5100  }
5101 
5102  $ex = $APPLICATION->GetException();
5103  if (!empty($ex))
5104  {
5105  $result->addError( new ResultError($ex->GetString(), $ex->GetID()) );
5106  }
5107  else
5108  {
5109  $resultList[$fields['PRODUCT_ID']] = $resultProductData;
5110  }
5111 
5112  if (!empty($resultList) && is_array($resultList))
5113  {
5114  $result->setData($resultList);
5115  }
5116 
5117  return $result;
5118  }

◆ deliverShipment()

static deliverShipment ( Shipment  $shipment)
static
Аргументы
Shipment$shipment
Возвращает
Result
Исключения
NotSupportedException
ObjectNotFoundException

См. определение в файле providerbase.php строка 4832

4833  {
4834 
4835  $result = new Result();
4836 
4837  $needDeliver = null;
4838  if ($shipment->getFields()->isChanged('ALLOW_DELIVERY'))
4839  {
4840  $needDeliver = $shipment->getField('ALLOW_DELIVERY') === "Y";
4841  }
4842 
4843  if ($needDeliver === null || ($needDeliver === false && $shipment->getId() <= 0))
4844  return $result;
4845 
4846  $resultList = array();
4847 
4848  /** @var ShipmentItemCollection $shipmentItemCollection */
4849  if (!$shipmentItemCollection = $shipment->getShipmentItemCollection())
4850  {
4851  throw new ObjectNotFoundException('Entity "ShipmentItemCollection" not found');
4852  }
4853 
4854  /** @var ShipmentCollection $shipmentCollection */
4855  if (!$shipmentCollection = $shipment->getCollection())
4856  {
4857  throw new ObjectNotFoundException('Entity "ShipmentCollection" not found');
4858  }
4859 
4860  /** @var Order $order */
4861  if (!$order = $shipmentCollection->getOrder())
4862  {
4863  throw new ObjectNotFoundException('Entity "Order" not found');
4864  }
4865 
4866  /** @var Basket $basket */
4867  if (!$basket = $order->getBasket())
4868  {
4869  return $result;
4870  }
4871 
4872  $basketList = static::getBasketFromShipmentItemCollection($shipmentItemCollection);
4873 
4874  $basketProviderMap = static::createProviderBasketMap($basketList, array('ORDER_ID', 'USER_ID', 'QUANTITY', 'ALLOW_DELIVERY', 'PAY_CALLBACK', 'PAID'));
4875  $basketProviderList = static::redistributeToProviders($basketProviderMap);
4876 
4877  if (!empty($basketProviderList))
4878  {
4879  foreach ($basketProviderList as $provider => $providerBasketItemList)
4880  {
4881  if (array_key_exists("IBXSaleProductProvider", class_implements($provider)))
4882  {
4883 
4884  foreach ($providerBasketItemList as $providerBasketItem)
4885  {
4886 
4887  if ($providerBasketItem['BASKET_ITEM']->isBundleParent())
4888  {
4889  continue;
4890  }
4891 
4892  if ($providerBasketItem['BASKET_ITEM']->getField('MODULE') != '')
4893  {
4894  $data = array(
4895  "PRODUCT_ID" => $providerBasketItem["PRODUCT_ID"],
4896  "USER_ID" => $providerBasketItem["USER_ID"],
4897  "PAID" => $providerBasketItem["PAID"],
4898  "ORDER_ID" => $providerBasketItem["ORDER_ID"],
4899  "BASKET_ID" => $providerBasketItem['BASKET_ID']
4900  );
4901 
4902  $r = static::deliverProductData($provider, $data);
4903  if ($r->isSuccess())
4904  {
4905  $resultData = $r->getData();
4906 
4907  if (array_key_exists($providerBasketItem["PRODUCT_ID"], $resultData))
4908  {
4909  $resultProductData = $resultData[$providerBasketItem["PRODUCT_ID"]];
4910  }
4911  }
4912  else
4913  {
4914  $result->addErrors($r->getErrors());
4915  }
4916 
4917  if (!empty($resultProductData) && is_array($resultProductData))
4918  {
4919  $resultProductData['ORDER_ID'] = $providerBasketItem['ORDER_ID'];
4920  }
4921  }
4922  else
4923  {
4924  $resultProductData = true;
4925  }
4926 
4927  $resultList[$providerBasketItem['BASKET_CODE']] = $resultProductData;
4928 
4929  }
4930 
4931  }
4932  elseif (class_exists($provider))
4933  {
4934  $context = array(
4935  'SITE_ID' => $order->getSiteId(),
4936  'CURRENCY' => $order->getCurrency(),
4937  );
4938 
4939  if ($order->getUserId() > 0)
4940  {
4941  $context['USER_ID'] = $order->getUserId();
4942  }
4943  else
4944  {
4945  global $USER;
4946  $context['USER_ID'] = $USER->getId();
4947  }
4948 
4949  $creator = Internals\ProviderCreator::create($context);
4950 
4951  /** @var ShipmentItem $shipmentItem */
4952  foreach ($shipmentItemCollection as $shipmentItem)
4953  {
4954  $basketItem = $shipmentItem->getBasketItem();
4955  $providerClass = $basketItem->getProviderEntity();
4956 
4957  if ($providerClass instanceof SaleProviderBase)
4958  {
4959  $creator->addShipmentItem($shipmentItem);
4960  }
4961  }
4962 
4963  $r = $creator->deliver();
4964  if ($r->isSuccess())
4965  {
4966  $r = $creator->createItemsResultAfterDeliver($r);
4967  if ($r->isSuccess())
4968  {
4969  $data = $r->getData();
4970  if (array_key_exists('RESULT_AFTER_DELIVER_LIST', $data))
4971  {
4972  $resultList = $data['RESULT_AFTER_DELIVER_LIST'] + $resultList;
4973  }
4974  }
4975  }
4976  else
4977  {
4978  $result->addErrors($r->getErrors());
4979  }
4980  }
4981  else
4982  {
4983  foreach ($providerBasketItemList as $providerBasketItem)
4984  {
4985  $resultProductData = \CSaleBasket::ExecuteCallbackFunction(
4986  $providerBasketItem['CALLBACK_FUNC'],
4987  $providerBasketItem['MODULE'],
4988  $providerBasketItem['PRODUCT_ID'],
4989  $providerBasketItem['USER_ID'],
4990  $providerBasketItem["ALLOW_DELIVERY"],
4991  $providerBasketItem['ORDER_ID'],
4992  $providerBasketItem["QUANTITY"]
4993  );
4994 
4995  $basketCode = $providerBasketItem['BASKET_ITEM']->getBasketCode();
4996 
4997  if (!empty($resultProductData) && is_array($resultProductData))
4998  {
4999  $resultProductData['ORDER_ID'] = $providerBasketItem['ORDER_ID'];
5000  }
5001 
5002  $resultList[$basketCode] = $resultProductData;
5003  }
5004  }
5005  }
5006 
5007  if (!empty($resultList) && is_array($resultList))
5008  {
5009  $recurringID = intval($order->getField("RECURRING_ID"));
5010  foreach ($resultList as $basketCode => $resultData)
5011  {
5012  if ($order->isPaid())
5013  {
5014  if (!empty($resultData) && is_array($resultData))
5015  {
5016  if (empty($resultData['ORDER_ID']) || intval($resultData['ORDER_ID']) < 0)
5017  $resultData["ORDER_ID"] = $order->getId();
5018 
5019  $resultData["REMAINING_ATTEMPTS"] = (defined("SALE_PROC_REC_ATTEMPTS") ? SALE_PROC_REC_ATTEMPTS : 3);
5020  $resultData["SUCCESS_PAYMENT"] = "Y";
5021 
5022  if ($recurringID > 0)
5023  \CSaleRecurring::Update($recurringID, $resultData);
5024  else
5025  \CSaleRecurring::Add($resultData);
5026  }
5027  elseif ($recurringID > 0)
5028  {
5029  \CSaleRecurring::Delete($recurringID);
5030  }
5031  }
5032  else
5033  {
5034  /** @var BasketItem $basketItem */
5035  if (!$basketItem = $basket->getItemByBasketCode($basketCode))
5036  {
5037  throw new ObjectNotFoundException('Entity "BasketItem" not found');
5038  }
5039 
5040  $resRecurring = \CSaleRecurring::GetList(
5041  array(),
5042  array(
5043  "USER_ID" => $order->getUserId(),
5044  "PRODUCT_ID" => $basketItem->getProductId(),
5045  "MODULE" => $basketItem->getField("MODULE")
5046  )
5047  );
5048  while ($recurringData = $resRecurring->Fetch())
5049  {
5050  \CSaleRecurring::Delete($recurringData["ID"]);
5051  }
5052  }
5053  }
5054  }
5055  }
5056 
5057  if (!empty($resultList))
5058  {
5059  $result->setData($resultList);
5060  }
5061 
5062  return $result;
5063  }

◆ getAvailableQuantity()

static getAvailableQuantity (   $providerClass,
array  $products,
array  $context 
)
static

См. определение в файле providerbase.php строка 5679

5680  {
5681  $result = new Result();
5682  $resultList = array();
5683 
5684  foreach ($products as $productId => $productData)
5685  {
5686  $r = static::getAvailableQuantityByProductData($providerClass, $productData, $context);
5687  if (!$r->isSuccess())
5688  {
5689  $result->addErrors($r->getErrors());
5690  }
5691  elseif ($r->hasWarnings())
5692  {
5693  $result->addWarnings($r->getWarnings());
5694  }
5695 
5696  $providerName = null;
5697  if (!empty($providerClass))
5698  {
5699  $reflect = new \ReflectionClass($providerClass);
5700  $providerName = $reflect->getName();
5701  }
5702  else
5703  {
5704  /** @var BasketItem $basketItem */
5705  $basketItem = $productData['BASKET_ITEM'];
5706  $providerName = $basketItem->getCallbackFunction();
5707  }
5708 
5709  $availableQuantityData = $r->getData();
5710  if (array_key_exists('AVAILABLE_QUANTITY', $availableQuantityData))
5711  {
5712  if (!isset($resultList))
5713  {
5714  $resultList = array();
5715  }
5716 
5717  $resultList[$productId] += floatval($availableQuantityData['AVAILABLE_QUANTITY']);
5718  }
5719  else
5720  {
5721  $result->addWarning(new ResultWarning(Loc::getMessage('SALE_PROVIDER_BASKET_ITEM_WRONG_AVAILABLE_QUANTITY', array(
5722  '#PRODUCT_ID#' => $productId
5723  )), 'PROVIDER_BASKET_ITEM_WRONG_AVAILABLE_QUANTITY'));
5724 
5725  }
5726  }
5727 
5728  if (!empty($resultList))
5729  {
5730  $result->setData(
5731  array(
5732  'AVAILABLE_QUANTITY_LIST' => $resultList,
5733  )
5734  );
5735  }
5736 
5737  return $result;
5738  }

◆ getAvailableQuantityAndPrice()

static getAvailableQuantityAndPrice (   $providerClass,
array  $products,
array  $context 
)
static

См. определение в файле providerbase.php строка 5749

5750  {
5751  $result = new Result();
5752  $availableQuantityList = array();
5753  $priceData = array();
5754  $providerName = null;
5755 
5756  foreach ($products as $productId => $productData)
5757  {
5758  /** @var BasketItem $basketItem */
5759  $basketItem = $productData['BASKET_ITEM'];
5760  if (!$basketItem)
5761  {
5762  throw new ObjectNotFoundException('Entity "BasketItem" not found');
5763  }
5764 
5765  $callbackFunction = null;
5766  if (!empty($productData['CALLBACK_FUNC']))
5767  {
5768  $callbackFunction = $productData['CALLBACK_FUNC'];
5769  }
5770 
5771  $isCustomItem = !($providerClass || $callbackFunction);
5772 
5773  if ($isCustomItem)
5774  {
5775  $providerData = $basketItem->getFieldValues();
5776  $providerData['AVAILABLE_QUANTITY'] = $basketItem->getQuantity();
5777  }
5778  else
5779  {
5780  $r = static::getProviderDataByProductData($providerClass, $productData, $context);
5781  if (!$r->isSuccess())
5782  {
5783  $result->addErrors($r->getErrors());
5784  }
5785  elseif ($r->hasWarnings())
5786  {
5787  $result->addWarnings($r->getWarnings());
5788  }
5789  $providerData = $r->getData();
5790  }
5791 
5792  if (!empty($providerData))
5793  {
5794  if (isset($providerData['AVAILABLE_QUANTITY']))
5795  {
5796  $availableQuantityList[$productId] += floatval($providerData['AVAILABLE_QUANTITY']);
5797  }
5798  else
5799  {
5800  $result->addWarning(new ResultWarning(Loc::getMessage('SALE_PROVIDER_BASKET_ITEM_WRONG_AVAILABLE_QUANTITY', array(
5801  '#PRODUCT_ID#' => $productId
5802  )), 'PROVIDER_BASKET_ITEM_WRONG_AVAILABLE_QUANTITY'));
5803 
5804  }
5805 
5806  if (!$isCustomItem)
5807  {
5808  $priceFields = static::getPriceFields();
5809 
5810  foreach ($priceFields as $fieldName)
5811  {
5812  if (array_key_exists($fieldName, $providerData))
5813  {
5814  $priceData[$productId][$basketItem->getBasketCode()][$fieldName] = $providerData[$fieldName];
5815  }
5816 
5817  }
5818  }
5819  }
5820  }
5821 
5822  $result->setData(
5823  array(
5824  'PRODUCT_DATA_LIST' => array(
5825  'PRICE_LIST' => $priceData,
5826  'AVAILABLE_QUANTITY_LIST' => $availableQuantityList
5827  )
5828  )
5829  );
5830 
5831  return $result;
5832  }

◆ getBasketCountFromShipmentItemCollection()

static getBasketCountFromShipmentItemCollection (   $shipmentItemList)
staticprotected
Аргументы
$shipmentItemList
Возвращает
array
Исключения
ObjectNotFoundException

См. определение в файле providerbase.php строка 2505

2506  {
2507 
2508  $basketCountList = array();
2509  /** @var ShipmentItem $shipmentItem */
2510  foreach ($shipmentItemList as $shipmentItem)
2511  {
2512 
2513  /** @var BasketItem $basketItem */
2514  if (!$basketItem = $shipmentItem->getBasketItem())
2515  {
2516  continue;
2517  }
2518 
2519  if ($basketItem->isBundleParent()
2520  || (!$basketItem->isBundleParent() && !$basketItem->isBundleChild()))
2521  {
2522  $basketCountList[$basketItem->getBasketCode()] = floatval($shipmentItem->getQuantity());
2523  }
2524 
2525 
2526  if($basketItem->isBundleParent())
2527  {
2528  /** @var ShipmentItem $bundleShipmentItem */
2529  foreach ($shipmentItemList as $bundleShipmentItem)
2530  {
2531  /** @var BasketItem $bundleBasketItem */
2532  $bundleBasketItem = $bundleShipmentItem->getBasketItem();
2533 
2534  if($bundleBasketItem->isBundleChild())
2535  {
2536  $bundleParentBasketItem = $bundleBasketItem->getParentBasketItem();
2537  if ($bundleParentBasketItem->getBasketCode() == $basketItem->getBasketCode())
2538  {
2539  $basketCountList[$bundleBasketItem->getBasketCode()] = floatval($bundleShipmentItem->getQuantity());
2540  }
2541  }
2542  }
2543  }
2544 
2545  }
2546 
2547  return $basketCountList;
2548  }

◆ getBasketFromShipmentItemCollection()

static getBasketFromShipmentItemCollection (   $shipmentItemList)
staticprotected
Аргументы
$shipmentItemList
Возвращает
array
Исключения
ObjectNotFoundException

См. определение в файле providerbase.php строка 2418

2419  {
2420 
2421  $basketList = array();
2422  /** @var ShipmentItem $shipmentItem */
2423  foreach ($shipmentItemList as $shipmentItem)
2424  {
2425 
2426  /** @var BasketItem $basketItem */
2427  if (!$basketItem = $shipmentItem->getBasketItem())
2428  {
2429  continue;
2430  }
2431 
2432  /** @var ShipmentItemCollection $shipmentItemCollection */
2433  $shipmentItemCollection = $shipmentItem->getCollection();
2434  if (!$shipmentItemCollection)
2435  {
2436  throw new ObjectNotFoundException('Entity "ShipmentItemCollection" not found');
2437  }
2438 
2439  /** @var Shipment $shipment */
2440  $shipment = $shipmentItemCollection->getShipment();
2441 
2442  if (!$shipment)
2443  {
2444  throw new ObjectNotFoundException('Entity "Shipment" not found');
2445  }
2446 
2447  $needShip = $shipment->needShip();
2448  if ($needShip === null)
2449  {
2450  continue;
2451  }
2452 
2453  $reserved = ((($shipmentItem->getQuantity() - $shipmentItem->getReservedQuantity()) == 0)
2454  || ($shipment->getField('RESERVED') == "Y"));
2455 
2456  if ($basketItem->isBundleParent()
2457  || (!$basketItem->isBundleParent() && !$basketItem->isBundleChild()))
2458  {
2459 
2460  $basketList[$basketItem->getBasketCode()] = array(
2461  'BASKET_ITEM' => $basketItem,
2462  'RESERVED' => ($reserved ? "Y" : "N"),
2463  'NEED_SHIP' => $needShip,
2464  'SHIPMENT_ITEM' => $shipmentItem
2465  );
2466  }
2467 
2468  if($basketItem->isBundleParent())
2469  {
2470  /** @var ShipmentItem $bundleShipmentItem */
2471  foreach ($shipmentItemCollection as $bundleShipmentItem)
2472  {
2473  /** @var BasketItem $bundleBasketItem */
2474  $bundleBasketItem = $bundleShipmentItem->getBasketItem();
2475 
2476  if($bundleBasketItem->isBundleChild())
2477  {
2478  $bundleParentBasketItem = $bundleBasketItem->getParentBasketItem();
2479  if ($bundleParentBasketItem->getBasketCode() == $basketItem->getBasketCode())
2480  {
2481 
2482  $basketList[$bundleBasketItem->getBasketCode()] = array(
2483  'BASKET_ITEM' => $bundleBasketItem,
2484  'RESERVED' => ($reserved ? "Y" : "N"),
2485  'NEED_SHIP' => $needShip,
2486  'SHIPMENT_ITEM' => $shipmentItem
2487  );
2488  }
2489  }
2490  }
2491  }
2492 
2493 
2494  }
2495 
2496  return $basketList;
2497  }

◆ getBundleChildItems()

static getBundleChildItems (   $providerName,
array  $products 
)
static
Аргументы
$providerName
array$products
Возвращает
Result

См. определение в файле providerbase.php строка 4366

4367  {
4368  $result = new Result();
4369  $resultList = array();
4370 
4371  foreach ($products as $productId => $productData)
4372  {
4373  $resultList[$productId] = static::getBundleChildItemsByProductData($providerName, $productData);
4374  }
4375 
4376  if (!empty($resultList))
4377  {
4378  $result->setData(
4379  array(
4380  'BUNDLE_LIST' => $resultList,
4381  )
4382  );
4383  }
4384 
4385  return $result;
4386  }

◆ getBundleIndexFromShipmentItemCollection()

static getBundleIndexFromShipmentItemCollection (   $shipmentItemList)
staticprotected
Аргументы
$shipmentItemList
Возвращает
array

См. определение в файле providerbase.php строка 2381

2382  {
2383  $bundleIndexList = array();
2384  /** @var ShipmentItem $shipmentItem */
2385  foreach ($shipmentItemList as $shipmentItem)
2386  {
2387  /** @var BasketItem $basketItem */
2388  if (!$basketItem = $shipmentItem->getBasketItem())
2389  {
2390  continue;
2391  }
2392 
2393 
2394  if ($basketItem->isBundleChild())
2395  {
2396  /** @var BasketItem $parentBasketItem */
2397  $parentBasketItem = $basketItem->getParentBasketItem();
2398  $parentBasketCode = $parentBasketItem->getBasketCode();
2399 
2400  if (!array_key_exists($parentBasketCode, $bundleIndexList))
2401  {
2402  $bundleIndexList[$parentBasketCode] = array();
2403  }
2404 
2405  $bundleIndexList[$parentBasketCode][] = $basketItem->getBasketCode();
2406  }
2407  }
2408 
2409  return $bundleIndexList;
2410  }

◆ getCatalogData()

static getCatalogData ( array  $basketProviderList,
array  $context,
array  $select = array() 
)
static
Аргументы
array$basketProviderList
array$context
array$select
Возвращает
array

См. определение в файле providerbase.php строка 1553

1554  {
1555  $needPrice = in_array('PRICE', $select);
1556  $needBasePrice = in_array('BASE_PRICE', $select);
1557  $needCoupons = in_array('COUPONS', $select);
1558 
1559  $result = array();
1560 // $orderId = null;
1561  $userId = null;
1562  $siteId = null;
1563  $currency = null;
1564 
1565  if (!empty($context['USER_ID']) && intval($context['USER_ID']) > 0)
1566  {
1567  $userId = $context['USER_ID'];
1568  }
1569 
1570  if (array_key_exists('SITE_ID', $context))
1571  {
1572  $siteId = $context['SITE_ID'];
1573  }
1574 
1575  if (array_key_exists('CURRENCY', $context))
1576  {
1577  $currency = $context['CURRENCY'];
1578  }
1579 
1580  $data = array(
1581  'USER_ID' => $userId,
1582  'SITE_ID' => $siteId,
1583  'CURRENCY' => $currency,
1584  'CHECK_QUANTITY' => (in_array('QUANTITY', $select) ? 'Y' : 'N'),
1585  'AVAILABLE_QUANTITY' => (in_array('AVAILABLE_QUANTITY', $select) ? 'Y' : 'N'),
1586  'CHECK_PRICE' => ($needPrice ? 'Y' : 'N'),
1587  'CHECK_COUPONS' => ($needCoupons ? 'Y' : 'N'),
1588  'RENEWAL' => (in_array('RENEWAL', $select) ? 'Y' : 'N')
1589  );
1590 
1591  if ($needBasePrice)
1592  $data['CHECK_DISCOUNT'] = 'N';
1593 
1594  $useOrderProduct = false;
1595  if ($needPrice)
1596  $useOrderProduct = true;
1597 
1598  if ($needCoupons)
1599  $useOrderProduct = false;
1600 
1601  unset($needCoupons, $needPrice);
1602 
1603  foreach ($basketProviderList as $provider => $providerBasketItemList)
1604  {
1605  if ($provider && array_key_exists("IBXSaleProductProvider", class_implements($provider)))
1606  {
1607  foreach ($providerBasketItemList as $providerBasketItem)
1608  {
1609  $currentUseOrderProduct = $useOrderProduct;
1610  if (!isset($providerBasketItem['BASKET_ID']) || (int)$providerBasketItem['BASKET_ID'] <= 0)
1611  $currentUseOrderProduct = false;
1612 
1613  $providerFields = $data;
1614 
1615  if ($providerBasketItem['BASKET_ITEM']->isBundleChild())
1616  {
1617  $providerFields['CHECK_DISCOUNT'] = 'N';
1618  }
1619 
1620  if ($providerBasketItem['BASKET_ITEM']->getField("CAN_BUY") == "N"
1621  || $providerBasketItem['BASKET_ITEM']->getField("DELAY") == "Y"
1622  || $providerBasketItem['BASKET_ITEM']->getField("SUBSCRIBE") == "Y"
1623  )
1624  {
1625  $providerFields['CHECK_COUPONS'] = 'N';
1626  }
1627  else
1628  {
1629  $providerFields['CHECK_COUPONS'] = 'Y';
1630  }
1631 
1632  $providerFields['PRODUCT_ID'] = $providerBasketItem['PRODUCT_ID'];
1633  $providerFields['QUANTITY'] = $providerBasketItem['QUANTITY'];
1634 
1635  if (intval($providerBasketItem['BASKET_ID']) > 0)
1636  {
1637  $providerFields['BASKET_ID'] = $providerBasketItem['BASKET_ID'];
1638  }
1639 
1640  $hasTrustData = false;
1641 
1642  $trustData = static::getTrustData($siteId, $providerBasketItem['MODULE'], $providerBasketItem['PRODUCT_ID']);
1643 
1644  if (static::isReadTrustData() === true
1645  && !empty($trustData) && is_array($trustData))
1646  {
1647  $hasTrustData = true;
1648  $resultProductData = $trustData;
1649 
1650  foreach (static::getProductDataRequiredFields() as $requiredField)
1651  {
1652  if (!array_key_exists($requiredField, $resultProductData))
1653  {
1654  $hasTrustData = false;
1655  break;
1656  }
1657  }
1658 
1659 
1660  if ($hasTrustData && in_array('PRICE', $select))
1661  {
1662  foreach (static::getProductDataRequiredPriceFields() as $requiredField)
1663  {
1664  if (!array_key_exists($requiredField, $resultProductData))
1665  {
1666  $hasTrustData = false;
1667  break;
1668  }
1669  }
1670  }
1671  }
1672 
1673 
1674  if(!$hasTrustData)
1675  {
1676  $resultProductData = ($currentUseOrderProduct ? $provider::OrderProduct($providerFields) : $provider::GetProductData($providerFields));
1677  }
1678  else
1679  {
1680  if (!in_array('AVAILABLE_QUANTITY', $select) && array_key_exists("AVAILABLE_QUANTITY", $resultProductData))
1681  {
1682  unset($resultProductData['AVAILABLE_QUANTITY']);
1683  }
1684  }
1685 
1686  $basketCode = $providerBasketItem['BASKET_ITEM']->getBasketCode();
1687  $result[$basketCode] = $resultProductData;
1688 
1689  if ($providerBasketItem['BASKET_ITEM']->isBundleParent())
1690  {
1691 
1692  $result[$basketCode]["BUNDLE_ITEMS"] = array();
1693  /** @var array $bundleChildList */
1694  $bundleChildDataList = static::getSetItems($providerBasketItem['BASKET_ITEM']);
1695  if (!empty($bundleChildDataList) && is_array($bundleChildDataList))
1696  {
1697  $bundleChildList = reset($bundleChildDataList);
1698 
1699  foreach ($bundleChildList["ITEMS"] as &$itemData)
1700  {
1701  $itemData['QUANTITY'] = $itemData['QUANTITY'] * $providerBasketItem['BASKET_ITEM']->getQuantity();
1702  }
1703  unset($itemData);
1704  $result[$basketCode]["BUNDLE_ITEMS"] = $bundleChildList["ITEMS"];
1705  }
1706 
1707  }
1708  }
1709  }
1710  else
1711  {
1712  foreach ($providerBasketItemList as $providerBasketItem)
1713  {
1714  $resultProductData = \CSaleBasket::executeCallbackFunction(
1715  $providerBasketItem['CALLBACK_FUNC'],
1716  $providerBasketItem['MODULE'],
1717  $providerBasketItem['PRODUCT_ID'],
1718  $providerBasketItem['QUANTITY']
1719  );
1720 
1721  $basketCode = $providerBasketItem['BASKET_ITEM']->getBasketCode();
1722  $result[$basketCode] = $resultProductData;
1723  }
1724  }
1725  }
1726 
1727  return $result;
1728  }

◆ getPriceFields()

static getPriceFields ( )
staticprotected
Возвращает
array

См. определение в файле providerbase.php строка 5879

5880  {
5881  return array(
5882  'PRODUCT_PRICE_ID',
5883  'NOTES',
5884  'VAT_RATE',
5885  'DISCOUNT_NAME',
5886  'DISCOUNT_COUPON',
5887  'DISCOUNT_VALUE',
5888  'RESULT_PRICE',
5889  'PRICE_TYPE_ID',
5890  'BASE_PRICE',
5891  'PRICE',
5892  'CURRENCY',
5893  'DISCOUNT_PRICE',
5894  'CUSTOM_PRICE',
5895  );
5896  }

◆ getPrimaryFields()

static getPrimaryFields ( )
staticprotected
Возвращает
array

См. определение в файле providerbase.php строка 5595

5596  {
5597  return array_merge(
5598  array(
5599  'NAME',
5600  'CATALOG_XML_ID',
5601  'PRODUCT_XML_ID',
5602  'WEIGHT',
5603  'DETAIL_PAGE_URL',
5604  'BARCODE_MULTI',
5605  'DIMENSIONS',
5606  'TYPE',
5607  'SET_PARENT_ID',
5608  'MEASURE_CODE',
5609  'MEASURE_NAME',
5610  ),
5611  static::getUpdatableFields()
5612  );
5613  }

◆ getProductAvailableQuantity()

static getProductAvailableQuantity ( Basket  $basketCollection,
BasketItem  $refreshItem = null 
)
static
Аргументы
Basket$basketCollection
BasketItem$refreshItem
Возвращает
array
Исключения
NotSupportedException

См. определение в файле providerbase.php строка 819

820  {
821 
822  static $proxyProductAvailableQuantity = array();
823  $resultList = array();
824  $userId = null;
825 
826  if (($order = $basketCollection->getOrder()) !== null)
827  {
828  $userId = $order->getUserId();
829  }
830 
831  $basketList = static::makeArrayFromBasketCollection($basketCollection, $refreshItem);
832 
833  $basketProviderMap = static::createProviderBasketMap($basketList);
834  $basketProviderList = static::redistributeToProviders($basketProviderMap);
835 
836  $context = array();
837  $productsList = array();
838  $providerList = array();
839  $basketCodeIndex = array();
840  if (!empty($basketProviderList))
841  {
842  foreach ($basketProviderList as $provider => $providerBasketItemList)
843  {
844  if (array_key_exists("IBXSaleProductProvider", class_implements($provider)))
845  {
846  foreach ($providerBasketItemList as $providerBasketItemData)
847  {
848 
849  $proxyProductKey = $providerBasketItemData['PRODUCT_ID']."|".$userId;
850  if (!empty($proxyProductAvailableQuantity[$proxyProductKey]) && is_array($proxyProductAvailableQuantity[$proxyProductKey]))
851  {
852  $resultProductData = $proxyProductAvailableQuantity[$proxyProductKey];
853  }
854  else
855  {
856  $resultProductData = $resultProductData = $provider::getProductAvailableQuantity($providerBasketItemData['PRODUCT_ID'], $userId);
857  $proxyProductAvailableQuantity[$proxyProductKey] = $resultProductData;
858  }
859 
860 
861  $basketCode = $providerBasketItemData['BASKET_ITEM']->getBasketCode();
862  $resultList[$basketCode] = $resultProductData;
863  }
864  }
865  elseif (class_exists($provider))
866  {
867  if (empty($context))
868  {
869  if ($order)
870  {
871  $context = array(
872  'USER_ID' => $order->getUserId(),
873  'SITE_ID' => $order->getSiteId(),
874  'CURRENCY' => $order->getCurrency(),
875  );
876  }
877  else
878  {
879  global $USER;
880  $context = array(
881  'USER_ID' => $USER->getId(),
882  'SITE_ID' => SITE_ID,
883  'CURRENCY' => Currency\CurrencyManager::getBaseCurrency(),
884  );
885  }
886  }
887 
888  $providerClass = new $provider($context);
889  if (!$providerClass instanceof SaleProviderBase)
890  {
891  continue;
892  }
893 
894  /** @var BasketItem $basketItem */
895  foreach ($providerBasketItemList as $providerBasketItemData)
896  {
897  $basketItem = $providerBasketItemData['BASKET_ITEM'];
898 
899  $productId = $basketItem->getProductId();
900  $basketCode = $basketItem->getBasketCode();
901  $basketCodeIndex[$productId][] = $basketItem->getBasketCode();
902 
903  $providerList[$provider] = $providerClass;
904 
905  if (empty($productsList[$provider][$productId]))
906  {
907  $productsList[$provider][$productId] = $providerBasketItemData;
908  }
909 
910  $productsList[$provider][$productId]['QUANTITY_LIST'][$basketCode] = $basketItem->getQuantity();
911  $resultList[$basketCode] = 0;
912  }
913  }
914  else
915  {
916  foreach ($providerBasketItemList as $providerBasketItemData)
917  {
918  $resultProductData = \CSaleBasket::ExecuteCallbackFunction(
919  $providerBasketItemData['CALLBACK_FUNC'],
920  $providerBasketItemData['MODULE'],
921  $providerBasketItemData['PRODUCT_ID']
922  );
923 
924  $basketCode = $providerBasketItemData['BASKET_ITEM']->getBasketCode();
925  $resultList[$basketCode] = $resultProductData;
926  }
927  }
928  }
929 
930 
931  if (!empty($productsList))
932  {
933  foreach ($productsList as $providerName => $products)
934  {
935  /** @var SaleProviderBase $providerClass */
936  $providerClass = $providerList[$providerName];
937 
938  $r = $providerClass->getAvailableQuantity($products);
939  if ($r->isSuccess())
940  {
941  $resultData = $r->getData();
942  if (!empty($resultData['AVAILABLE_QUANTITY_LIST']))
943  {
944 
945  foreach ($resultData['AVAILABLE_QUANTITY_LIST'] as $productId => $availableQuantity)
946  {
947  if (!empty($basketCodeIndex[$productId]))
948  {
949  foreach ($basketCodeIndex[$productId] as $basketCode)
950  {
951  $resultList[$basketCode] = $availableQuantity;
952  }
953  }
954  }
955  }
956  }
957  }
958  }
959  }
960 
961  return $resultList;
962  }

◆ getProductData()

static getProductData ( BasketItemCollection  $basketCollection,
array  $select = array(),
BasketItem  $refreshItem = null 
)
static
Аргументы
BasketItemCollection$basketCollection
array$select
BasketItem | null$refreshItem
Возвращает
array
Исключения
NotSupportedException
ObjectNotFoundException

См. определение в файле providerbase.php строка 973

974  {
975  $resultList = array();
976 
977  $orderId = null;
978  $userId = null;
979  $siteId = null;
980  $currency = null;
981 
982  if (($order = $basketCollection->getOrder()) !== null)
983  {
984  $userId = $order->getUserId();
985  $siteId = $order->getSiteId();
986  $currency = $order->getCurrency();
987  }
988 
989  if ($siteId === null)
990  {
991  $basket = $basketCollection->getBasket();
992  $siteId = $basket->getSiteId();
993  }
994 
995  if ($siteId === null)
996  return array();
997 
998  if ($currency === null)
999  {
1000  $currency = Internals\SiteCurrencyTable::getSiteCurrency($siteId);
1001  if (!$currency)
1003  }
1004 
1005  $context = array(
1006  "USER_ID" => $userId,
1007  "SITE_ID" => $siteId,
1008  "CURRENCY" => $currency,
1009  );
1010 
1011  $basketList = static::makeArrayFromBasketCollection($basketCollection, $refreshItem);
1012 
1013  $basketProviderMap = static::createProviderBasketMap($basketList, array('QUANTITY', 'RENEWAL', 'SITE_ID', 'USER_ID'));
1014  $basketProviderList = static::redistributeToProviders($basketProviderMap);
1015 
1016  if (!empty($basketProviderList))
1017  {
1018  $options = array(
1019  'RETURN_BASKET_ID'
1020  );
1021 
1022  foreach ($basketProviderList as $providerClassName => $productValueList)
1023  {
1024  $r = static::getProductDataByList($productValueList, $providerClassName, $select, $context, $options);
1025  if ($r->isSuccess())
1026  {
1027  $resultData = $r->getData();
1028  if (!empty($resultData['PRODUCT_DATA_LIST']))
1029  {
1030  $resultList = $resultData['PRODUCT_DATA_LIST'] + $resultList;
1031  }
1032  }
1033  }
1034 
1035  }
1036 
1037  return $resultList;
1038  }

◆ getProductDataByList()

static getProductDataByList ( array  $products,
  $providerClassName = null,
array  $select = array(),
array  $context,
array  $options = array() 
)
static

См. определение в файле providerbase.php строка 1050

1051  {
1052 
1053  $result = new Result();
1054  $resultList = array();
1055 
1056  $needPrice = in_array('PRICE', $select);
1057  $needBasePrice = in_array('BASE_PRICE', $select);
1058  $needCoupons = in_array('COUPONS', $select);
1059  $data = array(
1060  'USER_ID' => $context['USER_ID'],
1061  'SITE_ID' => $context['SITE_ID'],
1062  'CURRENCY' => $context['CURRENCY'],
1063  'CHECK_QUANTITY' => (in_array('QUANTITY', $select) ? 'Y' : 'N'),
1064  'AVAILABLE_QUANTITY' => (in_array('AVAILABLE_QUANTITY', $select) ? 'Y' : 'N'),
1065  'CHECK_PRICE' => ($needPrice ? 'Y' : 'N'),
1066  'CHECK_COUPONS' => ($needCoupons ? 'Y' : 'N'),
1067  'RENEWAL' => (in_array('RENEWAL', $select) ? 'Y' : 'N')
1068  );
1069 
1070  if ($needBasePrice)
1071  $data['CHECK_DISCOUNT'] = 'N';
1072 
1073  $useOrderProduct = false;
1074  if ($needPrice)
1075  $useOrderProduct = true;
1076 
1077  if ($needCoupons)
1078  $useOrderProduct = false;
1079 
1080  $data['USE_ORDER_PRODUCT'] = $useOrderProduct;
1081 
1082  unset($needCoupons, $needPrice);
1083 
1084 
1085  if ($providerClassName)
1086  {
1087  if (array_key_exists("IBXSaleProductProvider", class_implements($providerClassName)))
1088  {
1089  $resultProductList = static::getProductProviderData($products, $providerClassName, $data, $select);
1090  if (in_array('RETURN_BASKET_ID', $options))
1091  {
1092  $basketList = array();
1093  foreach ($products as $productId => $productData)
1094  {
1095  $basketItem = $productData['BASKET_ITEM'];
1096  $basketList[] = $basketItem;
1097  }
1098 
1099  $resultProductList = static::createItemsAfterGetProductData($basketList, $resultProductList, $select);
1100  }
1101  }
1102  elseif (class_exists($providerClassName))
1103  {
1104  $basketList = array();
1105  foreach ($products as $productId => $productData)
1106  {
1107  $basketList[] = $productData['BASKET_ITEM'];
1108  }
1109 
1110  $r = Internals\Catalog\Provider::getProductData($basketList, $context);
1111  if ($r->isSuccess())
1112  {
1113  $resultProductData = $r->getData();
1114  if (!empty($resultProductData['PRODUCT_DATA_LIST']))
1115  {
1116  $itemsList = $resultProductData['PRODUCT_DATA_LIST'];
1117  $resultItemsList = array();
1118  $resultProductList = array();
1119 
1120  foreach ($itemsList as $providerName => $products)
1121  {
1122  $resultItemsList = static::createItemsAfterGetProductData($basketList, $products, $select);
1123  }
1124 
1125  $resultProductList = $resultProductList + $resultItemsList;
1126 
1127  }
1128  }
1129  }
1130 
1131  if (!empty($resultProductList))
1132  {
1133  if (!empty($resultList) && is_array($resultList))
1134  {
1135  $resultList = $resultList + $resultProductList;
1136  }
1137  else
1138  {
1139  $resultList = $resultProductList;
1140  }
1141  }
1142  }
1143  else
1144  {
1145  $priceFields = static::getPriceFields();
1146 
1147  foreach ($products as $productId => $productData)
1148  {
1149  $callbackFunction = null;
1150  if (!empty($productData['CALLBACK_FUNC']))
1151  {
1152  $callbackFunction = $productData['CALLBACK_FUNC'];
1153  }
1154 
1155  $quantityList = array();
1156 
1157  if (array_key_exists('QUANTITY', $productData))
1158  {
1159  $quantityList = array($productData['BASKET_CODE'] => $productData['QUANTITY']);
1160 
1161  }
1162  elseif (!empty($productData['QUANTITY_LIST']))
1163  {
1164  $quantityList = $productData['QUANTITY_LIST'];
1165  }
1166 
1167  foreach($quantityList as $basketCode => $quantity)
1168  {
1169  if (!empty($callbackFunction))
1170  {
1171  $resultProductData = \CSaleBasket::executeCallbackFunction(
1172  $callbackFunction,
1173  $productData['MODULE'],
1174  $productId,
1175  $quantity
1176  );
1177  }
1178  else
1179  {
1180  $resultProductData = array(
1181  'QUANTITY' => $quantity,
1182  'AVAILABLE_QUANTITY' => $quantity,
1183  );
1184  }
1185 
1186  $itemCode = $productId;
1187  if (in_array('RETURN_BASKET_ID', $options))
1188  {
1189  $itemCode = $basketCode;
1190  }
1191 
1192  if (empty($resultList[$itemCode]))
1193  {
1194  $resultList[$itemCode] = $resultProductData;
1195  }
1196 
1197  if (!empty($resultProductData))
1198  {
1199  $resultList[$itemCode]['PRICE_LIST'][$basketCode] = array(
1200  'QUANTITY' => $resultProductData['QUANTITY'],
1201  'AVAILABLE_QUANTITY' => $resultProductData['AVAILABLE_QUANTITY'],
1202  "ITEM_CODE" => $productId,
1203  "BASKET_CODE" => $basketCode,
1204  );
1205 
1206  foreach ($priceFields as $fieldName)
1207  {
1208  if (isset($resultProductData[$fieldName]))
1209  {
1210  $resultList[$itemCode]['PRICE_LIST'][$basketCode][$fieldName] = $resultProductData[$fieldName];
1211  }
1212  }
1213  }
1214  }
1215 
1216  }
1217  }
1218 
1219 
1220  if (!empty($resultList))
1221  {
1222  $result->setData(
1223  array(
1224  'PRODUCT_DATA_LIST' => $resultList
1225  )
1226  );
1227  }
1228 
1229  return $result;
1230  }

◆ getProductDataRequiredFields()

static getProductDataRequiredFields ( )
staticprotected

См. определение в файле providerbase.php строка 5642

5643  {
5644  return array(
5645  'NAME',
5646  'CAN_BUY',
5647  'BARCODE_MULTI',
5648  'WEIGHT',
5649  'TYPE',
5650  'QUANTITY',
5651  );
5652  }

◆ getProductDataRequiredPriceFields()

static getProductDataRequiredPriceFields ( )
staticprotected

См. определение в файле providerbase.php строка 5658

5659  {
5660  return array(
5661  'PRODUCT_PRICE_ID',
5662  'NOTES',
5663  'VAT_RATE',
5664  'BASE_PRICE',
5665  'PRICE',
5666  'CURRENCY',
5667  'DISCOUNT_PRICE',
5668  );
5669  }

◆ getProductListFromBasketProviderList()

static getProductListFromBasketProviderList (   $basketProviderList,
array  $productList = array() 
)
staticprotected
Аргументы
$basketProviderList
array$productList
Возвращает
array|bool

См. определение в файле providerbase.php строка 4394

4395  {
4396  $select = array(
4397  'ID',
4398  'CAN_BUY_ZERO',
4399  'NEGATIVE_AMOUNT_TRACE',
4400  'QUANTITY_TRACE',
4401  'QUANTITY',
4402  'QUANTITY_RESERVED'
4403  );
4404 
4405  $providerProductList = array();
4406 
4407  if (!empty($basketProviderList))
4408  {
4409  foreach ($basketProviderList as $provider => $providerBasketItemList)
4410  {
4411  $providerProductList = $provider::getProductList($providerBasketItemList, $productList, $select) + $providerProductList;
4412  }
4413  }
4414 
4415  return (!empty($providerProductList) && is_array($providerProductList) ? $providerProductList : false);
4416  }

◆ getProductProviderData()

static getProductProviderData ( array  $products,
  $provider,
array  $data,
array  $select = array() 
)
static

См. определение в файле providerbase.php строка 1330

1331  {
1332  $result = array();
1333 
1334  foreach ($products as $productData)
1335  {
1336  $productSelect = array_fill_keys($select, true);
1337  $productId = $productData['PRODUCT_ID'];
1338 
1339  $currentUseOrderProduct = $data['USE_ORDER_PRODUCT'];
1340  if ($productData['IS_NEW'])
1341  $currentUseOrderProduct = false;
1342 
1343  $fields = $data;
1344 
1345  if ($productData['IS_ORDERABLE'])
1346  {
1347  $fields['CHECK_COUPONS'] = 'Y';
1348  }
1349  else
1350  {
1351  $fields['CHECK_COUPONS'] = 'N';
1352  }
1353 
1354  if ($productData['IS_BUNDLE_CHILD'])
1355  {
1356  $fields['CHECK_DISCOUNT'] = 'N';
1357  $fields['CHECK_COUPONS'] = 'N';
1358  }
1359 
1360  $fields['PRODUCT_ID'] = $productId;
1361 
1362  if (isset($productData['SUBSCRIBE']) && $productData['SUBSCRIBE'] === true)
1363  {
1364  unset($productSelect['QUANTITY'], $productSelect['AVAILABLE_QUANTITY']);
1365 
1366  $fields['CHECK_QUANTITY'] = 'N';
1367  $fields['AVAILABLE_QUANTITY'] = 'N';
1368  }
1369 
1370  $quantityList = array();
1371 
1372  if (!empty($productData['QUANTITY_LIST']))
1373  {
1374  $quantityList = $productData['QUANTITY_LIST'];
1375  }
1376  else
1377  {
1378  $quantityList[$productData['BASKET_CODE']] = $productData['QUANTITY'];
1379  }
1380 
1381  $basketId = null;
1382 
1383  if (!empty($productData['BASKET_ID']))
1384  {
1385  $basketId = $productData['BASKET_ID'];
1386  }
1387 
1388 
1389  if (intval($basketId) == 0)
1390  {
1391  /** @var BasketItem $basketItem */
1392  $basketItem = $productData['BASKET_ITEM'];
1393  if ($basketItem)
1394  {
1395  $basketId = $basketItem->getId();
1396  }
1397  }
1398 //
1399  if (intval($basketId) > 0)
1400  {
1401  $fields['BASKET_ID'] = $basketId;
1402  }
1403 
1404  $hasTrustData = false;
1405 
1406  $trustData = static::getTrustData($data['SITE_ID'], $productData['MODULE'], $productData['PRODUCT_ID']);
1407  $resultProductData = array();
1408 
1409  if (static::isReadTrustData() === true
1410  && !empty($trustData) && is_array($trustData))
1411  {
1412  $hasTrustData = true;
1413  $resultProductData = $trustData;
1414 
1415  foreach (static::getProductDataRequiredFields() as $requiredField)
1416  {
1417  if (!array_key_exists($requiredField, $resultProductData))
1418  {
1419  $hasTrustData = false;
1420  break;
1421  }
1422  }
1423 
1424 
1425  if ($hasTrustData && isset($productSelect['PRICE']))
1426  {
1427  foreach (static::getProductDataRequiredPriceFields() as $requiredField)
1428  {
1429  if (!array_key_exists($requiredField, $resultProductData))
1430  {
1431  $hasTrustData = false;
1432  break;
1433  }
1434  }
1435  }
1436  }
1437 
1438  $itemCode = $productData['PRODUCT_ID'];
1439 
1440  $resultProviderDataList = array();
1441 
1442  if(!$hasTrustData)
1443  {
1444  foreach($quantityList as $basketCode => $quantity)
1445  {
1446  if (!empty($resultProviderDataList[$quantity]))
1447  {
1448  $resultProviderDataList[$quantity]['BASKET_CODE'][] = $basketCode;
1449  continue;
1450  }
1451 
1452  $requestFields = $fields;
1453  $requestFields['QUANTITY'] = $quantity;
1454 
1455  $resultProviderDataList[$quantity] = array(
1456  'BASKET_CODE' => array($basketCode),
1457  'DATA' => ($currentUseOrderProduct ? $provider::OrderProduct(
1458  $requestFields
1459  ) : $provider::GetProductData($requestFields))
1460  );
1461 
1462  }
1463 
1464  }
1465  else
1466  {
1467 
1468  if (!isset($productSelect['AVAILABLE_QUANTITY']) && array_key_exists("AVAILABLE_QUANTITY", $resultProductData))
1469  {
1470  unset($resultProductData['AVAILABLE_QUANTITY']);
1471  }
1472 
1473  $productQuantity = floatval($resultProductData['QUANTITY']);
1474 
1475  $resultProviderDataList[$productQuantity] = array(
1476  'BASKET_CODE' => array($productData['BASKET_CODE']),
1477  'DATA' => $resultProductData
1478  );
1479 
1480  }
1481 
1482  $priceFields = static::getPriceFields();
1483 
1484  foreach ($resultProviderDataList as $quantity => $providerData)
1485  {
1486  if (empty($result[$itemCode]))
1487  {
1488  $result[$itemCode] = $providerData['DATA'];
1489  }
1490 
1491  $basketCodeList = $providerData['BASKET_CODE'];
1492 
1493  foreach ($basketCodeList as $basketCode)
1494  {
1495  $result[$itemCode]['PRICE_LIST'][$basketCode] = array(
1496  "ITEM_CODE" => $itemCode,
1497  "BASKET_CODE" => $basketCode,
1498  );
1499 
1500  if (isset($providerData['DATA']['QUANTITY']) && $providerData['DATA']['QUANTITY'] > 0)
1501  {
1502  $result[$itemCode]['PRICE_LIST'][$basketCode]['QUANTITY'] = $providerData['DATA']['QUANTITY'];
1503  }
1504 
1505  if (isset($providerData['DATA']['AVAILABLE_QUANTITY']))
1506  {
1507  $result[$itemCode]['PRICE_LIST'][$basketCode]['AVAILABLE_QUANTITY'] = $providerData['DATA']['AVAILABLE_QUANTITY'];
1508  }
1509  }
1510 
1511  foreach ($priceFields as $fieldName)
1512  {
1513  if (isset($providerData['DATA'][$fieldName]))
1514  {
1515  foreach ($basketCodeList as $basketCode)
1516  {
1517  $result[$itemCode]['PRICE_LIST'][$basketCode][$fieldName] = $providerData['DATA'][$fieldName];
1518  }
1519  }
1520  }
1521  }
1522 
1523 // $result[$itemCode]['ITEM_CODE'] = $productData['ITEM_CODE'];
1524 
1525  if ($productData['IS_BUNDLE_PARENT'])
1526  {
1527  $result[$itemCode]["BUNDLE_ITEMS"] = array();
1528  /** @var array $bundleChildList */
1529  $bundleChildDataList = static::getBundleChildItemsByProductData($provider, $productData);
1530  if (!empty($bundleChildDataList) && is_array($bundleChildDataList))
1531  {
1532 
1533  foreach ($bundleChildDataList["ITEMS"] as &$itemData)
1534  {
1535  $itemData['QUANTITY'] = $itemData['QUANTITY'] * $productData['QUANTITY'];
1536  }
1537  unset($itemData);
1538  $result[$itemCode]["BUNDLE_ITEMS"] = $bundleChildDataList["ITEMS"];
1539  }
1540  }
1541  }
1542 
1543  return $result;
1544  }

◆ getProductStores()

static getProductStores ( BasketItem  $basketItem)
static
Аргументы
BasketItem$basketItem
Возвращает
Result
Исключения
ObjectNotFoundException

См. определение в файле providerbase.php строка 3748

3749  {
3750  $result = new Result();
3751 
3752  $basketItemProviderMap = static::createProviderBasketItemMap($basketItem, array('SITE_ID'));
3753 
3754  if (!empty($basketItemProviderMap))
3755  {
3756  $provider = $basketItemProviderMap['PROVIDER'];
3757 
3758  if (array_key_exists("IBXSaleProductProvider", class_implements($provider)))
3759  {
3760  $productId = $basketItemProviderMap["PRODUCT_ID"];
3761  $data = array(
3762  "PRODUCT_ID" => $productId,
3763  "SITE_ID" => $basketItemProviderMap["SITE_ID"],
3764  'BASKET_ID' => $basketItemProviderMap['BASKET_ID']
3765  );
3766 
3767  $r = static::getStores($provider, $data);
3768  if ($r->isSuccess())
3769  {
3770  $resultProductData = $r->getData();
3771  if (array_key_exists($productId, $resultProductData))
3772  {
3773  $result->setData($resultProductData);
3774  }
3775  }
3776 
3777  }
3778  elseif (class_exists($provider))
3779  {
3780  /** @var Basket $basket */
3781  $basket = $basketItem->getCollection();
3782  if (!$basket)
3783  {
3784  throw new ObjectNotFoundException('Entity "Basket" not found');
3785  }
3786 
3787  /** @var Order $order */
3788  $order = $basket->getOrder();
3789  if (!$order)
3790  {
3791  throw new ObjectNotFoundException('Entity "Order" not found');
3792  }
3793 
3794  $context = array(
3795  'SITE_ID' => $order->getSiteId(),
3796  'CURRENCY' => $order->getCurrency(),
3797  );
3798 
3799  if ($order->getUserId() > 0)
3800  {
3801  $context['USER_ID'] = $order->getUserId();
3802  }
3803  else
3804  {
3805  global $USER;
3806  $context['USER_ID'] = $USER->getId();
3807  }
3808 
3809  /** @var SaleProviderBase $providerClass */
3810  $providerClass = new $provider($context);
3811  if ($providerClass && $providerClass instanceof SaleProviderBase)
3812  {
3813 
3814  $creator = Internals\ProviderCreator::create($context);
3815  $creator->addBasketItem($basketItem);
3816 
3817  $r = $creator->getProductStores();
3818  if ($r->isSuccess())
3819  {
3820  $result->setData($r->getData());
3821  }
3822  else
3823  {
3824  $result->addErrors($r->getErrors());
3825  }
3826 
3827  }
3828  }
3829  }
3830 
3831  return $result;
3832  }

◆ getQuantityPool()

static getQuantityPool (   $key)
staticprotected
Аргументы
$key
Возвращает
Internals\Pool

См. определение в файле providerbase.php строка 111

112  {
114  return $pool->getByType(Internals\PoolQuantity::POOL_QUANTITY_TYPE);
115  }

◆ getQuantityPoolItem()

static getQuantityPoolItem (   $key,
BasketItem  $item 
)
static
Аргументы
$key
BasketItem$item
Возвращает
float|null

См. определение в файле providerbase.php строка 131

132  {
134  return $pool->get(Internals\PoolQuantity::POOL_QUANTITY_TYPE, $item->getField('PRODUCT_ID'));
135  }

◆ getReservationPool()

static getReservationPool (   $key)
staticprotected
Аргументы
$key
Возвращает
Internals\Pool

См. определение в файле providerbase.php строка 53

54  {
56  return $pool->getByType(Internals\PoolQuantity::POOL_RESERVE_TYPE);
57  }

◆ getReservationPoolItem()

static getReservationPoolItem (   $key,
BasketItem  $item 
)
static
Аргументы
$key
BasketItem$item
Возвращает
float|null

См. определение в файле providerbase.php строка 75

76  {
78  return $pool->get(Internals\PoolQuantity::POOL_RESERVE_TYPE, $item->getField('PRODUCT_ID'));
79  }

◆ getSetItems()

static getSetItems ( BasketItemBase  $basketItem)
static
Аргументы
BasketItemBase$basketItem
Возвращает
array|bool|mixed
Исключения
ObjectNotFoundException

См. определение в файле providerbase.php строка 4225

4226  {
4227  $bundleChildList = array();
4228  $provider = $basketItem->getProvider();
4229  if ($provider)
4230  {
4231  if (array_key_exists("IBXSaleProductProvider", class_implements($provider)))
4232  {
4233  $bundleChildList = $provider::GetSetItems($basketItem->getProductId(), BasketItem::TYPE_SET, array('BASKET_ID' => $basketItem->getId()));
4234  }
4235  elseif (class_exists($provider))
4236  {
4237  /** @var BasketItemCollection $collection */
4238  $collection = $basketItem->getCollection();
4239 
4240  /** @var Basket $basket */
4241  $basket = $collection->getBasket();
4242  if (!$basket)
4243  {
4244  throw new ObjectNotFoundException('Entity "Basket" not found');
4245  }
4246 
4247  $order = $basket->getOrder();
4248 
4249  if ($order)
4250  {
4251  $context = array(
4252  'SITE_ID' => $order->getSiteId(),
4253  'USER_ID' => $order->getUserId(),
4254  'CURRENCY' => $order->getCurrency(),
4255  );
4256  }
4257  else
4258  {
4259  global $USER;
4260  $context = array(
4261  'SITE_ID' => SITE_ID,
4262  'USER_ID' => $USER && $USER->GetID() > 0 ? $USER->GetID() : 0,
4263  'CURRENCY' => Currency\CurrencyManager::getBaseCurrency(),
4264  );
4265  }
4266  $creator = Internals\ProviderCreator::create($context);
4267 
4268  $creator->addBasketItem($basketItem);
4269 
4270  $r = $creator->getBundleItems();
4271  if ($r->isSuccess())
4272  {
4273  $resultProductListData = $r->getData();
4274  if (!empty($resultProductListData['BUNDLE_LIST']))
4275  {
4276  $bundleChildList = $resultProductListData['BUNDLE_LIST'];
4277  }
4278  }
4279 
4280  $order = $basket->getOrder();
4281 
4282  if ($order)
4283  {
4284  $context = array(
4285  'SITE_ID' => $order->getSiteId(),
4286  'USER_ID' => $order->getUserId(),
4287  'CURRENCY' => $order->getCurrency(),
4288  );
4289  }
4290  else
4291  {
4292  global $USER;
4293  $context = array(
4294  'SITE_ID' => SITE_ID,
4295  'USER_ID' => $USER && $USER->GetID() > 0 ? $USER->GetID() : 0,
4296  'CURRENCY' => Currency\CurrencyManager::getBaseCurrency(),
4297  );
4298  }
4299  $creator = Internals\ProviderCreator::create($context);
4300 
4301  $creator->addBasketItem($basketItem);
4302 
4303  $r = $creator->getBundleItems();
4304  if ($r->isSuccess())
4305  {
4306  $resultProductListData = $r->getData();
4307  if (!empty($resultProductListData['BUNDLE_LIST']))
4308  {
4309  $bundleChildList = $resultProductListData['BUNDLE_LIST'];
4310  }
4311  }
4312  }
4313  else
4314  {
4315  $bundleChildList = \CSaleBasket::executeCallbackFunction(
4316  $basketItem->getField('CALLBACK_FUNC'),
4317  $basketItem->getField('MODULE'),
4318  $basketItem->getField('PRODUCT_ID'),
4319  $basketItem->getField('QUANTITY')
4320  );
4321  }
4322 
4323  return $bundleChildList;
4324  }
4325 
4326  return false;
4327  }

◆ getStoreDataFromShipmentItemCollection()

static getStoreDataFromShipmentItemCollection (   $shipmentItemList)
staticprotected
Аргументы
$shipmentItemList
Возвращает
Result

См. определение в файле providerbase.php строка 2555

2556  {
2557  $result = new Result();
2559  if (!empty($list))
2560  {
2561  $result->setData(array(
2562  'STORE_DATA_LIST' => $list
2563  ));
2564  }
2565  return $result;
2566  }

◆ getStores()

static getStores (   $provider,
array  $fields 
)
static

См. определение в файле providerbase.php строка 3841

3842  {
3843  $result = new Result();
3844  $resultData = $provider::getProductStores($fields);
3845 
3846  $result->setData(
3847  array(
3848  $fields['PRODUCT_ID'] => $resultData
3849  )
3850  );
3851 
3852  return $result;
3853  }

◆ getTrustData()

static getTrustData (   $siteId,
  $module,
  $productId 
)
static

См. определение в файле providerbase.php строка 5399

5400  {
5401  if (static::isExistsTrustData($siteId, $module, $productId))
5402  return static::$trustData[$siteId][$module][$productId];
5403 
5404  return null;
5405  }

◆ getUpdatableFields()

static getUpdatableFields ( )
static

См. определение в файле providerbase.php строка 5619

5620  {
5621  return array(
5622  'CAN_BUY',
5623 
5624  'VAT_RATE',
5625  'VAT_INCLUDED',
5626 
5627  'PRODUCT_PRICE_ID',
5628  'PRICE',
5629  'CURRENCY',
5630  'BASE_PRICE',
5631  'DISCOUNT_PRICE',
5632 
5633  'QUANTITY',
5634  'QUANTITY_RESERVED',
5635  );
5636  }

◆ getViewProduct()

static getViewProduct (   $provider,
array  $fields 
)
static

См. определение в файле providerbase.php строка 4081

4082  {
4083  $result = new Result();
4084 
4085  if (!array_key_exists("IBXSaleProductProvider", class_implements($provider)))
4086  {
4087  throw new ArgumentTypeException('provider');
4088  }
4089 
4090  $resultData = $provider::viewProduct($fields);
4091  $result->setData(
4092  array(
4093  $fields['PRODUCT_ID'] => $resultData
4094  )
4095  );
4096  return $result;
4097  }

◆ increaseProductQuantity()

static increaseProductQuantity ( ShipmentCollection  $shipmentCollection,
array  $shipmentReserveList = array() 
)
static

increase in the quantity of product if the reservation is disabled

Аргументы
ShipmentCollection$shipmentCollection
array$shipmentReserveList
Исключения
ObjectNotFoundException

См. определение в файле providerbase.php строка 3695

3696  {
3697  /** @var Order $order */
3698  if (!$order = $shipmentCollection->getOrder())
3699  {
3700  throw new ObjectNotFoundException('Entity "Order" not found');
3701  }
3702 
3703  $options = array(
3704  'ORDER_DEDUCTED' => $order->isShipped()
3705  );
3706 
3707  $shipmentReserveListKeys = array_keys($shipmentReserveList);
3708 
3709  foreach ($shipmentCollection as $shipmentKey => $shipment)
3710  {
3711  if (!in_array($shipment->getId(), $shipmentReserveListKeys))
3712  {
3713  unset($shipmentCollection[$shipmentKey]);
3714  }
3715  }
3716 
3717 
3718  foreach ($shipmentCollection as $shipment)
3719  {
3720  $basketProviderList = static::getProviderBasketFromShipment($shipment);
3721 
3722  $productList = static::getProductListFromBasketProviderList($basketProviderList);
3723 
3724  if (!empty($basketProviderList))
3725  {
3726  foreach ($basketProviderList as $provider => $providerBasketItemList)
3727  {
3728  $shipmentReserveListData = array();
3729  if (!empty($shipmentReserveList)
3730  && !empty($shipmentReserveList[$shipment->getId()]) && is_array($shipmentReserveList[$shipment->getId()]))
3731  {
3732  $shipmentReserveListData = $shipmentReserveList[$shipment->getId()];
3733  }
3734 
3735  $result = $provider::increaseProductQuantity($providerBasketItemList, $productList, $shipmentReserveListData, $options);
3736  }
3737  }
3738 
3739  }
3740  }

◆ isExistsTrustData()

static isExistsTrustData (   $siteId,
  $module,
  $productId 
)
static

См. определение в файле providerbase.php строка 5372

5373  {
5374  return (!empty(static::$trustData[$siteId][$module][$productId]) && is_array(static::$trustData[$siteId][$module][$productId]));
5375  }

◆ isNeedShip()

static isNeedShip (   $shipmentItemList)
static
Аргументы
ShipmentItem[]$shipmentItemList
Возвращает
Result
Исключения
ObjectNotFoundException

См. определение в файле providerbase.php строка 5841

5842  {
5843  $result = new Result();
5844 
5845  $resultList = array();
5846 
5847  /** @var ShipmentItem $shipmentItem */
5848  foreach ($shipmentItemList as $shipmentItem)
5849  {
5850  $basketItem = $shipmentItem->getBasketItem();
5851  $providerName = $basketItem->getProviderName();
5852 
5853  if ($providerName && array_key_exists("IBXSaleProductProvider", class_implements($providerName)))
5854  {
5855 
5856  $isNeedShip = false;
5857 
5858  if (method_exists($providerName, 'isNeedShip'))
5859  {
5860  $isNeedShip = $providerName::isNeedShip();
5861  }
5862 
5863  $resultList[$providerName] = $isNeedShip;
5864 
5865  }
5866  }
5867 
5868  if (!empty($resultList))
5869  {
5870  $result->setData($resultList);
5871  }
5872 
5873  return $result;
5874  }

◆ isReadTrustData()

static isReadTrustData ( )
static

См. определение в файле providerbase.php строка 5358

5359  {
5360  return (bool)static::$useReadTrustData;
5361  }

◆ makeArrayFromBasketCollection()

static makeArrayFromBasketCollection ( BasketItemCollection  $basketCollection,
BasketItem  $refreshItem = null 
)
staticprotected
Аргументы
BasketBasketItemCollection
BasketItem | null$refreshItem
Возвращает
array

См. определение в файле providerbase.php строка 2574

2575  {
2576  $basketList = array();
2577  /** @var BasketItem $basketItem */
2578  foreach ($basketCollection as $basketItem)
2579  {
2580  if ($refreshItem !== null)
2581  {
2582 
2583  if ($basketItem->getBasketCode() != $refreshItem->getBasketCode() && $basketItem->isBundleParent())
2584  {
2585  if ($bundleCollection = $basketItem->getBundleCollection())
2586  {
2587  $foundItem = false;
2588  /** @var BasketItem $bundleBasketItem */
2589  foreach ($bundleCollection as $bundleBasketItem)
2590  {
2591  if ($bundleBasketItem->getBasketCode() == $refreshItem->getBasketCode())
2592  {
2593  $foundItem = true;
2594  break;
2595  }
2596  }
2597 
2598  if (!$foundItem)
2599  continue;
2600 
2601  $basketList[] = $bundleBasketItem;
2602  continue;
2603  }
2604  }
2605  elseif ($basketItem->getBasketCode() != $refreshItem->getBasketCode())
2606  {
2607  continue;
2608  }
2609 
2610  $basketList[] = $basketItem;
2611 
2612  continue;
2613  }
2614 
2615  $basketList[] = $basketItem;
2616 
2617  }
2618 
2619  return $basketList;
2620  }

◆ onOrderSave()

static onOrderSave ( Order  $order)
static
Аргументы
Order$order
Возвращает
Result
Исключения
NotImplementedException
SystemException

См. определение в файле providerbase.php строка 171

172  {
173  $result = new Result();
174 
175  static::resetTrustData($order->getSiteId());
176 
177  /** @var Result $r */
179  if (!$r->isSuccess())
180  {
181  $result->addErrors($r->getErrors());
182  }
183 
184  if ($r->hasWarnings())
185  {
186  $result->addWarnings($r->getWarnings());
187  EntityMarker::addMarker($order, $order, $r);
188  if ($order->getId() > 0)
189  {
190  Internals\OrderTable::update($order->getId(), array('MARKED' => 'Y'));
191  }
192  }
193 
194  static::refreshMarkers($order);
195 
196  return $result;
197  }

◆ recurringOrderProduct()

static recurringOrderProduct ( BasketItem  $basketItem)
static
Аргументы
BasketItem$basketItem
Возвращает
Result
Исключения
ObjectNotFoundException

См. определение в файле providerbase.php строка 4105

4106  {
4107  $result = new Result();
4108  $basketProviderData = static::createProviderBasketItemMap($basketItem, array('SITE_ID', 'USER_ID'));
4109  $provider = $basketProviderData['PROVIDER'];
4110  if (!empty($provider))
4111  {
4112  if (array_key_exists("IBXSaleProductProvider", class_implements($provider)))
4113  {
4114  $data = array(
4115  'PRODUCT_ID' => $basketProviderData['PRODUCT_ID'],
4116  'USER_ID' => $basketProviderData['USER_ID'],
4117  );
4118 
4119  $r = static::recurringProduct($provider, $data);
4120  if ($r->isSuccess())
4121  {
4122  $resultProductData = $r->getData();
4123  if (array_key_exists($basketProviderData['PRODUCT_ID'], $resultProductData))
4124  {
4125  $result->setData($resultProductData);
4126  }
4127 
4128  }
4129 
4130  }
4131  elseif (class_exists($provider))
4132  {
4133  /** @var Basket $basket */
4134  $basket = $basketItem->getCollection();
4135  if (!$basket)
4136  {
4137  throw new ObjectNotFoundException('Entity "Basket" not found');
4138  }
4139 
4140  $order = $basket->getOrder();
4141 
4142  if ($order)
4143  {
4144  $context = array(
4145  'USER_ID' => $order->getUserId(),
4146  'SITE_ID' => $order->getSiteId(),
4147  'CURRENCY' => $order->getCurrency(),
4148  );
4149  }
4150  else
4151  {
4152  global $USER;
4153  $context = array(
4154  'USER_ID' => $USER->getId(),
4155  'SITE_ID' => SITE_ID,
4156  'CURRENCY' => Currency\CurrencyManager::getBaseCurrency(),
4157  );
4158  }
4159 
4160  $creator = Internals\ProviderCreator::create($context);
4161 
4162  $providerClass = $basketItem->getProviderEntity();
4163  if ($providerClass instanceof SaleProviderBase)
4164  {
4165  $creator->addBasketItem($basketItem);
4166  }
4167 
4168  $r = $creator->recurring();
4169  if ($r->isSuccess())
4170  {
4171  $data = $r->getData();
4172  if (array_key_exists('RECURRING_PRODUCTS_LIST', $data))
4173  {
4174  $resultList = $data['RECURRING_PRODUCTS_LIST'];
4175 
4176  if (!empty($resultList))
4177  {
4178  $productId = $basketItem->getProductId();
4179  $result = reset($resultList);
4180 
4181  $result->setData(
4182  array(
4183  $productId => reset($resultList)
4184  )
4185  );
4186  }
4187  }
4188  }
4189  }
4190  }
4191 
4192  return $result;
4193  }

◆ recurringProduct()

static recurringProduct (   $provider,
array  $fields 
)
static
Аргументы
$provider
array$fields
Возвращает
Result
Исключения
ArgumentTypeException

См. определение в файле providerbase.php строка 4202

4203  {
4204  $result = new Result();
4205  if (!array_key_exists("IBXSaleProductProvider", class_implements($provider)))
4206  {
4207  throw new ArgumentTypeException('provider');
4208  }
4209 
4210  $resultData = $provider::recurringOrderProduct($fields);
4211  $result->setData(
4212  array(
4213  $fields['PRODUCT_ID'] => $resultData
4214  )
4215  );
4216  return $result;
4217  }

◆ redistributeToProviders()

static redistributeToProviders ( array  $basketProviderMap)
staticprotected
Аргументы
array$basketProviderMap
Возвращает
array

См. определение в файле providerbase.php строка 5311

5312  {
5313 
5314  $basketProviderList = array();
5315  foreach($basketProviderMap as $basketProviderItem)
5316  {
5317  $providerName = $basketProviderItem['PROVIDER'];
5318  $productId = $basketProviderItem['BASKET_ITEM']->getProductId();
5319  $quantity = floatval($basketProviderItem['QUANTITY']);
5320  unset($basketProviderItem['QUANTITY']);
5321 
5322  $basketCode = $basketProviderItem['BASKET_CODE'];
5323 
5324  if (!isset($basketProviderList[$providerName][$productId]))
5325  {
5326  $basketProviderList[$providerName][$productId] = $basketProviderItem;
5327  }
5328 
5329  if (isset($basketProviderList[$providerName][$productId]['QUANTITY_LIST'][$basketCode]))
5330  {
5331  $basketProviderList[$providerName][$productId]['QUANTITY_LIST'][$basketCode] += $quantity;
5332  }
5333  else
5334  {
5335  $basketProviderList[$providerName][$productId]['QUANTITY_LIST'][$basketCode] = $quantity;
5336  }
5337 
5338 
5339 
5340  }
5341 
5342  return $basketProviderList;
5343  }

◆ reduceProductQuantity()

static reduceProductQuantity ( ShipmentCollection  $shipmentCollection,
array  $shipmentReserveList = array() 
)
static

reduce in the quantity of product if the reservation is disabled

Аргументы
ShipmentCollection$shipmentCollection
array$shipmentReserveList
Исключения
ObjectNotFoundException

См. определение в файле providerbase.php строка 3641

3642  {
3643  /** @var Order $order */
3644  if (!$order = $shipmentCollection->getOrder())
3645  {
3646  throw new ObjectNotFoundException('Entity "Order" not found');
3647  }
3648 
3649  $options = array(
3650  'ORDER_DEDUCTED' => $order->isShipped()
3651  );
3652 
3653  $shipmentReserveListKeys = array_keys($shipmentReserveList);
3654 
3655  foreach ($shipmentCollection as $shipmentKey => $shipment)
3656  {
3657  if (!in_array($shipment->getId(), $shipmentReserveListKeys))
3658  {
3659  unset($shipmentCollection[$shipmentKey]);
3660  }
3661  }
3662 
3663 
3664  foreach ($shipmentCollection as $shipment)
3665  {
3666  $basketProviderList = static::getProviderBasketFromShipment($shipment);
3667 
3668  $productList = static::getProductListFromBasketProviderList($basketProviderList);
3669 
3670  if (!empty($basketProviderList))
3671  {
3672  foreach ($basketProviderList as $provider => $providerBasketItemList)
3673  {
3674  $shipmentReserveListData = array();
3675  if (!empty($shipmentReserveList)
3676  && !empty($shipmentReserveList[$shipment->getId()]) && is_array($shipmentReserveList[$shipment->getId()]))
3677  {
3678  $shipmentReserveListData = $shipmentReserveList[$shipment->getId()];
3679  }
3680 
3681  $result = $provider::reduceProductQuantity($providerBasketItemList, $productList, $shipmentReserveListData, $options);
3682  }
3683  }
3684 
3685  }
3686  }

◆ refreshMarkers()

static refreshMarkers ( Order  $order)
staticprotected
Аргументы
Order$order
Исключения
ArgumentNullException
NotImplementedException
NotSupportedException
ObjectNotFoundException

См. определение в файле providerbase.php строка 5465

5466  {
5467  if ($order->getId() == 0)
5468  {
5469  return;
5470  }
5471 
5472  if (!$shipmentCollection = $order->getShipmentCollection())
5473  {
5474  throw new ObjectNotFoundException('Entity "ShipmentCollection" not found');
5475  }
5476 
5477  if (!$paymentCollection = $order->getPaymentCollection())
5478  {
5479  throw new ObjectNotFoundException('Entity "PaymentCollection" not found');
5480  }
5481 
5482  if (!$basket = $order->getBasket())
5483  {
5484  throw new ObjectNotFoundException('Entity "Basket" not found');
5485  }
5486 
5487  $markList = array();
5488 
5489  $markerEntityList = array();
5490 
5491  $filter = array(
5492  'filter' => array(
5493  '=ORDER_ID' => $order->getId(),
5495  ),
5496  'select' => array('ID', 'ENTITY_TYPE', 'ENTITY_ID', 'CODE', 'SUCCESS'),
5497  'order' => array('ID' => 'DESC')
5498  );
5499  $res = EntityMarker::getList($filter);
5500  while($markerData = $res->fetch())
5501  {
5502  if (!empty($markList[$markerData['ENTITY_TYPE']])
5503  && !empty($markList[$markerData['ENTITY_TYPE']][$markerData['ENTITY_ID']])
5504  && $markerData['CODE'] == $markList[$markerData['ENTITY_TYPE']][$markerData['ENTITY_ID']]
5505  )
5506  {
5507  continue;
5508  }
5509 
5510  if ($markerData['SUCCESS'] != EntityMarker::ENTITY_SUCCESS_CODE_DONE)
5511  {
5512  $markList[$markerData['ENTITY_TYPE']][$markerData['ENTITY_ID']][] = $markerData['CODE'];
5513  }
5514 
5515  if ($poolItemSuccess = EntityMarker::getPoolItemSuccess($order, $markerData['ID'], $markerData['ENTITY_TYPE'], $markerData['ENTITY_ID'], $markerData['CODE']))
5516  {
5517  if ($poolItemSuccess == EntityMarker::ENTITY_SUCCESS_CODE_DONE)
5518  {
5519  foreach ($markList[$markerData['ENTITY_TYPE']][$markerData['ENTITY_ID']] as $markerIndex => $markerCode)
5520  {
5521  if ($markerData['CODE'] == $markerCode)
5522  {
5523  unset($markList[$markerData['ENTITY_TYPE']][$markerData['ENTITY_ID']][$markerIndex]);
5524  }
5525  }
5526 
5527  if (empty($markList[$markerData['ENTITY_TYPE']][$markerData['ENTITY_ID']]))
5528  {
5529  unset($markList[$markerData['ENTITY_TYPE']][$markerData['ENTITY_ID']]);
5530  }
5531  }
5532  }
5533 
5534  if (empty($markList[$markerData['ENTITY_TYPE']]))
5535  {
5536  unset($markList[$markerData['ENTITY_TYPE']]);
5537  }
5538  }
5539 
5540  if (!empty($markList))
5541  {
5542  foreach ($markList as $markEntityType => $markEntityList)
5543  {
5544  foreach ($markEntityList as $markEntityId => $markEntityCodeList)
5545  {
5546  if (empty($markEntityCodeList))
5547  {
5548  if (($entity = EntityMarker::getEntity($order, $markEntityType, $markEntityId)) && ($entity instanceof \IEntityMarker))
5549  {
5550  if ($entity->canMarked())
5551  {
5552  $markedField = $entity->getMarkField();
5553  $entity->setField($markedField, 'N');
5554  }
5555  }
5556  }
5557  }
5558  }
5559  }
5560 
5561  if (empty($markList) && !EntityMarker::hasErrors($order))
5562  {
5563  if ($shipmentCollection->isMarked())
5564  {
5565  /** @var Shipment $shipment */
5566  foreach ($shipmentCollection as $shipment)
5567  {
5568  if ($shipment->isMarked())
5569  {
5570  $shipment->setField('MARKED', 'N');
5571  }
5572  }
5573  }
5574  if ($paymentCollection->isMarked())
5575  {
5576  /** @var Payment $payment */
5577  foreach ($paymentCollection as $payment)
5578  {
5579  if ($payment->isMarked())
5580  {
5581  $payment->setField('MARKED', 'N');
5582  }
5583  }
5584  }
5585 
5586  $order->setField('MARKED', 'N');
5587  }
5588  }

◆ reserveProduct()

static reserveProduct (   $provider,
  $productId,
  $quantity 
)
static

См. определение в файле providerbase.php строка 3225

3226  {
3227  global $APPLICATION;
3228 
3229  $result = new Result();
3230  $fields = array();
3231 
3232  if ($provider && array_key_exists("IBXSaleProductProvider", class_implements($provider)))
3233  {
3234  $hasProvider = true;
3235  $data = array("PRODUCT_ID" => $productId);
3236 
3237  if ($quantity > 0)
3238  {
3239  $data["UNDO_RESERVATION"] = "N";
3240  $data["QUANTITY_ADD"] = $quantity;
3241  }
3242  else
3243  {
3244  $data["UNDO_RESERVATION"] = "Y";
3245  $data["QUANTITY_ADD"] = abs($quantity);
3246  }
3247 
3248  $APPLICATION->ResetException();
3249  if (($resultReserveData = $provider::ReserveProduct($data)))
3250  {
3251  if ($resultReserveData['RESULT'])
3252  {
3253  $fields['QUANTITY'] = $resultReserveData['QUANTITY_RESERVED'];
3254 
3255  if ($quantity < 0)
3256  {
3257  $fields['QUANTITY'] = $quantity;
3258  }
3259 
3260  $fields['HAS_PROVIDER'] = $hasProvider;
3261  $result->setData($fields);
3262  $exception = $APPLICATION->GetException();
3263  if ($exception)
3264  {
3265  $result->addWarning(new ResultWarning($exception->GetString(), $exception->GetID()));
3266  }
3267  return $result;
3268  }
3269  else
3270  {
3271  $exception = $APPLICATION->GetException();
3272  if ($exception)
3273  {
3274  $result->addWarning(new ResultWarning($exception->GetString(), $exception->GetID()));
3275  }
3276  else
3277  {
3278  $result->addError(new ResultError(Loc::getMessage('SALE_PROVIDER_RESERVE_BASKET_ITEM_ERROR'), 'SALE_PROVIDER_RESERVE_BASKET_ITEM_ERROR')) ;
3279  }
3280  }
3281 
3282  }
3283  else
3284  {
3285  $result->addError(new ResultError(Loc::getMessage('SALE_PROVIDER_RESERVE_BASKET_ITEM_ERROR'), 'SALE_PROVIDER_RESERVE_BASKET_ITEM_ERROR')) ;
3286  }
3287 
3288  }
3289  else
3290  {
3291  $fields['QUANTITY'] = $quantity;
3292  $result->setData($fields);
3293  }
3294 
3295  return $result;
3296  }

◆ reserveShipmentItem()

static reserveShipmentItem ( ShipmentItem  $shipmentItem,
  $quantity 
)
static
Аргументы
ShipmentItem$shipmentItem
$quantity
Возвращает
Result
Исключения
NotSupportedException
ObjectNotFoundException

См. определение в файле providerbase.php строка 3306

3307  {
3308  global $APPLICATION;
3309  $result = new Result();
3310  $fields = array();
3311 
3312  /** @var ShipmentItemCollection $shipmentItemCollection */
3313  $shipmentItemCollection = $shipmentItem->getCollection();
3314  if (!$shipmentItemCollection)
3315  {
3316  throw new ObjectNotFoundException('Entity "ShipmentItemCollection" not found');
3317  }
3318 
3319  /** @var Shipment $shipment */
3320  $shipment = $shipmentItemCollection->getShipment();
3321  if (!$shipment)
3322  {
3323  throw new ObjectNotFoundException('Entity "Shipment" not found');
3324  }
3325 
3326  /** @var BasketItem $basketItem */
3327  $basketItem = $shipmentItem->getBasketItem();
3328  if (!$basketItem)
3329  {
3330  $result->addError( new ResultError(
3331  Loc::getMessage('SALE_PROVIDER_BASKET_ITEM_NOT_FOUND', array(
3332  '#BASKET_ITEM_ID#' => $shipmentItem->getBasketId(),
3333  '#SHIPMENT_ID#' => $shipment->getId(),
3334  '#SHIPMENT_ITEM_ID#' => $shipmentItem->getId(),
3335  )),
3336  'PROVIDER_RESERVE_SHIPMENT_ITEM_WRONG_BASKET_ITEM') );
3337  return $result;
3338  }
3339 
3340  $provider = $basketItem->getProvider();
3341 
3342 
3343  if ($provider && array_key_exists("IBXSaleProductProvider", class_implements($provider)))
3344  {
3345 
3346  $data = array(
3347  "PRODUCT_ID" => $basketItem->getProductId(),
3348  "UNDO_RESERVATION" => "N",
3349  "QUANTITY_ADD" => $quantity,
3350  "ORDER_DEDUCTED" => $shipment->isShipped()? "Y" : "N",
3351  );
3352 
3353  $APPLICATION->ResetException();
3354  if (($resultReserveData = $provider::ReserveProduct($data)))
3355  {
3356  if ($resultReserveData['RESULT'])
3357  {
3358  $fields['QUANTITY'] = $resultReserveData['QUANTITY_RESERVED'];
3359 
3360  if (isset($resultReserveData['QUANTITY_NOT_RESERVED']) && floatval($resultReserveData['QUANTITY_NOT_RESERVED']) > 0)
3361  {
3362  $fields['QUANTITY'] = $shipmentItem->getReservedQuantity() + ($shipmentItem->getQuantity() - $shipmentItem->getReservedQuantity()) - $resultReserveData['QUANTITY_NOT_RESERVED'];
3363  }
3364 
3365  $result->setData($fields);
3366  return $result;
3367  }
3368  else
3369  {
3370  if ($ex = $APPLICATION->GetException())
3371  {
3372  if ($ex->GetID() != "ALREADY_FLAG")
3373  $result->addError(new ResultError($ex->GetString())) ;
3374  }
3375  else
3376  {
3377  $result->addError(new ResultError(Loc::getMessage('SALE_PROVIDER_RESERVE_BASKET_ITEM_ERROR'), 'SALE_PROVIDER_RESERVE_BASKET_ITEM_ERROR')) ;
3378  }
3379  }
3380 
3381  }
3382 
3383  }
3384  elseif (class_exists($provider))
3385  {
3386  /** @var ShipmentCollection $shipmentCollection */
3387  $shipmentCollection = $shipment->getCollection();
3388  if (!$shipmentCollection)
3389  {
3390  throw new ObjectNotFoundException('Entity "ShipmentCollection" not found');
3391  }
3392 
3393  /** @var Order $order */
3394  $order = $shipmentCollection->getOrder();
3395  if (!$order)
3396  {
3397  throw new ObjectNotFoundException('Entity "Order" not found');
3398  }
3399 
3400  $context = array(
3401  'SITE_ID' => $order->getSiteId(),
3402  'CURRENCY' => $order->getCurrency(),
3403  );
3404 
3405  if ($order->getUserId() > 0)
3406  {
3407  $context['USER_ID'] = $order->getUserId();
3408  }
3409  else
3410  {
3411  global $USER;
3412  $context['USER_ID'] = $USER->getId();
3413  }
3414 
3415  /** @var SaleProviderBase $providerClass */
3416  $providerClass = new $provider($context);
3417  if ($providerClass && $providerClass instanceof SaleProviderBase)
3418  {
3419 
3420  $creator = Internals\ProviderCreator::create($context);
3421  $creator->addShipmentItem($shipmentItem);
3422 
3423  $r = $creator->reserve();
3424  if ($r->isSuccess())
3425  {
3426  $r = $creator->setItemsResultAfterReserve($r);
3427  if (!$r->isSuccess())
3428  {
3429  $result->addErrors($r->getErrors());
3430  }
3431  }
3432  else
3433  {
3434  $result->addErrors($r->getErrors());
3435  }
3436 
3437  }
3438  }
3439 
3440  if (!empty($fields))
3441  {
3442  $result->setData($fields);
3443  }
3444  return $result;
3445  }

◆ resetQuantityPool()

static resetQuantityPool (   $key)
staticprotected
Аргументы
$key

См. определение в файле providerbase.php строка 120

121  {
123  $pool->reset(Internals\PoolQuantity::POOL_QUANTITY_TYPE);
124  }

◆ resetReservationPool()

static resetReservationPool (   $key)
staticprotected
Аргументы
$key
Возвращает
Internals\Pool

См. определение в файле providerbase.php строка 64

65  {
67  $pool->reset(Internals\PoolQuantity::POOL_RESERVE_TYPE);
68  }

◆ resetTrustData()

static resetTrustData (   $siteId = null,
  $module = null,
  $productId = null 
)
static

См. определение в файле providerbase.php строка 5413

5414  {
5415  if (strval($siteId) != '')
5416  {
5417  if (!empty(static::$trustData[$siteId]))
5418  {
5419  if (intval($productId) > 0 )
5420  {
5421  if (strval($module) == '')
5422  {
5423  foreach (static::$trustData[$siteId] as $moduleName => $data)
5424  {
5425  if (isset(static::$trustData[$siteId][$moduleName][$productId]))
5426  unset(static::$trustData[$siteId][$moduleName][$productId]);
5427  }
5428  }
5429  else
5430  {
5431  if (isset(static::$trustData[$siteId][$module][$productId]))
5432  unset(static::$trustData[$siteId][$module][$productId]);
5433  }
5434  }
5435  elseif (strval($module) != '')
5436  {
5437  if (isset(static::$trustData[$siteId][$module]))
5438  unset(static::$trustData[$siteId][$module]);
5439  }
5440  else
5441  {
5442  if (isset(static::$trustData[$siteId]))
5443  unset(static::$trustData[$siteId]);
5444  }
5445  }
5446  }
5447  else
5448  {
5449  static::$trustData = array();
5450  }
5451 
5452  }

◆ setQuantityPoolItem()

static setQuantityPoolItem (   $key,
BasketItem  $item,
  $value 
)
staticprotected
Аргументы
$key
BasketItem$item
$value

См. определение в файле providerbase.php строка 142

143  {
144  $code = $item->getBasketCode()."|".$item->getField('MODULE')."|".$item->getField('PRODUCT_ID');
145  $poolInstance = Internals\PoolQuantity::getInstance($key);
146  $poolInstance->set(Internals\PoolQuantity::POOL_RESERVE_TYPE, $code, $value);
147 
148  $pool = $poolInstance->getByType(Internals\PoolQuantity::POOL_RESERVE_TYPE);
149  $pool->addItem($code, $item);
150  }

◆ setReservationPoolItem()

static setReservationPoolItem (   $key,
BasketItem  $item,
  $value 
)
staticprotected
Аргументы
$key
BasketItem$item
$value

См. определение в файле providerbase.php строка 86

87  {
88  $poolInstance = Internals\PoolQuantity::getInstance($key);
89  $code = $item->getBasketCode()."|".$item->getField('MODULE')."|".$item->getField('PRODUCT_ID');
90  $poolInstance->set(Internals\PoolQuantity::POOL_RESERVE_TYPE, $code, $value);
91 
92  $pool = $poolInstance->getByType(Internals\PoolQuantity::POOL_RESERVE_TYPE);
93  $pool->addItem($code, $item);
94  }

◆ setTrustData()

static setTrustData (   $siteId,
  $module,
  $productId,
array  $fields 
)
static

См. определение в файле providerbase.php строка 5385

5386  {
5387  static::$trustData[$siteId][$module][$productId] = $fields;
5388  }

◆ setUsingTrustData()

static setUsingTrustData (   $value)
static

См. определение в файле providerbase.php строка 5349

5350  {
5351  static::$useReadTrustData = (bool)$value;
5352  }

◆ shipBasketItem()

static shipBasketItem ( BasketItemBase  $basketItem)
static

См. определение в файле providerbase.php строка 208

209  {
210 
211  $result = new Result();
212 
213  /** @var Basket $basket */
214  if (!$basket = $basketItem->getCollection())
215  {
216  throw new ObjectNotFoundException('Entity "Basket" not found');
217  }
218 
219  /** @var Order $order */
220  if (!$order = $basket->getOrder())
221  {
222  throw new ObjectNotFoundException('Entity "Order" not found');
223  }
224 
225  /** @var ShipmentCollection $shipmentCollection */
226  $shipmentCollection = $order->getShipmentCollection();
227 
228  /** @var Shipment $shipment */
229  foreach ($shipmentCollection as $shipment)
230  {
231  $needShip = $shipment->needShip();
232  if ($needShip === null)
233  continue;
234 
235  $r = static::shipShipment($shipment);
236  if (!$r->isSuccess())
237  {
238  $result->addErrors($r->getErrors());
239  }
240  elseif ($r->hasWarnings())
241  {
242  $result->addWarnings($r->getWarnings());
243  EntityMarker::addMarker($order, $shipment, $r);
244  if (!$shipment->isSystem())
245  {
246  $shipment->setField('MARKED', 'Y');
247  }
248  }
249  }
250 
251  return $result;
252  }

◆ shipProductData()

static shipProductData (   $provider,
array  $fields,
array  $storeDataList = array() 
)
static
Аргументы
$provider
array$fields
array$storeDataList
Возвращает
Result

См. определение в файле providerbase.php строка 436

437  {
438  $result = new Result();
439 
440  $quantity = $fields['QUANTITY'];
441  $basketCode = $fields['BASKET_CODE'];
442 
443  /** @var BasketItem $basketItem */
444  $basketItem = $fields['BASKET_ITEM'];
445 
446  /** @var BasketBase $basket */
447  $basket = $basketItem->getCollection();
448 
449  /** @var OrderBase $order */
450  $order = $basket->getOrder();
451 
452  $data = array(
453  "BASKET_ITEM" => $basketItem,
454  "PRODUCT_ID" => $fields['PRODUCT_ID'],
455  "QUANTITY" => $quantity,
456  "PRODUCT_RESERVED" => "N",
457  'UNDO_DEDUCTION' => $fields['DEDUCTED']? 'N' : 'Y',
458  'EMULATE' => 'N',
459  );
460 
461  if ($data['UNDO_DEDUCTION'] == 'N')
462  {
463  $data['PRODUCT_RESERVED'] = "Y";
464  }
465 
466  if (!empty($fields['RESERVED']))
467  {
468  $data['PRODUCT_RESERVED'] = $fields['RESERVED'] ? 'Y' : 'N';
469  }
470 
471  $resultProductData = array();
472 
474  {
475 
476  if (!empty($storeDataList) && is_array($storeDataList) && isset($storeDataList[$basketCode]))
477  {
478  $data['STORE_DATA'] = $storeDataList[$basketCode];
479  }
480 
481  if (!empty($data['STORE_DATA']))
482  {
483  $allBarcodeQuantity = 0;
484  foreach($data['STORE_DATA'] as $basketShipmentItemStore)
485  {
486  $allBarcodeQuantity += $basketShipmentItemStore['QUANTITY'];
487  }
488 
489  if ($quantity > $allBarcodeQuantity)
490  {
491  $result->addWarning(new ResultWarning(Loc::getMessage('SALE_PROVIDER_SHIPMENT_SHIPPED_LESS_QUANTITY', array(
492  '#PRODUCT_NAME#' => $basketItem->getField('NAME')
493  )), 'SALE_PROVIDER_SHIPMENT_SHIPPED_LESS_QUANTITY'));
494 
495  $resultProductData['RESULT'] = false;
496  }
497  elseif ($quantity < $allBarcodeQuantity)
498  {
499  $result->addWarning(new ResultWarning(Loc::getMessage('SALE_PROVIDER_SHIPMENT_SHIPPED_MORE_QUANTITY', array(
500  '#PRODUCT_NAME#' => $basketItem->getField('NAME')
501  )), 'SALE_PROVIDER_SHIPMENT_SHIPPED_MORE_QUANTITY'));
502 
503  $resultProductData['RESULT'] = false;
504  }
505  }
506 
507  }
508 
509  if (!isset($resultProductData['RESULT'])
510  || $resultProductData['RESULT'] !== false)
511  {
512  global $APPLICATION;
513  $APPLICATION->ResetException();
514  $resultProductData = $provider::DeductProduct($data);
515 
516  $result->setData($resultProductData);
517 
518  $needShip = $fields['DEDUCTED'];
519  $oldException = $APPLICATION->GetException();
520  if (!empty($oldException))
521  {
522  if ($needShip === true)
523  {
524  $result->addWarning( new ResultWarning($oldException->GetString(), $oldException->GetID()) );
525  }
526  }
527 
528  if (($oldException && $needShip === false) || !$oldException)
529  {
530  static::addQuantityPoolItem($order->getInternalId(), $basketItem, ($needShip? 1 : -1) * $quantity);
531  }
532  }
533 
534  return $result;
535  }

◆ shipShipment()

static shipShipment ( Shipment  $shipment)
static
Аргументы
Shipment$shipment
Возвращает
Result
Исключения
NotSupportedException
SystemException

См. определение в файле providerbase.php строка 260

261  {
262  $result = new Result();
263 
264  /** @var ShipmentItemCollection $shipmentItemCollection */
265  if (!$shipmentItemCollection = $shipment->getShipmentItemCollection())
266  {
267  throw new ObjectNotFoundException('Entity "ShipmentCollection" not found');
268  }
269 
270  /** @var ShipmentCollection $shipmentCollection */
271  if (!$shipmentCollection = $shipment->getCollection())
272  {
273  throw new ObjectNotFoundException('Entity "ShipmentCollection" not found');
274  }
275 
276  /** @var Order $order */
277  if (!$order = $shipmentCollection->getOrder())
278  {
279  throw new ObjectNotFoundException('Entity "Order" not found');
280  }
281 
282  $pool = Internals\PoolQuantity::getInstance($order->getInternalId());
283  $quantityPool = $pool->getQuantities(Internals\PoolQuantity::POOL_QUANTITY_TYPE);
284  if (empty($quantityPool))
285  {
286  return $result;
287  }
288 
289  $reverse = false;
290 
291  $resultList = array();
292 
293  $basketList = static::getBasketFromShipmentItemCollection($shipmentItemCollection);
294 
295  $basketProviderMap = static::createProviderBasketMap($basketList, array('QUANTITY', 'RESERVED'));
296  $basketProviderList = static::redistributeToProviders($basketProviderMap);
297  $storeDataList = array();
298 
300  {
301 
302  /** @var Result $r */
303  $r = static::getStoreDataFromShipmentItemCollection($shipmentItemCollection);
304  if (!$r->isSuccess())
305  {
306  $result->addErrors($r->getErrors());
307  }
308  else
309  {
310  $resultStoreData = $r->getData();
311  if (!empty($resultStoreData['STORE_DATA_LIST']))
312  {
313  $storeDataList = $resultStoreData['STORE_DATA_LIST'];
314  }
315 
316  }
317  }
318 
319  if (!empty($basketProviderList))
320  {
321  foreach ($basketProviderList as $provider => $providerBasketItemList)
322  {
323  if ($provider && array_key_exists("IBXSaleProductProvider", class_implements($provider)))
324  {
325 
326  foreach ($providerBasketItemList as $providerBasketItem)
327  {
328 
329  if ($providerBasketItem['BASKET_ITEM']->isBundleParent())
330  {
331  continue;
332  }
333 
334  $poolQuantity = static::getQuantityPoolItem($order->getInternalId(), $providerBasketItem['BASKET_ITEM']);
335 
336  if ($poolQuantity == 0)
337  continue;
338 
339  if ($providerBasketItem['BASKET_ITEM']->getField('MODULE') != '')
340  {
341  $shipFields = array_merge($providerBasketItem, array(
342  'DEDUCTION' => ($poolQuantity < 0)
343  ));
344 
345  $r = static::shipProductData($provider, $shipFields, $storeDataList);
346 
347  if (!$r->isSuccess())
348  {
349  $result->addErrors($r->getErrors());
350  }
351  $resultProductData = $r->getData();
352 
353  }
354  else
355  {
356  $resultProductData['RESULT'] = true;
357  }
358 
359  $resultList[$providerBasketItem['BASKET_CODE']] = $resultProductData;
360 
361  if (array_key_exists("RESULT", $resultProductData)
362  && $resultProductData['RESULT'] === false && $poolQuantity < 0)
363  {
364  $reverse = true;
365  break;
366  }
367 
368  }
369 
370  }
371  elseif (class_exists($provider))
372  {
373  $context = array(
374  'SITE_ID' => $order->getSiteId(),
375  'CURRENCY' => $order->getCurrency(),
376  );
377 
378  if ($order->getUserId() > 0)
379  {
380  $context['USER_ID'] = $order->getUserId();
381  }
382  else
383  {
384  global $USER;
385  $context['USER_ID'] = $USER->getId();
386  }
387 
388  $creator = Internals\ProviderCreator::create($context);
389  /** @var ShipmentItem $shipmentItem */
390  foreach ($shipmentItemCollection as $shipmentItem)
391  {
392  $basketItem = $shipmentItem->getBasketItem();
393  $providerClass = $basketItem->getProviderEntity();
394 
395  if ($providerClass instanceof SaleProviderBase)
396  {
397  $shipmentProductData = $creator->createItemForShip($shipmentItem);
398  $creator->addShipmentProductData($shipmentProductData);
399  }
400  }
401 
402  $r = $creator->ship();
403  if (!$r->isSuccess())
404  {
405  $result->addErrors($r->getErrors());
406  }
407 
408  $r = $creator->setItemsResultAfterShip($r);
409  if (!$r->isSuccess())
410  {
411  $result->addErrors($r->getErrors());
412  }
413  }
414  }
415  }
416 
417  if ($reverse === true)
418  {
419  static::reverseShipment($shipment, $resultList);
420  }
421  else
422  {
423  static::setShipmentItemReserved($shipment);
424  }
425 
426  return $result;
427  }

◆ syncReservedQuantity()

static syncReservedQuantity ( Shipment  $shipment)
static
Аргументы
Shipment$shipment
Возвращает
array
Исключения
NotSupportedException
ObjectNotFoundException

См. определение в файле providerbase.php строка 3543

3544  {
3545  $result = array();
3546 
3547  /** @var ShipmentCollection $shipmentCollection */
3548  if (!$shipmentCollection = $shipment->getCollection())
3549  {
3550  throw new ObjectNotFoundException('Entity "ShipmentCollection" not found');
3551  }
3552 
3553  /** @var Shipment $systemShipment */
3554  $systemShipment = $shipmentCollection->getSystemShipment();
3555 
3556  /** @var ShipmentItemCollection $shipmentItemCollection */
3557  if (!$shipmentItemCollection = $shipment->getShipmentItemCollection())
3558  {
3559  throw new ObjectNotFoundException('Entity "ShipmentItemCollection" not found');
3560  }
3561 
3562  /** @var ShipmentItem $shipmentItem */
3563  foreach ($shipmentItemCollection as $shipmentIndex => $shipmentItem)
3564  {
3565  $basketCode = $shipmentItem->getBasketCode();
3566 
3567  if (!array_key_exists($basketCode, static::$poolProductQuantity))
3568  {
3569  continue;
3570  }
3571 
3572  $reserveQuantity = static::$poolProductQuantity[$basketCode];
3573 
3574 
3575  if ($reserveQuantity >= 0)
3576  {
3577 
3578  $basketCode = $shipmentItem->getBasketCode();
3579 
3580  if (floatval($shipmentItem->getQuantity()) == floatval($shipmentItem->getReservedQuantity()))
3581  {
3582  continue;
3583  }
3584 
3585  $needReserved = floatval($shipmentItem->getQuantity()) - floatval($shipmentItem->getReservedQuantity());
3586 
3587  $resultQuantity = static::reserveShipmentItem($shipmentItem, (($reserveQuantity - $needReserved) > 0 || $reserveQuantity == 0)? $needReserved : $reserveQuantity );
3588 
3589  if (!$shipment->isSystem())
3590  {
3591  $shipmentReservedQuantity = floatval($shipmentItem->getReservedQuantity()) + $resultQuantity;
3592  if (floatval($shipmentReservedQuantity) != floatval($shipmentItem->getQuantity()))
3593  {
3594  /** @var ShipmentItemCollection $systemShipmentItemCollection */
3595  $systemShipmentItemCollection = $systemShipment->getShipmentItemCollection();
3596 
3597  /** @var ShipmentItem $systemShipmentItem */
3598  if ($systemShipmentItem = $systemShipmentItemCollection->getItemByBasketCode($shipmentItem->getBasketCode()))
3599  {
3600  $needMoreReserved = $shipmentItem->getQuantity() - $shipmentReservedQuantity;
3601  $quantityNeedReserve = $systemShipmentItem->getReservedQuantity() - $needMoreReserved;
3602  $quantityNeedReserve = ($quantityNeedReserve <= 0) ? $systemShipmentItem->getReservedQuantity() : $needMoreReserved ;
3603 
3604  if (static::unreserveShipmentItem($systemShipmentItem, $quantityNeedReserve))
3605  {
3606  $resultNeedQuantity = static::reserveShipmentItem($shipmentItem, $quantityNeedReserve);
3607 
3608  $resultQuantity = $resultQuantity + $resultNeedQuantity;
3609  }
3610  }
3611  }
3612  }
3613  }
3614  else
3615  {
3616 
3617  $resultQuantity = static::unreserveShipmentItem($shipmentItem, $shipmentItem->getReservedQuantity());
3618 
3619  }
3620 
3621  static::$poolProductQuantity[$basketCode] -= $resultQuantity;
3622  $result[$shipmentItem->getBasketCode()] = $resultQuantity;
3623 
3624  if (static::$poolProductQuantity[$basketCode] == 0)
3625  {
3626  unset(static::$poolProductQuantity[$basketCode]);
3627  }
3628 
3629  }
3630 
3631  return $result;
3632  }

◆ tryReserveBasketItem()

static tryReserveBasketItem ( BasketItem  $basketItem,
  $quantity 
)
staticprotected
Аргументы
BasketItem$basketItem
$quantity
Возвращает
Result
Исключения
NotSupportedException

См. определение в файле providerbase.php строка 3059

3060  {
3061  $result = new Result();
3062 
3063  $provider = $basketItem->getProvider();
3064 
3065  if (!$basketItem->isBundleChild())
3066  {
3067  /** @var Basket $basket */
3068  $basket = $basketItem->getCollection();
3069  }
3070  else
3071  {
3072  /** @var BasketItem $parentBasketItem */
3073  $parentBasketItem = $basketItem->getParentBasketItem();
3074 
3075  /** @var Basket $basket */
3076  $basket = $parentBasketItem->getCollection();
3077  }
3078 
3079  $order = $basket->getOrder();
3080  $hasProvider = false;
3081  $quantityTrace = null;
3082 
3083  $poolQuantity = static::getReservationPoolItem($order->getInternalId(), $basketItem);
3084  $tryQuantity = $quantity + $poolQuantity;
3085 
3086  if ($provider && array_key_exists("IBXSaleProductProvider", class_implements($provider)))
3087  {
3088  $hasProvider = true;
3089  $r = static::checkAvailableProductQuantity($basketItem, $tryQuantity);
3090 
3091  $availableQuantityData = $r->getData();
3092  if (array_key_exists('AVAILABLE_QUANTITY', $availableQuantityData))
3093  {
3094  $availableQuantity = floatval($availableQuantityData['AVAILABLE_QUANTITY']);
3095  }
3096  else
3097  {
3098  $result->addWarning(new ResultWarning(Loc::getMessage('SALE_PROVIDER_BASKET_ITEM_WRONG_AVAILABLE_QUANTITY', array(
3099  '#PRODUCT_NAME#' => $basketItem->getField('NAME')
3100  )), 'PROVIDER_BASKET_ITEM_WRONG_AVAILABLE_QUANTITY'));
3101  return $result;
3102  }
3103 
3104  if (array_key_exists('QUANTITY_TRACE', $availableQuantityData))
3105  {
3106  $quantityTrace = $availableQuantityData['QUANTITY_TRACE'];
3107  }
3108 
3109  if (!$r->isSuccess())
3110  {
3111  $result->addErrors($r->getErrors());
3112  }
3113  elseif ($r->hasWarnings())
3114  {
3115  $result->addWarnings($r->getWarnings());
3116  }
3117 
3118  $availableQuantity -= floatval($poolQuantity);
3119  }
3120  else
3121  {
3122  $availableQuantity = $quantity;
3123  }
3124 
3125  $fields = array(
3126  'AVAILABLE_QUANTITY' => $availableQuantity,
3127  'HAS_PROVIDER' => $hasProvider,
3128  );
3129 
3130  if ($quantityTrace !== null)
3131  {
3132  $fields['QUANTITY_TRACE'] = $quantityTrace;
3133  }
3134 
3135  $result->setData($fields);
3136  return $result;
3137  }

◆ tryReserveShipment()

static tryReserveShipment ( Shipment  $shipment)
static
Аргументы
Shipment$shipment
Возвращает
Result
Исключения
ObjectNotFoundException

См. определение в файле providerbase.php строка 2628

2629  {
2630  $result = new Result();
2631 
2632  /** @var ShipmentItemCollection $shipmentCollection */
2633  $shipmentItemCollection = $shipment->getShipmentItemCollection();
2634 
2635  $shipmentItemList = $shipmentItemCollection->getShippableItems();
2636  /** @var ShipmentItem $shipmentItem */
2637  foreach ($shipmentItemList as $shipmentItem)
2638  {
2639  try
2640  {
2641  /** @var Result $r */
2642  $r = static::tryReserveShipmentItem($shipmentItem);
2643  if (!$r->isSuccess())
2644  {
2645  $result->addErrors($r->getErrors());
2646  }
2647  elseif ($r->hasWarnings())
2648  {
2649  $result->addWarnings($r->getWarnings());
2650  }
2651  }
2652  catch(\Exception $e)
2653  {
2654  /** @var Shipment $shipment */
2655  if (!$shipment = $shipmentItemCollection->getShipment())
2656  {
2657  throw new ObjectNotFoundException('Entity "Shipment" not found');
2658  }
2659  else
2660  {
2661  throw new $e;
2662  }
2663 
2664  }
2665 
2666  }
2667 
2668  return $result;
2669  }

◆ tryReserveShipmentItem()

static tryReserveShipmentItem ( ShipmentItem  $shipmentItem)
static
Аргументы
ShipmentItem$shipmentItem
Возвращает
Result
Исключения
NotSupportedException
ObjectNotFoundException

См. определение в файле providerbase.php строка 2728

2729  {
2730  $result = new Result();
2731 
2732  if (floatval($shipmentItem->getQuantity()) == floatval($shipmentItem->getReservedQuantity()))
2733  {
2734  return $result;
2735  }
2736 
2737  /** @var ShipmentItemCollection $shipmentItemCollection */
2738  if (!$shipmentItemCollection = $shipmentItem->getCollection())
2739  {
2740  throw new ObjectNotFoundException('Entity "ShipmentItemCollection" not found');
2741  }
2742 
2743  /** @var Shipment $shipment */
2744  if (!$shipment = $shipmentItemCollection->getShipment())
2745  {
2746  throw new ObjectNotFoundException('Entity "Shipment" not found');
2747  }
2748  /** @var ShipmentCollection $shipmentCollection */
2749  if (!$shipmentCollection = $shipment->getCollection())
2750  {
2751  throw new ObjectNotFoundException('Entity "ShipmentCollection" not found');
2752  }
2753 
2754  /** @var Order $order */
2755  if (!$order = $shipmentCollection->getOrder())
2756  {
2757  throw new ObjectNotFoundException('Entity "Order" not found');
2758  }
2759 
2760  /** @var BasketItem $basketItem */
2761  if (!$basketItem = $shipmentItem->getBasketItem())
2762  {
2763  $result->addError( new ResultError(
2764  Loc::getMessage('SALE_PROVIDER_BASKET_ITEM_NOT_FOUND', array(
2765  '#BASKET_ITEM_ID#' => $shipmentItem->getBasketId(),
2766  '#SHIPMENT_ID#' => $shipment->getId(),
2767  '#SHIPMENT_ITEM_ID#' => $shipmentItem->getId(),
2768  )),
2769  'PROVIDER_RESERVE_SHIPMENT_ITEM_WRONG_BASKET_ITEM') );
2770  return $result;
2771  }
2772 
2773  if ($basketItem->isBundleParent())
2774  {
2775  return $result;
2776  }
2777 
2778  $needQuantity = ($shipmentItem->getQuantity() - $shipmentItem->getReservedQuantity());
2779  $canReserve = false;
2780 
2781  $providerName = $basketItem->getProvider();
2782 
2783  if (class_exists($providerName))
2784  {
2785  if (empty($context))
2786  {
2787  if ($order)
2788  {
2789  $context = array(
2790  'USER_ID' => $order->getUserId(),
2791  'SITE_ID' => $order->getSiteId(),
2792  'CURRENCY' => $order->getCurrency(),
2793  );
2794  }
2795  else
2796  {
2797  global $USER;
2798  $context = array(
2799  'USER_ID' => $USER->getId(),
2800  'SITE_ID' => SITE_ID,
2801  'CURRENCY' => Currency\CurrencyManager::getBaseCurrency(),
2802  );
2803  }
2804  }
2805 
2806  $availableQuantityData = array();
2807 
2808  $providerClass = new $providerName($context);
2809  if ($providerClass instanceof SaleProviderBase)
2810  {
2811  $creator = Internals\ProviderCreator::create($context);
2812  $shipmentProductData = $creator->createItemForReserve($shipmentItem);
2813  $creator->addShipmentProductData($shipmentProductData);
2814 
2815  $r = $creator->getAvailableQuantity();
2816  if ($r->isSuccess())
2817  {
2818  $resultData = $r->getData();
2819  if (!empty($resultData['AVAILABLE_QUANTITY_LIST']))
2820  {
2821  $productId = $basketItem->getProductId();
2822 
2823  $resultAvailableQuantityList = $resultData['AVAILABLE_QUANTITY_LIST'];
2824  if (substr($providerName, 0, 1) == "\\")
2825  {
2826  $providerName = substr($providerName, 1);
2827  }
2828 
2829  if (isset($resultAvailableQuantityList[$providerName]) && isset($resultAvailableQuantityList[$providerName][$productId]))
2830  {
2831  $availableQuantityData = array(
2832  'HAS_PROVIDER' => true,
2833  'AVAILABLE_QUANTITY' => $resultAvailableQuantityList[$providerName][$productId]
2834  );
2835  }
2836  }
2837 
2838  }
2839  else
2840  {
2841  $result->addErrors($r->getErrors());
2842  return $result;
2843  }
2844  }
2845  else
2846  {
2847  /** @var Result $r */
2848  $r = static::tryReserveBasketItem($basketItem, $needQuantity);
2849 
2850  $availableQuantityData = $r->getData();
2851  }
2852  }
2853  else
2854  {
2855  /** @var Result $r */
2856  $r = static::tryReserveBasketItem($basketItem, $needQuantity);
2857 
2858  $availableQuantityData = $r->getData();
2859  }
2860 
2861  if (!$r->isSuccess())
2862  {
2863  $result->addErrors($r->getErrors());
2864  return $result;
2865  }
2866  elseif ($r->hasWarnings())
2867  {
2868  $result->addWarnings($r->getWarnings());
2869  return $result;
2870  }
2871 
2872  if (array_key_exists('AVAILABLE_QUANTITY', $availableQuantityData))
2873  {
2874  $availableQuantity = $availableQuantityData['AVAILABLE_QUANTITY'];
2875  }
2876  else
2877  {
2878  $result->addWarning( new ResultWarning(Loc::getMessage('SALE_PROVIDER_RESERVE_SHIPMENT_ITEM_WRONG_AVAILABLE_QUANTITY', array(
2879  '#PRODUCT_NAME#' => $basketItem->getField('NAME')
2880  )), 'SALE_PROVIDER_RESERVE_SHIPMENT_ITEM_WRONG_AVAILABLE_QUANTITY') );
2881  return $result;
2882  }
2883 
2884  if (array_key_exists('HAS_PROVIDER', $availableQuantityData))
2885  {
2886  $canReserve = $availableQuantityData['HAS_PROVIDER'];
2887  }
2888 
2889  if ($canReserve && array_key_exists('QUANTITY_TRACE', $availableQuantityData))
2890  {
2891  $canReserve = $availableQuantityData['QUANTITY_TRACE'];
2892  }
2893 
2894  if ($canReserve)
2895  {
2896  if ($r->isSuccess() && ($needQuantity > 0) && ($needQuantity > $availableQuantity)
2897  /*|| ($needReserved < 0) && ($availableQuantity < $needReserved) */)
2898  {
2899  $result->addWarning(new ResultWarning(Loc::getMessage("SALE_PROVIDER_RESERVE_SHIPMENT_ITEM_QUANTITY_NOT_ENOUGH", array(
2900  '#PRODUCT_NAME#' => $basketItem->getField('NAME')
2901  )), "SALE_PROVIDER_RESERVE_SHIPMENT_ITEM_QUANTITY_NOT_ENOUGH"));
2902  return $result;
2903  }
2904 
2905  // is not completely correct, but will be processed in real reservations while saving
2906  if (($availableQuantity < 0) && ($shipmentItem->getReservedQuantity() + $availableQuantity < 0))
2907  {
2908  $availableQuantity = -1 * $shipmentItem->getReservedQuantity();
2909  }
2910 
2912  {
2913 
2914  $reservedQuantity = ($availableQuantity >= $needQuantity ? $needQuantity : $availableQuantity);
2915 
2916  static::addReservationPoolItem($order->getInternalId(), $shipmentItem->getBasketItem(), $reservedQuantity);
2917 
2918  $r = $shipmentItem->setField('RESERVED_QUANTITY', $shipmentItem->getReservedQuantity() + $reservedQuantity);
2919  if (!$r->isSuccess())
2920  {
2921  $result->addErrors($r->getErrors());
2922  }
2923  }
2924  }
2925 
2926  $result->addData(array(
2927  'CAN_RESERVE' => $canReserve
2928  ));
2929 
2930  return $result;
2931  }

◆ tryShipment()

static tryShipment ( Shipment  $shipment)
static
Аргументы
Shipment$shipment
Возвращает
Result
Исключения
NotSupportedException
ObjectNotFoundException

См. определение в файле providerbase.php строка 1738

1739  {
1740  $result = new Result();
1741  $needShip = $shipment->needShip();
1742  if ($needShip === null)
1743  return $result;
1744 
1745  $resultList = array();
1746  $storeData = array();
1747 
1748  /** @var ShipmentItemCollection $shipmentItemCollection */
1749  $shipmentItemCollection = $shipment->getShipmentItemCollection();
1750  if (!$shipmentItemCollection)
1751  {
1752  throw new ObjectNotFoundException('Entity "ShipmentItemCollection" not found');
1753  }
1754 
1755  /** @var Shipment $shipment */
1756  $shipment = $shipmentItemCollection->getShipment();
1757  if (!$shipment)
1758  {
1759  throw new ObjectNotFoundException('Entity "ShipmentCollection" not found');
1760  }
1761 
1762  /** @var ShipmentCollection $shipmentCollection */
1763  $shipmentCollection = $shipment->getCollection();
1764  if (!$shipmentCollection)
1765  {
1766  throw new ObjectNotFoundException('Entity "ShipmentCollection" not found');
1767  }
1768 
1769  $r = static::tryShipmentItemList($shipmentItemCollection);
1770 
1771  $basketList = static::getBasketFromShipmentItemCollection($shipmentItemCollection);
1772 
1773  $bundleIndexList = static::getBundleIndexFromShipmentItemCollection($shipmentItemCollection);
1774 
1775  $basketCountList = static::getBasketCountFromShipmentItemCollection($shipmentItemCollection);
1776 
1777  $basketProviderMap = static::createProviderBasketMap($basketList, array('RESERVED', 'SITE_ID'));
1778  $basketProviderList = static::redistributeToProviders($basketProviderMap);
1779 
1781  {
1782  /** @var Result $r */
1783  $r = static::getStoreDataFromShipmentItemCollection($shipmentItemCollection);
1784  if ($r->isSuccess())
1785  {
1786  $resultStoreData = $r->getData();
1787  if (!empty($resultStoreData['STORE_DATA_LIST']))
1788  {
1789  $storeDataList = $resultStoreData['STORE_DATA_LIST'];
1790  }
1791  }
1792  else
1793  {
1794  $result->addErrors($r->getErrors());
1795  }
1796 
1797  }
1798 
1799  if (!empty($basketProviderList))
1800  {
1801  foreach ($basketProviderList as $provider => $providerBasketItemList)
1802  {
1803  if ($provider && array_key_exists("IBXSaleProductProvider", class_implements($provider)))
1804  {
1805  foreach ($providerBasketItemList as $providerBasketItem)
1806  {
1807  if ($providerBasketItem['BASKET_ITEM']->isBundleParent())
1808  {
1809  continue;
1810  }
1811 
1812  $resultProduct = new Result();
1813 
1814 
1815  $quantity = 0;
1816  $basketStoreData = array();
1817 
1818  $basketCode = $providerBasketItem['BASKET_CODE'];
1819 
1820  /** @var BasketItem $basketItem */
1821  if (!$basketItem = $providerBasketItem['BASKET_ITEM'])
1822  {
1823  throw new ObjectNotFoundException('Entity "BasketItem" not found');
1824  }
1825 
1827  {
1828  $quantity = $basketCountList[$basketCode];
1829 
1830  if (!empty($storeDataList) && is_array($storeDataList)
1831  && isset($storeDataList[$basketCode]))
1832  {
1833  $basketStoreData = $storeDataList[$basketCode];
1834  }
1835 
1836  if (!empty($basketStoreData))
1837  {
1838  $allBarcodeQuantity = 0;
1839  foreach($basketStoreData as $basketShipmentItemStore)
1840  {
1841  $allBarcodeQuantity += $basketShipmentItemStore['QUANTITY'];
1842  }
1843 
1844  if ($quantity > $allBarcodeQuantity)
1845  {
1846  $resultProduct->addError(new ResultError(Loc::getMessage('SALE_PROVIDER_SHIPMENT_SHIPPED_LESS_QUANTITY', array(
1847  '#PRODUCT_NAME#' => $basketItem->getField('NAME')
1848  )), 'SALE_PROVIDER_SHIPMENT_SHIPPED_LESS_QUANTITY'));
1849  }
1850  elseif ($quantity < $allBarcodeQuantity)
1851  {
1852  $resultProduct->addError(new ResultError(Loc::getMessage('SALE_PROVIDER_SHIPMENT_SHIPPED_MORE_QUANTITY', array(
1853  '#PRODUCT_NAME#' => $basketItem->getField('NAME')
1854  )), 'SALE_PROVIDER_SHIPMENT_SHIPPED_MORE_QUANTITY'));
1855  }
1856  }
1857 
1858  }
1859 
1860  if ($resultProduct->isSuccess())
1861  {
1862 
1863  if ($needShip === true)
1864  {
1865  if (method_exists($provider, 'tryShipmentProduct'))
1866  {
1867  /** @var Result $resultProductData */
1868  $resultProduct = $provider::tryShipmentProduct($basketItem, $providerBasketItem['RESERVED'], $basketStoreData, $quantity);
1869  }
1870  }
1871  else
1872  {
1873  if (method_exists($provider, 'tryUnshipmentProduct'))
1874  {
1875  /** @var Result $resultProductData */
1876  $resultProduct = $provider::tryUnshipmentProduct($providerBasketItem['PRODUCT_ID']);
1877  }
1878  }
1879  }
1880 
1881  $resultList[$basketCode] = $resultProduct;
1882 
1883  }
1884  }
1885  elseif (class_exists($provider))
1886  {
1887 
1888  /** @var ShipmentCollection $shipmentCollection */
1889  if (!$shipmentCollection = $shipment->getCollection())
1890  {
1891  throw new ObjectNotFoundException('Entity "ShipmentCollection" not found');
1892  }
1893 
1894  /** @var Order $order */
1895  if (!$order = $shipmentCollection->getOrder())
1896  {
1897  throw new ObjectNotFoundException('Entity "Order" not found');
1898  }
1899 
1900  $pool = Internals\PoolQuantity::getInstance($order->getInternalId());
1901 
1902  $context = array(
1903  'SITE_ID' => $order->getSiteId(),
1904  'CURRENCY' => $order->getCurrency(),
1905  );
1906 
1907  if ($order->getUserId() > 0)
1908  {
1909  $context['USER_ID'] = $order->getUserId();
1910  }
1911  else
1912  {
1913  global $USER;
1914  $context['USER_ID'] = $USER->getId();
1915  }
1916 
1917  $creator = Internals\ProviderCreator::create($context);
1918 
1919  $tryShipProductList = array();
1920  /** @var ShipmentItem $shipmentItem */
1921  foreach ($shipmentItemCollection as $shipmentItem)
1922  {
1923  $basketItem = $shipmentItem->getBasketItem();
1924  $providerClass = $basketItem->getProviderEntity();
1925 
1926  if ($providerClass instanceof SaleProviderBase)
1927  {
1928  $shipmentProductData = $creator->createItemForShip($shipmentItem);
1929  $creator->addShipmentProductData($shipmentProductData);
1930  }
1931  }
1932 
1933  $r = $creator->tryShip();
1934  if ($r->isSuccess())
1935  {
1936  if ($r->hasWarnings())
1937  {
1938  $result->addWarnings($r->getWarnings());
1939  }
1940  else
1941  {
1942  $data = $r->getData();
1943  if (array_key_exists('TRY_SHIP_PRODUCTS_LIST', $data))
1944  {
1945  $tryShipProductList = $data['TRY_SHIP_PRODUCTS_LIST'] + $tryShipProductList;
1946 
1947  $creator->setItemsResultAfterTryShip($pool, $tryShipProductList);
1948 
1949  }
1950  }
1951  }
1952  else
1953  {
1954  $result->addWarnings($r->getErrors());
1955  }
1956  }
1957  }
1958  }
1959 
1960  if (!empty($resultList)
1961  && !empty($bundleIndexList) && is_array($bundleIndexList))
1962  {
1963 
1964  foreach ($bundleIndexList as $bundleParentBasketCode => $bundleChildList)
1965  {
1966 // $tryShipmentBundle = false;
1967  foreach($bundleChildList as $bundleChildBasketCode)
1968  {
1969  if (!isset($resultList[$bundleChildBasketCode]))
1970  {
1971  if (!isset($resultList[$bundleParentBasketCode]))
1972  {
1973  $resultList[$bundleParentBasketCode] = new Result();
1974  }
1975 
1976  $resultList[$bundleParentBasketCode]->addError(new ResultError('Bundle child item not found', 'SALE_PROVIDER_SHIPMENT_SHIPPED_BUNDLE_CHILD_ITEM_NOT_FOUND'));
1977  }
1978 
1979  }
1980  }
1981 
1982  }
1983 
1984  if (!empty($resultList))
1985  {
1986  /** @var ShipmentCollection $shipmentCollection */
1987  if (!$shipmentCollection = $shipment->getCollection())
1988  {
1989  throw new ObjectNotFoundException('Entity "ShipmentCollection" not found');
1990  }
1991 
1992  /** @var Order $order */
1993  if (!$order = $shipmentCollection->getOrder())
1994  {
1995  throw new ObjectNotFoundException('Entity "Order" not found');
1996  }
1997 
1998  $hasErrors = false;
1999 
2000  /** @var ShipmentItem $shipmentItem */
2001  foreach ($shipmentItemCollection as $shipmentItem)
2002  {
2003  /** @var BasketItem $basketItem */
2004  if(!$basketItem = $shipmentItem->getBasketItem())
2005  {
2006  throw new ObjectNotFoundException('Entity "BasketItem" not found');
2007  }
2008 
2009  if (isset($resultList[$basketItem->getBasketCode()]) && !$resultList[$basketItem->getBasketCode()]->isSuccess())
2010  {
2011  $hasErrors = true;
2012  break;
2013  }
2014  }
2015 
2016  if (!$hasErrors)
2017  {
2018  /** @var ShipmentItem $shipmentItem */
2019  foreach ($shipmentItemCollection as $shipmentItem)
2020  {
2021  /** @var BasketItem $basketItem */
2022  if(!$basketItem = $shipmentItem->getBasketItem())
2023  {
2024  throw new ObjectNotFoundException('Entity "BasketItem" not found');
2025  }
2026 
2027  if (isset($resultList[$basketItem->getBasketCode()]) && $resultList[$basketItem->getBasketCode()]->isSuccess())
2028  {
2029  static::addQuantityPoolItem($order->getInternalId(), $basketItem, ($needShip? -1 : 1) * $shipmentItem->getQuantity());
2030 
2031  if ($needShip)
2032  $shipmentItem->setFieldNoDemand("RESERVED_QUANTITY", 0);
2033 
2034  }
2035  }
2036  }
2037 
2038  $result->setData($resultList);
2039  }
2040 
2041  return $result;
2042  }

◆ tryShipmentItemList()

static tryShipmentItemList (   $shipmentItemList)
static
Аргументы
ShipmentItem[]$shipmentItemList
Возвращает
Result
Исключения
ObjectNotFoundException

См. определение в файле providerbase.php строка 2050

2051  {
2052  $result = new Result();
2053 
2054  $resultList = array();
2055  $bundleIndexList = static::getBundleIndexFromShipmentItemCollection($shipmentItemList);
2056 
2058  {
2059  /** @var Result $r */
2060  $r = static::getStoreDataFromShipmentItemCollection($shipmentItemList);
2061  if ($r->isSuccess())
2062  {
2063  $resultStoreData = $r->getData();
2064  if (!empty($resultStoreData['STORE_DATA_LIST']))
2065  {
2066  $storeDataList = $resultStoreData['STORE_DATA_LIST'];
2067  }
2068  }
2069  else
2070  {
2071  $result->addErrors($r->getErrors());
2072  }
2073 
2074  }
2075 
2076  $shipmentItemParentsList = array();
2077 
2078  $tryShipProductList = array();
2079 
2080  /** @var ShipmentItem $shipmentItem */
2081  foreach ($shipmentItemList as $shipmentItem)
2082  {
2083  $itemIndex = $shipmentItem->getInternalIndex();
2084  $basketItem = $shipmentItem->getBasketItem();
2085  $providerName = $basketItem->getProviderName();
2086 
2087  /** @var ShipmentItemCollection $shipmentItemCollection */
2088  $shipmentItemCollection = $shipmentItem->getCollection();
2089  if (!$shipmentItemCollection)
2090  {
2091  throw new ObjectNotFoundException('Entity "ShipmentItemCollection" not found');
2092  }
2093 
2094  /** @var Shipment $shipment */
2095  $shipment = $shipmentItemCollection->getShipment();
2096  if (!$shipment)
2097  {
2098  throw new ObjectNotFoundException('Entity "Shipment" not found');
2099  }
2100 
2101  $shipmentItemParentsList[$itemIndex] = array(
2102  'BASKET_ITEM' => $basketItem,
2103  'SHIPMENT' => $shipment,
2104  'SHIPMENT_ITEM_COLLECTION' => $shipmentItemCollection,
2105  );
2106 
2107  $needShip = $shipment->needShip();
2108  if ($needShip === null)
2109  continue;
2110 
2111 
2112  if ($providerName && array_key_exists("IBXSaleProductProvider", class_implements($providerName)))
2113  {
2114  $basketItem = $shipmentItem->getBasketItem();
2115  if (!$basketItem)
2116  {
2117  throw new ObjectNotFoundException('Entity "BasketItem" not found');
2118  }
2119 
2120  if ($basketItem->isBundleParent())
2121  {
2122  continue;
2123  }
2124 
2125  $basketCode = $basketItem->getBasketCode();
2126  $quantity = $shipmentItem->getQuantity();
2127  $basketStoreData = array();
2128 
2129  $resultProduct = new Result();
2130 
2132  {
2133  if (!empty($storeDataList) && is_array($storeDataList)
2134  && isset($storeDataList[$basketCode]))
2135  {
2136  $basketStoreData = $storeDataList[$basketCode];
2137  }
2138 
2139  if (!empty($basketStoreData))
2140  {
2141  $allBarcodeQuantity = 0;
2142  foreach($basketStoreData as $basketShipmentItemStore)
2143  {
2144  $allBarcodeQuantity += $basketShipmentItemStore['QUANTITY'];
2145  }
2146 
2147  if ($quantity > $allBarcodeQuantity)
2148  {
2149  $resultProduct->addError(new ResultError(Loc::getMessage('SALE_PROVIDER_SHIPMENT_SHIPPED_LESS_QUANTITY', array(
2150  '#PRODUCT_NAME#' => $basketItem->getField('NAME')
2151  )), 'SALE_PROVIDER_SHIPMENT_SHIPPED_LESS_QUANTITY'));
2152  }
2153  elseif ($quantity < $allBarcodeQuantity)
2154  {
2155  $resultProduct->addError(new ResultError(Loc::getMessage('SALE_PROVIDER_SHIPMENT_SHIPPED_MORE_QUANTITY', array(
2156  '#PRODUCT_NAME#' => $basketItem->getField('NAME')
2157  )), 'SALE_PROVIDER_SHIPMENT_SHIPPED_MORE_QUANTITY'));
2158  }
2159  }
2160 
2161  }
2162 
2163  if ($resultProduct->isSuccess())
2164  {
2165 
2166  if ($needShip === true)
2167  {
2168  if (method_exists($providerName, 'tryShipmentProduct'))
2169  {
2170  /** @var Result $resultProductData */
2171  $resultProduct = $providerName::tryShipmentProduct($basketItem, $basketItem->getField('RESERVED'), $basketStoreData, $quantity);
2172  }
2173  }
2174  else
2175  {
2176  if (method_exists($providerName, 'tryUnshipmentProduct'))
2177  {
2178  /** @var Result $resultProductData */
2179  $resultProduct = $providerName::tryUnshipmentProduct($basketItem->getProductId());
2180  }
2181  }
2182  }
2183 
2184  $resultList[$basketCode] = $resultProduct;
2185 
2186  }
2187  elseif (class_exists($providerName))
2188  {
2189  /** @var ShipmentCollection $shipmentCollection */
2190  $shipmentCollection = $shipment->getCollection();
2191  if (!$shipmentCollection)
2192  {
2193  throw new ObjectNotFoundException('Entity "ShipmentCollection" not found');
2194  }
2195 
2196  /** @var Order $order */
2197  $order = $shipmentCollection->getOrder();
2198  if (!$order)
2199  {
2200  throw new ObjectNotFoundException('Entity "Order" not found');
2201  }
2202 
2203  $shipmentItemParentsList[$itemIndex]['SHIPMENT_COLLECTION'] = $shipmentCollection;
2204  $shipmentItemParentsList[$itemIndex]['ORDER'] = $order;
2205 
2206  $pool = Internals\PoolQuantity::getInstance($order->getInternalId());
2207 
2208  $context = array(
2209  'SITE_ID' => $order->getSiteId(),
2210  'CURRENCY' => $order->getCurrency(),
2211  );
2212 
2213  if ($order->getUserId() > 0)
2214  {
2215  $context['USER_ID'] = $order->getUserId();
2216  }
2217  else
2218  {
2219  global $USER;
2220  $context['USER_ID'] = $USER->getId();
2221  }
2222 
2223  $creator = Internals\ProviderCreator::create($context);
2224 
2225  $shipmentProductData = $creator->createItemForShip($shipmentItem);
2226  $creator->addShipmentProductData($shipmentProductData);
2227 
2228  $r = $creator->tryShip();
2229  if ($r->isSuccess())
2230  {
2231  if ($r->hasWarnings())
2232  {
2233  $result->addWarnings($r->getWarnings());
2234  }
2235  else
2236  {
2237  $data = $r->getData();
2238  if (array_key_exists('TRY_SHIP_PRODUCTS_LIST', $data))
2239  {
2240  $tryShipProductList = $data['TRY_SHIP_PRODUCTS_LIST'] + $tryShipProductList;
2241  $creator->setItemsResultAfterTryShip($pool, $tryShipProductList);
2242  }
2243  }
2244  }
2245  else
2246  {
2247  $result->addWarnings($r->getErrors());
2248  }
2249  }
2250  }
2251 
2252  if (!empty($resultList)
2253  && !empty($bundleIndexList) && is_array($bundleIndexList))
2254  {
2255 
2256  foreach ($bundleIndexList as $bundleParentBasketCode => $bundleChildList)
2257  {
2258  foreach($bundleChildList as $bundleChildBasketCode)
2259  {
2260  if (!isset($resultList[$bundleChildBasketCode]))
2261  {
2262  if (!isset($resultList[$bundleParentBasketCode]))
2263  {
2264  $resultList[$bundleParentBasketCode] = new Result();
2265  }
2266 
2267  $resultList[$bundleParentBasketCode]->addError(new ResultError('Bundle child item not found', 'SALE_PROVIDER_SHIPMENT_SHIPPED_BUNDLE_CHILD_ITEM_NOT_FOUND'));
2268  }
2269 
2270  }
2271  }
2272 
2273  }
2274 
2275  if (!empty($resultList))
2276  {
2277 
2278  $hasErrors = false;
2279 
2280  /** @var ShipmentItem $shipmentItem */
2281  foreach ($shipmentItemList as $shipmentItem)
2282  {
2283  $itemIndex = $shipmentItem->getInternalIndex();
2284 
2285  /** @var BasketItem $basketItem */
2286  $basketItem = $shipmentItemParentsList[$itemIndex]['BASKET_ITEM'];
2287 
2288  if (isset($resultList[$basketItem->getBasketCode()]) && !$resultList[$basketItem->getBasketCode()]->isSuccess())
2289  {
2290  $hasErrors = true;
2291  break;
2292  }
2293  }
2294 
2295  if (!$hasErrors)
2296  {
2297  /** @var ShipmentItem $shipmentItem */
2298  foreach ($shipmentItemList as $shipmentItem)
2299  {
2300  $itemIndex = $shipmentItem->getInternalIndex();
2301 
2302  /** @var BasketItem $basketItem */
2303  $basketItem = $shipmentItemParentsList[$itemIndex]['BASKET_ITEM'];
2304 
2305  $productId = $shipmentItem->getProductId();
2306 
2307  if (isset($resultList[$basketItem->getBasketCode()]) && $resultList[$basketItem->getBasketCode()]->isSuccess())
2308  {
2309  /** @var Shipment $shipment */
2310  $shipment = $shipmentItemParentsList[$itemIndex]['SHIPMENT'];
2311 
2312  /** @var Order $order */
2313  $order = $shipmentItemParentsList[$itemIndex]['ORDER'];
2314 
2315  if (!$order)
2316  {
2317  /** @var ShipmentCollection $shipmentCollection */
2318  $shipmentCollection = $shipment->getCollection();
2319  if (!$shipmentCollection)
2320  {
2321  throw new ObjectNotFoundException('Entity "ShipmentCollection" not found');
2322  }
2323 
2324  /** @var Order $order */
2325  $order = $shipmentCollection->getOrder();
2326  if (!$order)
2327  {
2328  throw new ObjectNotFoundException('Entity "Order" not found');
2329  }
2330 
2331  $shipmentItemParentsList[$itemIndex]['SHIPMENT_COLLECTION'] = $shipmentCollection;
2332  $shipmentItemParentsList[$itemIndex]['ORDER'] = $order;
2333  }
2334 
2335  $needShip = $shipment->needShip();
2336 
2337  static::addQuantityPoolItem($order->getInternalId(), $basketItem, ($needShip? -1 : 1) * $shipmentItem->getQuantity());
2338 
2339  if ($needShip)
2340  {
2341  $shipmentItem->setFieldNoDemand("RESERVED_QUANTITY", 0);
2342  }
2343 
2344 
2345  $foundItem = false;
2346  $poolItems = Internals\ItemsPool::get($order->getInternalId(), $productId);
2347  if (!empty($poolItems))
2348  {
2349  /** @var ShipmentItem $poolItem */
2350  foreach ($poolItems as $poolItem)
2351  {
2352  if ($poolItem->getInternalIndex() == $shipmentItem->getInternalIndex())
2353  {
2354  $foundItem = true;
2355  break;
2356  }
2357  }
2358  }
2359 
2360  if (!$foundItem)
2361  {
2362  Internals\ItemsPool::add($order->getInternalId(), $productId, $shipmentItem);
2363  }
2364 
2365  }
2366  }
2367  }
2368 
2369  $result->setData($resultList);
2370  }
2371 
2372  return $result;
2373  }

◆ tryUnreserveShipment()

static tryUnreserveShipment ( Shipment  $shipment)
static
Аргументы
Shipment$shipment
Возвращает
Result
Исключения
ObjectNotFoundException

См. определение в файле providerbase.php строка 2677

2678  {
2679  $result = new Result();
2680  /** @var ShipmentItemCollection $shipmentItemCollection */
2681  if (!$shipmentItemCollection = $shipment->getShipmentItemCollection())
2682  {
2683  throw new ObjectNotFoundException('Entity "ShipmentItemCollection" not found');
2684  }
2685 
2686  /** @var ShipmentCollection $shipmentCollection */
2687  if (!($shipmentCollection = $shipment->getCollection()))
2688  {
2689  throw new ObjectNotFoundException('Entity "ShipmentCollection" not found');
2690  }
2691 
2692  /** @var Order $order */
2693  if (!($order = $shipmentCollection->getOrder()))
2694  {
2695  throw new ObjectNotFoundException('Entity "Order" not found');
2696  }
2697 
2698  /** @var ShipmentItem $shipmentItem */
2699  foreach ($shipmentItemCollection as $shipmentItem)
2700  {
2701  /** @var Result $r */
2702  $r = static::tryUnreserveShipmentItem($shipmentItem);
2703  if (!$r->isSuccess())
2704  {
2705  $result->addErrors($r->getErrors());
2706  EntityMarker::addMarker($order, $shipment, $r);
2707  if (!$shipment->isSystem())
2708  {
2709  $shipment->setField('MARKED', 'Y');
2710  }
2711  }
2712  elseif ($r->hasWarnings())
2713  {
2714  $result->addWarnings($r->getWarnings());
2715  }
2716  }
2717 
2718  return $result;
2719  }

◆ tryUnreserveShipmentItem()

static tryUnreserveShipmentItem ( ShipmentItem  $shipmentItem)
static
Аргументы
ShipmentItem$shipmentItem
Возвращает
Result
Исключения
NotSupportedException
ObjectNotFoundException

См. определение в файле providerbase.php строка 2943

2944  {
2945  $result = new Result();
2946 
2947  /** @var ShipmentItemCollection $shipmentItemCollection */
2948  if (!$shipmentItemCollection = $shipmentItem->getCollection())
2949  {
2950  throw new ObjectNotFoundException('Entity "ShipmentItemCollection" not found');
2951  }
2952 
2953  /** @var Shipment $shipment */
2954  if (!$shipment = $shipmentItemCollection->getShipment())
2955  {
2956  throw new ObjectNotFoundException('Entity "Shipment" not found');
2957  }
2958 
2959  /** @var ShipmentCollection $shipmentCollection */
2960  if (!$shipmentCollection = $shipment->getCollection())
2961  {
2962  throw new ObjectNotFoundException('Entity "ShipmentCollection" not found');
2963  }
2964 
2965  /** @var Order $order */
2966  if (!$order = $shipmentCollection->getOrder())
2967  {
2968  throw new ObjectNotFoundException('Entity "Order" not found');
2969  }
2970 
2971  /** @var BasketItem $basketItem */
2972  if (!$basketItem = $shipmentItem->getBasketItem())
2973  {
2974  $result->addError( new ResultError(
2975  Loc::getMessage('SALE_PROVIDER_BASKET_ITEM_NOT_FOUND', array(
2976  '#BASKET_ITEM_ID#' => $shipmentItem->getBasketId(),
2977  '#SHIPMENT_ID#' => $shipment->getId(),
2978  '#SHIPMENT_ITEM_ID#' => $shipmentItem->getId(),
2979  )),
2980  'PROVIDER_TRY_UNRESERVED_SHIPMENT_ITEM_WRONG_BASKET_ITEM')
2981  );
2982  return $result;
2983  }
2984 
2985  if ($basketItem->isBundleParent())
2986  {
2987  return $result;
2988  }
2989 
2990  $quantity = $shipmentItem->getReservedQuantity();
2991 
2992  $canReserve = false;
2993 
2994  $providerName = $basketItem->getProvider();
2995 
2996  $providerExists = false;
2997  $availableQuantityData = array(
2998  'HAS_PROVIDER' => true,
2999  'AVAILABLE_QUANTITY' => $quantity
3000  );
3001 
3002  if (class_exists($providerName))
3003  {
3004  $providerClass = new $providerName();
3005  if ($providerClass instanceof SaleProviderBase)
3006  {
3007  $providerExists = true;
3008  }
3009  }
3010 
3011  if (!$providerExists)
3012  {
3013  if (!array_key_exists("IBXSaleProductProvider", class_implements($providerName)))
3014  {
3015  $availableQuantityData['HAS_PROVIDER'] = false;
3016  }
3017  }
3018 
3019  if (array_key_exists('HAS_PROVIDER', $availableQuantityData))
3020  {
3021  $canReserve = $availableQuantityData['HAS_PROVIDER'];
3022  }
3023 
3024  if ($canReserve)
3025  {
3026 
3027  static::addReservationPoolItem($order->getInternalId(), $shipmentItem->getBasketItem(), $quantity);
3028 
3029  $reservedQuantity = ($shipmentItem->getReservedQuantity() > 0 ? $shipmentItem->getReservedQuantity() + $quantity : 0);
3030 
3031  $needShip = $shipment->needShip();
3032  if ($needShip)
3033  {
3034  $shipmentItem->setFieldNoDemand('RESERVED_QUANTITY', $reservedQuantity);
3035  }
3036  else
3037  {
3038  $r = $shipmentItem->setField('RESERVED_QUANTITY', $reservedQuantity);
3039  if (!$r->isSuccess())
3040  {
3041  $result->addErrors($r->getErrors());
3042  }
3043  }
3044  }
3045 
3046  $result->addData(array(
3047  'CAN_RESERVE' => $canReserve
3048  ));
3049 
3050  return $result;
3051  }

◆ viewProduct()

static viewProduct ( BasketItem  $basketItem)
static
Аргументы
BasketItem$basketItem
Возвращает
array
Исключения
ObjectNotFoundException

См. определение в файле providerbase.php строка 3982

3983  {
3984  $result = new Result();
3985  $basketProviderData = static::createProviderBasketItemMap($basketItem, array('SITE_ID', 'USER_ID'));
3986  $provider = $basketProviderData['PROVIDER'];
3987  if (!empty($provider))
3988  {
3989  if (array_key_exists("IBXSaleProductProvider", class_implements($provider)))
3990  {
3991  $productId = $basketProviderData['PRODUCT_ID'];
3992  $data = array(
3993  'PRODUCT_ID' => $productId,
3994  'USER_ID' => $basketProviderData['USER_ID'],
3995  'SITE_ID' => $basketProviderData['SITE_ID'],
3996  );
3997 
3998  $r = static::getViewProduct($provider, $data);
3999  if ($r->isSuccess())
4000  {
4001  $resultProductData = $r->getData();
4002  if (array_key_exists($productId, $resultProductData))
4003  {
4004  $result->setData($resultProductData);
4005  }
4006  }
4007 
4008  }
4009  elseif (class_exists($provider))
4010  {
4011  /** @var Basket $basket */
4012  $basket = $basketItem->getCollection();
4013  if (!$basket)
4014  {
4015  throw new ObjectNotFoundException('Entity "Basket" not found');
4016  }
4017 
4018  $order = $basket->getOrder();
4019 
4020  if ($order)
4021  {
4022  $context = array(
4023  'USER_ID' => $order->getUserId(),
4024  'SITE_ID' => $order->getSiteId(),
4025  'CURRENCY' => $order->getCurrency(),
4026  );
4027  }
4028  else
4029  {
4030  global $USER;
4031  $context = array(
4032  'USER_ID' => $USER->getId(),
4033  'SITE_ID' => SITE_ID,
4034  'CURRENCY' => Currency\CurrencyManager::getBaseCurrency(),
4035  );
4036  }
4037 
4038  $creator = Internals\ProviderCreator::create($context);
4039 
4040  $providerClass = $basketItem->getProviderEntity();
4041  if ($providerClass instanceof SaleProviderBase)
4042  {
4043  $creator->addBasketItem($basketItem);
4044  }
4045 
4046  $r = $creator->viewProduct();
4047  if ($r->isSuccess())
4048  {
4049  $data = $r->getData();
4050  if (array_key_exists('VIEW_PRODUCTS_LIST', $data))
4051  {
4052  $resultList = $data['VIEW_PRODUCTS_LIST'];
4053 
4054  if (!empty($resultList))
4055  {
4056  $productId = $basketItem->getProductId();
4057  $result = reset($resultList);
4058 
4059  $result->setData(
4060  array(
4061  $productId => reset($resultList)
4062  )
4063  );
4064  }
4065  }
4066  }
4067  }
4068  }
4069 
4070  return $result;
4071  }

Поля

◆ $hitCache

$hitCache = array()
staticprotected

См. определение в файле providerbase.php строка 33

◆ $productData

$productData = array()
static

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

◆ $quantityPool

$quantityPool = array()
staticprotected

См. определение в файле providerbase.php строка 42

◆ $reservationPool

$reservationPool = array()
staticprotected

См. определение в файле providerbase.php строка 30

◆ $trustData

$trustData = array()
staticprotected

См. определение в файле providerbase.php строка 36

◆ $useReadTrustData

$useReadTrustData = false
staticprotected

См. определение в файле providerbase.php строка 39

◆ POOL_ACTION_RESERVATION

const POOL_ACTION_RESERVATION = "RESERVE"

См. определение в файле providerbase.php строка 46

◆ POOL_ACTION_SHIP

const POOL_ACTION_SHIP = "SHIP"

См. определение в файле providerbase.php строка 47


Объявления и описания членов класса находятся в файле:
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Returns translation by message code.
Definition: loc.php:29
Bitrix\Sale\EntityMarker\getEntity
static getEntity(Order $order, $entityType, $entityId)
Definition: entitymarker.php:834
Bitrix\Sale\Internals\PoolQuantity\POOL_QUANTITY_TYPE
const POOL_QUANTITY_TYPE
Definition: poolquantity.php:16
Bitrix\Sale\ProviderBase\$trustData
static $trustData
Definition: providerbase.php:36
Bitrix\Sale\Internals\PoolBase\add
static add($code, $type, $value)
Definition: poolbase.php:51
Bitrix\Sale\Internals\PoolQuantity\getInstance
static getInstance($key)
Definition: poolquantity.php:26
Bitrix\Sale\EntityMarker\getPoolItemSuccess
static getPoolItemSuccess(Order $order, $id, $entityType, $entityId, $code)
Definition: entitymarker.php:939
Bitrix\Sale\EntityMarker\addMarker
static addMarker(OrderBase $order, Internals\Entity $entity, Result $result)
Definition: entitymarker.php:35
Bitrix\Sale\Internals\SiteCurrencyTable\getSiteCurrency
static getSiteCurrency($siteId)
Returns site currency.
Definition: internals/sitecurrency.php:80
IEntityMarker
Definition: entitymarkerinterface.php:9
Bitrix\Sale\Internals\PoolQuantity\POOL_RESERVE_TYPE
const POOL_RESERVE_TYPE
Definition: poolquantity.php:15
Bitrix\Sale\EntityMarker\hasErrors
static hasErrors(Order $order)
Definition: entitymarker.php:975
Bitrix\Sale\EntityMarker\getList
static getList(array $parameters=array())
Definition: entitymarker.php:898
Bitrix\Sale\Internals\Catalog\Provider\createMapShipmentItemCollectionStoreData
static createMapShipmentItemCollectionStoreData($shipmentItemList)
Definition: sale/lib/internals/catalog/provider.php:1355
Bitrix\Sale\EntityMarker\ENTITY_SUCCESS_CODE_DONE
const ENTITY_SUCCESS_CODE_DONE
Definition: entitymarker.php:25
Bitrix\Currency\CurrencyManager\getBaseCurrency
static getBaseCurrency()
Return base currency.
Definition: currencymanager.php:59
Bitrix\Sale\Configuration\getProductReservationCondition
static getProductReservationCondition()
Returns current reservation condition.
Definition: sale/lib/configuration.php:60
Bitrix\Sale\Configuration\RESERVE_ON_SHIP
const RESERVE_ON_SHIP
Definition: sale/lib/configuration.php:20
Bitrix\Sale\Internals\Catalog\Provider\save
static save(Sale\Order $order, array $context=array())
Definition: sale/lib/internals/catalog/provider.php:1387
Bitrix\Sale\BasketItem\TYPE_SET
const TYPE_SET
Definition: basketitem.php:28
Bitrix\Sale\Internals\PoolBase\get
static get($code, $type)
Definition: poolbase.php:19
Bitrix\Sale\Configuration\useStoreControl
static useStoreControl()
Returns flag enable use stores.
Definition: sale/lib/configuration.php:178
Bitrix\Sale\Internals\Catalog\Provider\getProductData
static getProductData($basketList, array $context)
Definition: sale/lib/internals/catalog/provider.php:35
Bitrix\Sale\Internals\ProviderCreator\create
static create(array $context)
Definition: providercreator.php:22
Bitrix\Sale\ProviderBase\$productData
static $productData
Definition: providerbase.php:44
Bitrix\Sale\ProviderBase\$quantityPool
static $quantityPool
Definition: providerbase.php:42