• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/helpers/order/builder/basketbuilder.php
  • Класс: BitrixSaleHelpersOrderBuilderBasketBuilder
  • Вызов: BasketBuilder::itemsDataPreparation
public function itemsDataPreparation()
{
	foreach($this->formData["PRODUCT"] as $basketCode => $productData)
	{
		if (isset($productData["IS_SET_ITEM"]) && $productData["IS_SET_ITEM"] === "Y")
		{
			continue;
		}

		if(!isset($productData["PROPS"]) || !is_array($productData["PROPS"]))
			$productData["PROPS"] = array();

		/** @var BasketItem $item */
		$item = $this->getItemFromBasket($basketCode, $productData);

		if($item)
		{
			$this->setItemData($basketCode, $productData, $item);
		}
		else
		{
			$item = $this->createItem($basketCode, $productData);

			if(!$this->isProductAdded)
			{
				$this->isProductAdded = true;
			}
		}

		/*
		 * Could be deleted and than added one more time product.
		 * Or just added product.
		 */
		if($basketCode != $item->getBasketCode())
			$this->basketCodeMap[$basketCode] = $item->getBasketCode();

		if(!empty($productData["PROPS"]) && is_array($productData["PROPS"]))
		{
			/** @var BitrixSaleBasketPropertiesCollection $property */
			$property = $item->getPropertyCollection();
			if(!$property->isPropertyAlreadyExists($productData["PROPS"]))
			{
				$property->setProperty($productData["PROPS"]);
			}
		}
	}

	return $this;
}