31 $basketItem = static::createItemInternal($this,
$moduleId, $productId, $basketCode);
33 $basketItem->setCollection($this);
34 $this->addItem($basketItem);
51 $basketItemClassName = static::getItemCollectionClassName();
52 return $basketItemClassName::create($basket,
$moduleId, $productId, $basketCode);
62 return $basket->getOrder();
75 public function loadFromArray(
array $itemList)
78 $itemClassName = static::getItemCollectionClassName();
80 foreach ($itemList as $item)
82 $basketItem = $itemClassName::load($this, $item);
83 $this->bindItem($basketItem);
87 $controller->initializeCollection($this);
98 return $registry->getBasketItemClassName();
106 public function getItemByBasketCode(
$code)
109 foreach ($this->collection as $basketItem)
111 $basketItem = $basketItem->findItemByBasketCode(
$code);
112 if ($basketItem !=
null)
127 public function getItemByXmlId($xmlId)
130 foreach ($this->collection as $basketItem)
132 $basketItem = $basketItem->findItemByXmlId($xmlId);
133 if ($basketItem !=
null)
147 public function getItemById($id)
157 foreach ($this->collection as $basketItem)
159 $item = $basketItem->findItemById($id);
174 return $this->collection;
187 public function getExistsItems(
string $moduleId,
int $productId, ?
array $properties = [])
193 if ((
int)$basketItem->getField(
'PRODUCT_ID') === $productId && $basketItem->getField(
'MODULE') ===
$moduleId)
196 if (is_null($properties))
203 $basketPropertyCollection = $basketItem->getPropertyCollection();
206 if ($basketPropertyCollection->isPropertyAlreadyExists($properties))
238 public function getContext()
244 $basketItem = $this->rewind();
247 $siteId = $basketItem->getField(
'LID');
248 $fuserId = $basketItem->getFUserId();
273 if (Loader::includeModule(
'currency'))
282 $currency = Currency\CurrencyManager::getBaseCurrency();
309 return current($this->getExistsItems(
$moduleId, $productId, $properties)) ?:
null;
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)